265 {
268
269 if (scene.fEncoding->is_empty()) {
270 return nullptr;
271 }
272
274 return nullptr;
275 }
276
277
278
281 SKGPU_LOG_W(
"VelloRenderer: cannot render to an empty target");
282 return nullptr;
283 }
284
286 auto config = scene.fEncoding->prepare_render(
289 to_vello_color(
params.fBaseColor));
290 auto dispatchInfo = config->workgroup_counts();
291 auto bufferSizes = config->buffer_sizes();
292
294
295
296
297
299
300 size_t uboSize = config->config_uniform_buffer_size();
302 if (!uboPtr || !config->write_config_uniform_buffer(to_slice(uboPtr, uboSize))) {
303 return nullptr;
304 }
305
306 size_t sceneSize = config->scene_buffer_size();
307 auto [scenePtr, sceneBuf] = bufMgr->getStoragePointer(sceneSize);
308 if (!scenePtr || !config->write_scene_buffer(to_slice(scenePtr, sceneSize))) {
309 return nullptr;
310 }
311
312
313
314
315
316
317
318
319
320
321
322
323
324 const size_t lines_size = bufferSizes.lines;
325 const size_t bin_data_size = bufferSizes.bin_data;
326 const size_t tiles_size = bufferSizes.tiles;
327 const size_t segments_size = bufferSizes.segments;
328 const size_t seg_counts_size = bufferSizes.seg_counts;
329 const size_t ptcl_size = bufferSizes.ptcl;
330
331
332
335
336
337
338 ScratchBuffer bump = bufMgr->getScratchStorage(bufferSizes.bump_alloc);
340
341
342 ScratchBuffer tagmonoids = bufMgr->getScratchStorage(bufferSizes.path_monoids);
343 {
344
345 ScratchBuffer pathtagReduceOutput = bufMgr->getScratchStorage(bufferSizes.path_reduced);
346 builder.assignSharedBuffer(new_scratch_slice(pathtagReduceOutput),
349 builder.appendStep(&fPathtagReduce, to_wg_size(dispatchInfo.path_reduce));
350
351
352
353
354
355
356 if (dispatchInfo.use_large_path_scan) {
357 ScratchBuffer reduced2 = bufMgr->getScratchStorage(bufferSizes.path_reduced2);
358 ScratchBuffer reducedScan = bufMgr->getScratchStorage(bufferSizes.path_reduced_scan);
359
360 builder.assignSharedBuffer(new_scratch_slice(reduced2),
362 builder.assignSharedBuffer(new_scratch_slice(reducedScan),
364
365 builder.appendStep(&fPathtagReduce2, to_wg_size(dispatchInfo.path_reduce2));
366 builder.appendStep(&fPathtagScan1, to_wg_size(dispatchInfo.path_scan1));
367 builder.appendStep(&fPathtagScanLarge, to_wg_size(dispatchInfo.path_scan));
368 } else {
369 builder.appendStep(&fPathtagScanSmall, to_wg_size(dispatchInfo.path_scan));
370 }
371 }
372
373
374 ScratchBuffer pathBboxes = bufMgr->getScratchStorage(bufferSizes.path_bboxes);
376 builder.appendStep(&fBboxClear, to_wg_size(dispatchInfo.bbox_clear));
377
378
379 ScratchBuffer
lines = bufMgr->getScratchStorage(lines_size);
381 builder.appendStep(&fFlatten, to_wg_size(dispatchInfo.flatten));
382
383 tagmonoids.returnToPool();
384
385
386 ScratchBuffer drawReduced = bufMgr->getScratchStorage(bufferSizes.draw_reduced);
388 builder.appendStep(&fDrawReduce, to_wg_size(dispatchInfo.draw_reduce));
389
390
391 ScratchBuffer drawMonoids = bufMgr->getScratchStorage(bufferSizes.draw_monoids);
392 ScratchBuffer binData = bufMgr->getScratchStorage(bin_data_size);
393
394 ScratchBuffer clipInput = bufMgr->getScratchStorage(bufferSizes.clip_inps);
398 builder.appendStep(&fDrawLeaf, to_wg_size(dispatchInfo.draw_leaf));
399
400 drawReduced.returnToPool();
401
402
403
404
405 ScratchBuffer clipBboxes = bufMgr->getScratchStorage(bufferSizes.clip_bboxes);
407 WorkgroupSize clipReduceWgCount = to_wg_size(dispatchInfo.clip_reduce);
408 WorkgroupSize clipLeafWgCount = to_wg_size(dispatchInfo.clip_leaf);
409 bool doClipReduce = clipReduceWgCount.scalarSize() > 0u;
410 bool doClipLeaf = clipLeafWgCount.scalarSize() > 0u;
411 if (doClipReduce || doClipLeaf) {
412 ScratchBuffer clipBic = bufMgr->getScratchStorage(bufferSizes.clip_bics);
413 ScratchBuffer clipEls = bufMgr->getScratchStorage(bufferSizes.clip_els);
416 if (doClipReduce) {
417 builder.appendStep(&fClipReduce, clipReduceWgCount);
418 }
419 if (doClipLeaf) {
420 builder.appendStep(&fClipLeaf, clipLeafWgCount);
421 }
422 }
423
424 clipInput.returnToPool();
425
426
427 ScratchBuffer drawBboxes = bufMgr->getScratchStorage(bufferSizes.draw_bboxes);
428 ScratchBuffer binHeaders = bufMgr->getScratchStorage(bufferSizes.bin_headers);
431 builder.appendStep(&fBinning, to_wg_size(dispatchInfo.binning));
432
433 pathBboxes.returnToPool();
434 clipBboxes.returnToPool();
435
436
437 ScratchBuffer paths = bufMgr->getScratchStorage(bufferSizes.paths);
438 ScratchBuffer
tiles = bufMgr->getScratchStorage(tiles_size);
441 builder.appendStep(&fTileAlloc, to_wg_size(dispatchInfo.tile_alloc));
442
443 drawBboxes.returnToPool();
444
445
446 auto indirectCountBuffer = new_indirect_slice(bufMgr, bufferSizes.indirect_count);
448 builder.appendStep(&fPathCountSetup, to_wg_size(dispatchInfo.path_count_setup));
449
450
451 ScratchBuffer seg_counts = bufMgr->getScratchStorage(seg_counts_size);
452 ScratchBuffer segments = bufMgr->getScratchStorage(segments_size);
453 ScratchBuffer ptcl = bufMgr->getScratchStorage(ptcl_size);
454
455
457 builder.appendStepIndirect(&fPathCount, indirectCountBuffer);
458
459
460 builder.appendStep(&fBackdrop, to_wg_size(dispatchInfo.backdrop));
461
462
464 builder.appendStep(&fCoarse, to_wg_size(dispatchInfo.coarse));
465
466
467 builder.appendStep(&fPathTilingSetup, to_wg_size(dispatchInfo.path_tiling_setup));
468
469
471 builder.appendStepIndirect(&fPathTiling, indirectCountBuffer);
472
473
476 switch (
params.fAaConfig) {
478 fineVariant = fFineArea.get();
479 break;
481 fineVariant = fFineMsaa16.get();
482 break;
484 fineVariant = fFineMsaa8.get();
485 break;
486 }
488 builder.appendStep(fineVariant, to_wg_size(dispatchInfo.fine));
489
491}
#define SKGPU_LOG_W(fmt,...)
static bool ComputeStep(const SkPoint &a, const SkPoint &b, SkScalar radius, SkPoint *step)
std::pair< void *, BindBufferInfo > getUniformPointer(size_t requiredBytes)
DrawBufferManager * drawBufferManager()
const EmbeddedViewParams * params
static float min(float r, float g, float b)
DlVertices::Builder Builder
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 @263 tiles[]
#define TRACE_EVENT0(category_group, name)