265 if (scene.fEncoding->is_empty()) {
277 SKGPU_LOG_W(
"VelloRenderer: cannot render to an empty target");
282 auto config = scene.fEncoding->prepare_render(
283 std::min(
params.fWidth,
static_cast<uint32_t
>(dims.
fWidth)),
284 std::min(
params.fHeight,
static_cast<uint32_t
>(dims.
fHeight)),
285 to_vello_color(
params.fBaseColor));
286 auto dispatchInfo = config->workgroup_counts();
287 auto bufferSizes = config->buffer_sizes();
296 size_t uboSize = config->config_uniform_buffer_size();
298 if (!uboPtr || !config->write_config_uniform_buffer(to_slice(uboPtr, uboSize))) {
302 size_t sceneSize = config->scene_buffer_size();
304 if (!scenePtr || !config->write_scene_buffer(to_slice(scenePtr, sceneSize))) {
320 const size_t lines_size = bufferSizes.lines;
321 const size_t bin_data_size = bufferSizes.bin_data;
322 const size_t tiles_size = bufferSizes.tiles;
323 const size_t segments_size = bufferSizes.segments;
324 const size_t seg_counts_size = bufferSizes.seg_counts;
325 const size_t ptcl_size = bufferSizes.ptcl;
342 builder.assignSharedBuffer(new_scratch_slice(pathtagReduceOutput),
345 builder.appendStep(&fPathtagReduce, to_wg_size(dispatchInfo.path_reduce));
352 if (dispatchInfo.use_large_path_scan) {
356 builder.assignSharedBuffer(new_scratch_slice(reduced2),
358 builder.assignSharedBuffer(new_scratch_slice(reducedScan),
361 builder.appendStep(&fPathtagReduce2, to_wg_size(dispatchInfo.path_reduce2));
362 builder.appendStep(&fPathtagScan1, to_wg_size(dispatchInfo.path_scan1));
363 builder.appendStep(&fPathtagScanLarge, to_wg_size(dispatchInfo.path_scan));
365 builder.appendStep(&fPathtagScanSmall, to_wg_size(dispatchInfo.path_scan));
372 builder.appendStep(&fBboxClear, to_wg_size(dispatchInfo.bbox_clear));
377 builder.appendStep(&fFlatten, to_wg_size(dispatchInfo.flatten));
384 builder.appendStep(&fDrawReduce, to_wg_size(dispatchInfo.draw_reduce));
394 builder.appendStep(&fDrawLeaf, to_wg_size(dispatchInfo.draw_leaf));
403 WorkgroupSize clipReduceWgCount = to_wg_size(dispatchInfo.clip_reduce);
404 WorkgroupSize clipLeafWgCount = to_wg_size(dispatchInfo.clip_leaf);
405 bool doClipReduce = clipReduceWgCount.
scalarSize() > 0u;
406 bool doClipLeaf = clipLeafWgCount.
scalarSize() > 0u;
407 if (doClipReduce || doClipLeaf) {
413 builder.appendStep(&fClipReduce, clipReduceWgCount);
416 builder.appendStep(&fClipLeaf, clipLeafWgCount);
427 builder.appendStep(&fBinning, to_wg_size(dispatchInfo.binning));
437 builder.appendStep(&fTileAlloc, to_wg_size(dispatchInfo.tile_alloc));
442 auto indirectCountBuffer = new_indirect_slice(bufMgr, bufferSizes.indirect_count);
444 builder.appendStep(&fPathCountSetup, to_wg_size(dispatchInfo.path_count_setup));
453 builder.appendStepIndirect(&fPathCount, indirectCountBuffer);
456 builder.appendStep(&fBackdrop, to_wg_size(dispatchInfo.backdrop));
460 builder.appendStep(&fCoarse, to_wg_size(dispatchInfo.coarse));
463 builder.appendStep(&fPathTilingSetup, to_wg_size(dispatchInfo.path_tiling_setup));
467 builder.appendStepIndirect(&fPathTiling, indirectCountBuffer);
472 switch (
params.fAaConfig) {
474 fineVariant = fFineArea.get();
477 fineVariant = fFineMsaa16.get();
480 fineVariant = fFineMsaa8.get();
484 builder.appendStep(fineVariant, to_wg_size(dispatchInfo.fine));
486 return builder.finalize();