Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
skgpu::graphite::DrawTask Class Referencefinal

#include <DrawTask.h>

Inheritance diagram for skgpu::graphite::DrawTask:
skgpu::graphite::Task skgpu::graphite::ScratchResourceManager::PendingUseListener SkRefCnt SkRefCntBase

Public Member Functions

 DrawTask (sk_sp< TextureProxy > target)
 
 ~DrawTask () override
 
Status prepareResources (ResourceProvider *, ScratchResourceManager *, const RuntimeEffectDictionary *) override
 
Status addCommands (Context *, CommandBuffer *, ReplayTargetData) override
 
virtual Status prepareResources (ResourceProvider *, ScratchResourceManager *, const RuntimeEffectDictionary *)=0
 
virtual Status addCommands (Context *, CommandBuffer *, ReplayTargetData)=0
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Friends

class DrawContext
 

Additional Inherited Members

- Public Types inherited from skgpu::graphite::Task
enum class  Status { kSuccess , kDiscard , kFail }
 

Detailed Description

DrawTask is a collection of subtasks that are executed in order to produce some intended image in the DrawTask's target. As such, at least one of its subtasks will either be a RenderPassTask, ComputeTask or CopyXToTextureTask that directly modify the target.

Definition at line 24 of file DrawTask.h.

Constructor & Destructor Documentation

◆ DrawTask()

skgpu::graphite::DrawTask::DrawTask ( sk_sp< TextureProxy target)
explicit

Definition at line 16 of file DrawTask.cpp.

16: fTarget(std::move(target)) {}
uint32_t * target

◆ ~DrawTask()

skgpu::graphite::DrawTask::~DrawTask ( )
overridedefault

Member Function Documentation

◆ addCommands()

Task::Status skgpu::graphite::DrawTask::addCommands ( Context ctx,
CommandBuffer commandBuffer,
ReplayTargetData  replayTarget 
)
overridevirtual

Implements skgpu::graphite::Task.

Definition at line 65 of file DrawTask.cpp.

67 {
68 SkASSERT(fTarget->isInstantiated());
69 return fChildTasks.addCommands(ctx, commandBuffer, replayTarget);
70}
#define SkASSERT(cond)
Definition: SkAssert.h:116
Task::Status addCommands(Context *, CommandBuffer *, Task::ReplayTargetData)
Definition: TaskList.cpp:50

◆ prepareResources()

Task::Status skgpu::graphite::DrawTask::prepareResources ( ResourceProvider resourceProvider,
ScratchResourceManager scratchManager,
const RuntimeEffectDictionary rteDict 
)
overridevirtual

Implements skgpu::graphite::Task.

Definition at line 20 of file DrawTask.cpp.

22 {
23 const int pendingReadCount = scratchManager->pendingReadCount(fTarget.get());
24 if (pendingReadCount) {
25 // This DrawTask defines the content of a scratch device that has incremented the pending
26 // read count before snap() was called. The target may have already been instantiated if
27 // we've processed this task's children before.
28 SkASSERT(!fTarget->isLazy());
29 // Even though we may discard the task, we always want to mark it as in-use to track the
30 // pending reads to know when to return the texture.;
31 scratchManager->markResourceInUse(this);
32
33 if (fPrepared) {
34 // If the task has already had prepareResources() called once, it should have had
35 // its target instantiated.
36 SkASSERT(fTarget->isInstantiated());
37 // Return kDiscard so that this reference to the task is removed and the original
38 // encounter in the graph will be the only time addCommands() is invoked.
39 return Status::kDiscard;
40 }
41 } else {
42 // A non-scratch DrawTask should only ever be in the task graph one time.
43 SkASSERT(!fPrepared);
44 }
45
46 fPrepared = true;
47 // NOTE: This prepareResources() pushes a new scope for scratch resource management, which is
48 // what we want since the child tasks are what will actually instantiate any scratch device and
49 // trigger returns of any grand-child resources. The above markResourceInUse() should happen
50 // above this so that pending returns are handled in caller's scope.
51 return fChildTasks.prepareResources(resourceProvider, scratchManager, rteDict);
52}
Task::Status prepareResources(ResourceProvider *, ScratchResourceManager *, const RuntimeEffectDictionary *)
Definition: TaskList.cpp:38

Friends And Related Function Documentation

◆ DrawContext

friend class DrawContext
friend

Definition at line 36 of file DrawTask.h.


The documentation for this class was generated from the following files: