261 {
264
265 if (scene.fEncoding->is_empty()) {
266 return nullptr;
267 }
268
270 return nullptr;
271 }
272
273
274
277 SKGPU_LOG_W(
"VelloRenderer: cannot render to an empty target");
278 return nullptr;
279 }
280
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();
288
289 DispatchGroup::Builder
builder(recorder);
290
291
292
293
295
296 size_t uboSize = config->config_uniform_buffer_size();
298 if (!uboPtr || !config->write_config_uniform_buffer(to_slice(uboPtr, uboSize))) {
299 return nullptr;
300 }
301
302 size_t sceneSize = config->scene_buffer_size();
303 auto [scenePtr, sceneBuf] = bufMgr->getStoragePointer(sceneSize);
304 if (!scenePtr || !config->write_scene_buffer(to_slice(scenePtr, sceneSize))) {
305 return nullptr;
306 }
307
308
309
310
311
312
313
314
315
316
317
318
319
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;
326
327
328
331
332
333
334 ScratchBuffer bump = bufMgr->getScratchStorage(bufferSizes.bump_alloc);
336
337
338 ScratchBuffer tagmonoids = bufMgr->getScratchStorage(bufferSizes.path_monoids);
339 {
340
341 ScratchBuffer pathtagReduceOutput = bufMgr->getScratchStorage(bufferSizes.path_reduced);
342 builder.assignSharedBuffer(new_scratch_slice(pathtagReduceOutput),
345 builder.appendStep(&fPathtagReduce, to_wg_size(dispatchInfo.path_reduce));
346
347
348
349
350
351
352 if (dispatchInfo.use_large_path_scan) {
353 ScratchBuffer reduced2 = bufMgr->getScratchStorage(bufferSizes.path_reduced2);
354 ScratchBuffer reducedScan = bufMgr->getScratchStorage(bufferSizes.path_reduced_scan);
355
356 builder.assignSharedBuffer(new_scratch_slice(reduced2),
358 builder.assignSharedBuffer(new_scratch_slice(reducedScan),
360
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));
364 } else {
365 builder.appendStep(&fPathtagScanSmall, to_wg_size(dispatchInfo.path_scan));
366 }
367 }
368
369
370 ScratchBuffer pathBboxes = bufMgr->getScratchStorage(bufferSizes.path_bboxes);
372 builder.appendStep(&fBboxClear, to_wg_size(dispatchInfo.bbox_clear));
373
374
375 ScratchBuffer
lines = bufMgr->getScratchStorage(lines_size);
377 builder.appendStep(&fFlatten, to_wg_size(dispatchInfo.flatten));
378
379 tagmonoids.returnToPool();
380
381
382 ScratchBuffer drawReduced = bufMgr->getScratchStorage(bufferSizes.draw_reduced);
384 builder.appendStep(&fDrawReduce, to_wg_size(dispatchInfo.draw_reduce));
385
386
387 ScratchBuffer drawMonoids = bufMgr->getScratchStorage(bufferSizes.draw_monoids);
388 ScratchBuffer binData = bufMgr->getScratchStorage(bin_data_size);
389
390 ScratchBuffer clipInput = bufMgr->getScratchStorage(bufferSizes.clip_inps);
394 builder.appendStep(&fDrawLeaf, to_wg_size(dispatchInfo.draw_leaf));
395
396 drawReduced.returnToPool();
397
398
399
400
401 ScratchBuffer clipBboxes = bufMgr->getScratchStorage(bufferSizes.clip_bboxes);
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) {
408 ScratchBuffer clipBic = bufMgr->getScratchStorage(bufferSizes.clip_bics);
409 ScratchBuffer clipEls = bufMgr->getScratchStorage(bufferSizes.clip_els);
412 if (doClipReduce) {
413 builder.appendStep(&fClipReduce, clipReduceWgCount);
414 }
415 if (doClipLeaf) {
416 builder.appendStep(&fClipLeaf, clipLeafWgCount);
417 }
418 }
419
420 clipInput.returnToPool();
421
422
423 ScratchBuffer drawBboxes = bufMgr->getScratchStorage(bufferSizes.draw_bboxes);
424 ScratchBuffer binHeaders = bufMgr->getScratchStorage(bufferSizes.bin_headers);
427 builder.appendStep(&fBinning, to_wg_size(dispatchInfo.binning));
428
429 pathBboxes.returnToPool();
430 clipBboxes.returnToPool();
431
432
433 ScratchBuffer paths = bufMgr->getScratchStorage(bufferSizes.paths);
434 ScratchBuffer
tiles = bufMgr->getScratchStorage(tiles_size);
437 builder.appendStep(&fTileAlloc, to_wg_size(dispatchInfo.tile_alloc));
438
439 drawBboxes.returnToPool();
440
441
442 auto indirectCountBuffer = new_indirect_slice(bufMgr, bufferSizes.indirect_count);
444 builder.appendStep(&fPathCountSetup, to_wg_size(dispatchInfo.path_count_setup));
445
446
447 ScratchBuffer seg_counts = bufMgr->getScratchStorage(seg_counts_size);
448 ScratchBuffer segments = bufMgr->getScratchStorage(segments_size);
449 ScratchBuffer ptcl = bufMgr->getScratchStorage(ptcl_size);
450
451
453 builder.appendStepIndirect(&fPathCount, indirectCountBuffer);
454
455
456 builder.appendStep(&fBackdrop, to_wg_size(dispatchInfo.backdrop));
457
458
460 builder.appendStep(&fCoarse, to_wg_size(dispatchInfo.coarse));
461
462
463 builder.appendStep(&fPathTilingSetup, to_wg_size(dispatchInfo.path_tiling_setup));
464
465
467 builder.appendStepIndirect(&fPathTiling, indirectCountBuffer);
468
469
471 const ComputeStep* fineVariant = nullptr;
472 switch (
params.fAaConfig) {
474 fineVariant = fFineArea.get();
475 break;
477 fineVariant = fFineMsaa16.get();
478 break;
480 fineVariant = fFineMsaa8.get();
481 break;
482 }
484 builder.appendStep(fineVariant, to_wg_size(dispatchInfo.fine));
485
487}
#define SKGPU_LOG_W(fmt,...)
std::pair< void *, BindBufferInfo > getUniformPointer(size_t requiredBytes)
DrawBufferManager * drawBufferManager()
const EmbeddedViewParams * params
constexpr int kVelloSlot_DrawBBoxes
constexpr int kVelloSlot_Lines
constexpr int kVelloSlot_LargePathtagScanFirstPassOutput
constexpr int kVelloSlot_BinHeader
constexpr int kVelloSlot_SegmentCounts
constexpr int kVelloSlot_ClipBicyclic
constexpr int kVelloSlot_Scene
constexpr int kVelloSlot_ConfigUniform
constexpr int kVelloSlot_ClipInput
constexpr int kVelloSlot_IndirectCount
constexpr int kVelloSlot_DrawReduceOutput
constexpr int kVelloSlot_LargePathtagReduceSecondPassOutput
constexpr int kVelloSlot_TagMonoid
constexpr int kVelloSlot_Segments
constexpr int kVelloSlot_InfoBinData
constexpr int kVelloSlot_ClipElement
constexpr int kVelloSlot_PathBBoxes
constexpr int kVelloSlot_Path
constexpr int kVelloSlot_OutputImage
constexpr int kVelloSlot_Tile
constexpr int kVelloSlot_PathtagReduceOutput
constexpr int kVelloSlot_PTCL
constexpr int kVelloSlot_ClipBBoxes
constexpr int kVelloSlot_DrawMonoid
constexpr int kVelloSlot_BumpAlloc
constexpr struct @268 tiles[]
#define TRACE_EVENT0(category_group, name)