Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
GrOpsRenderPass Class Referenceabstract

#include <GrOpsRenderPass.h>

Inheritance diagram for GrOpsRenderPass:
GrD3DOpsRenderPass GrGLOpsRenderPass GrMockOpsRenderPass GrMtlOpsRenderPass GrVkOpsRenderPass

Classes

struct  LoadAndStoreInfo
 
struct  StencilLoadAndStoreInfo
 

Public Member Functions

virtual ~GrOpsRenderPass ()
 
void begin ()
 
void end ()
 
void bindPipeline (const GrProgramInfo &, const SkRect &drawBounds)
 
void setScissorRect (const SkIRect &)
 
void bindTextures (const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &)
 
void bindBuffers (sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart=GrPrimitiveRestart::kNo)
 
void draw (int vertexCount, int baseVertex)
 
void drawIndexed (int indexCount, int baseIndex, uint16_t minIndexValue, uint16_t maxIndexValue, int baseVertex)
 
void drawInstanced (int instanceCount, int baseInstance, int vertexCount, int baseVertex)
 
void drawIndexedInstanced (int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex)
 
void drawIndirect (const GrBuffer *drawIndirectBuffer, size_t bufferOffset, int drawCount)
 
void drawIndexedIndirect (const GrBuffer *drawIndirectBuffer, size_t bufferOffset, int drawCount)
 
void drawIndexPattern (int patternIndexCount, int patternRepeatCount, int maxPatternRepetitionsInIndexBuffer, int patternVertexCount, int baseVertex)
 
virtual void inlineUpload (GrOpFlushState *, GrDeferredTextureUploadFn &)=0
 
void clear (const GrScissorState &scissor, std::array< float, 4 > color)
 
void clearStencilClip (const GrScissorState &scissor, bool insideStencilMask)
 
void executeDrawable (std::unique_ptr< SkDrawable::GpuDrawHandler >)
 

Protected Member Functions

 GrOpsRenderPass ()
 
 GrOpsRenderPass (GrRenderTarget *rt, GrSurfaceOrigin origin)
 
void set (GrRenderTarget *rt, GrSurfaceOrigin origin)
 

Protected Attributes

GrSurfaceOrigin fOrigin
 
GrRenderTargetfRenderTarget
 
sk_sp< const GrBufferfActiveIndexBuffer
 
sk_sp< const GrBufferfActiveVertexBuffer
 
sk_sp< const GrBufferfActiveInstanceBuffer
 

Private Member Functions

virtual GrGpugpu ()=0
 
virtual void onBegin ()
 
virtual void onEnd ()
 
virtual bool onBindPipeline (const GrProgramInfo &, const SkRect &drawBounds)=0
 
virtual void onSetScissorRect (const SkIRect &)=0
 
virtual bool onBindTextures (const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &)=0
 
virtual void onBindBuffers (sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart)=0
 
virtual void onDraw (int vertexCount, int baseVertex)=0
 
virtual void onDrawIndexed (int indexCount, int baseIndex, uint16_t minIndexValue, uint16_t maxIndexValue, int baseVertex)=0
 
virtual void onDrawInstanced (int instanceCount, int baseInstance, int vertexCount, int baseVertex)=0
 
virtual void onDrawIndexedInstanced (int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex)=0
 
virtual void onDrawIndirect (const GrBuffer *, size_t offset, int drawCount)
 
virtual void onDrawIndexedIndirect (const GrBuffer *, size_t offset, int drawCount)
 
virtual void onClear (const GrScissorState &, std::array< float, 4 > color)=0
 
virtual void onClearStencilClip (const GrScissorState &, bool insideStencilMask)=0
 
virtual void onExecuteDrawable (std::unique_ptr< SkDrawable::GpuDrawHandler >)
 

Detailed Description

The GrOpsRenderPass is a series of commands (draws, clears, and discards), which all target the same render target. It is possible that these commands execute immediately (GL), or get buffered up for later execution (Vulkan). GrOps execute into a GrOpsRenderPass.

Definition at line 42 of file GrOpsRenderPass.h.

Constructor & Destructor Documentation

◆ ~GrOpsRenderPass()

virtual GrOpsRenderPass::~GrOpsRenderPass ( )
inlinevirtual

Definition at line 44 of file GrOpsRenderPass.h.

44{}

◆ GrOpsRenderPass() [1/2]

GrOpsRenderPass::GrOpsRenderPass ( )
inlineprotected

Definition at line 153 of file GrOpsRenderPass.h.

@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
GrSurfaceOrigin fOrigin
GrRenderTarget * fRenderTarget

◆ GrOpsRenderPass() [2/2]

GrOpsRenderPass::GrOpsRenderPass ( GrRenderTarget rt,
GrSurfaceOrigin  origin 
)
inlineprotected

Definition at line 155 of file GrOpsRenderPass.h.

156 : fOrigin(origin)
157 , fRenderTarget(rt) {
158 }

Member Function Documentation

◆ begin()

void GrOpsRenderPass::begin ( )

Definition at line 31 of file GrOpsRenderPass.cpp.

31 {
32 fDrawPipelineStatus = DrawPipelineStatus::kNotConfigured;
33#ifdef SK_DEBUG
34 fScissorStatus = DynamicStateStatus::kDisabled;
35 fTextureBindingStatus = DynamicStateStatus::kDisabled;
36 fHasIndexBuffer = false;
37 fInstanceBufferStatus = DynamicStateStatus::kDisabled;
38 fVertexBufferStatus = DynamicStateStatus::kDisabled;
39#endif
40 this->onBegin();
41}
virtual void onBegin()

◆ bindBuffers()

void GrOpsRenderPass::bindBuffers ( sk_sp< const GrBuffer indexBuffer,
sk_sp< const GrBuffer instanceBuffer,
sk_sp< const GrBuffer vertexBuffer,
GrPrimitiveRestart  primRestart = GrPrimitiveRestart::kNo 
)

Definition at line 180 of file GrOpsRenderPass.cpp.

183 {
184 if (DrawPipelineStatus::kOk != fDrawPipelineStatus) {
185 SkASSERT(DrawPipelineStatus::kNotConfigured != fDrawPipelineStatus);
186 return;
187 }
188
189#ifdef SK_DEBUG
190 if (indexBuffer) {
191 fHasIndexBuffer = true;
192 }
193
194 SkASSERT((DynamicStateStatus::kDisabled == fInstanceBufferStatus) != SkToBool(instanceBuffer));
195 if (instanceBuffer) {
196 fInstanceBufferStatus = DynamicStateStatus::kConfigured;
197 }
198
199 SkASSERT((DynamicStateStatus::kDisabled == fVertexBufferStatus) != SkToBool(vertexBuffer));
200 if (vertexBuffer) {
201 fVertexBufferStatus = DynamicStateStatus::kConfigured;
202 }
203
204 if (GrPrimitiveRestart::kYes == primRestart) {
205 SkASSERT(this->gpu()->caps()->usePrimitiveRestart());
206 }
207#endif
208
209 this->onBindBuffers(std::move(indexBuffer), std::move(instanceBuffer), std::move(vertexBuffer),
210 primRestart);
211}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
virtual GrGpu * gpu()=0
virtual void onBindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart)=0

◆ bindPipeline()

void GrOpsRenderPass::bindPipeline ( const GrProgramInfo programInfo,
const SkRect drawBounds 
)

Definition at line 71 of file GrOpsRenderPass.cpp.

71 {
72#ifdef SK_DEBUG
73 // Both the 'programInfo' and this renderPass have an origin. Since they come from the same
74 // place (i.e., the target renderTargetProxy) they had best agree.
75 SkASSERT(programInfo.origin() == fOrigin);
76 if (programInfo.geomProc().hasInstanceAttributes()) {
77 SkASSERT(this->gpu()->caps()->drawInstancedSupport());
78 }
79 if (programInfo.pipeline().usesConservativeRaster()) {
80 SkASSERT(this->gpu()->caps()->conservativeRasterSupport());
81 }
82 if (programInfo.pipeline().isWireframe()) {
83 SkASSERT(this->gpu()->caps()->wireframeSupport());
84 }
85 if (this->gpu()->caps()->twoSidedStencilRefsAndMasksMustMatch() &&
86 programInfo.isStencilEnabled()) {
87 const GrUserStencilSettings* stencil = programInfo.userStencilSettings();
88 if (stencil->isTwoSided(programInfo.pipeline().hasStencilClip())) {
89 SkASSERT(stencil->fCCWFace.fRef == stencil->fCWFace.fRef);
90 SkASSERT(stencil->fCCWFace.fTestMask == stencil->fCWFace.fTestMask);
91 SkASSERT(stencil->fCCWFace.fWriteMask == stencil->fCWFace.fWriteMask);
92 }
93 }
94 programInfo.checkAllInstantiated();
95 programInfo.checkMSAAAndMIPSAreResolved();
96#endif
97
98 this->resetActiveBuffers();
99
100 if (programInfo.geomProc().numVertexAttributes() > this->gpu()->caps()->maxVertexAttributes()) {
101 fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
102 return;
103 }
104
105 if (!this->onBindPipeline(programInfo, drawBounds)) {
106 fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
107 return;
108 }
109
110#ifdef SK_DEBUG
111 fScissorStatus = (programInfo.pipeline().isScissorTestEnabled()) ?
112 DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
113 bool hasTextures = (programInfo.geomProc().numTextureSamplers() > 0);
114 if (!hasTextures) {
115 programInfo.pipeline().visitProxies(
116 [&hasTextures](GrSurfaceProxy*, skgpu::Mipmapped) { hasTextures = true; });
117 }
118 fTextureBindingStatus = (hasTextures) ?
119 DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
120 fHasIndexBuffer = false;
121 fInstanceBufferStatus = (programInfo.geomProc().hasInstanceAttributes()) ?
122 DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
123 fVertexBufferStatus = (programInfo.geomProc().hasVertexAttributes()) ?
124 DynamicStateStatus::kUninitialized : DynamicStateStatus::kDisabled;
125#endif
126
127 fDrawPipelineStatus = DrawPipelineStatus::kOk;
128 fXferBarrierType = programInfo.pipeline().xferBarrierType(*this->gpu()->caps());
129}
bool hasInstanceAttributes() const
bool hasVertexAttributes() const
const GrCaps * caps() const
Definition: GrGpu.h:73
virtual bool onBindPipeline(const GrProgramInfo &, const SkRect &drawBounds)=0
bool hasStencilClip() const
Definition: GrPipeline.h:174
void visitProxies(const GrVisitProxyFunc &) const
Definition: GrPipeline.cpp:105
bool isScissorTestEnabled() const
Definition: GrPipeline.h:163
bool isWireframe() const
Definition: GrPipeline.h:170
bool usesConservativeRaster() const
Definition: GrPipeline.h:169
GrXferBarrierType xferBarrierType(const GrCaps &) const
Definition: GrPipeline.cpp:59
GrSurfaceOrigin origin() const
Definition: GrProgramInfo.h:38
const GrPipeline & pipeline() const
Definition: GrProgramInfo.h:39
const GrGeometryProcessor & geomProc() const
Definition: GrProgramInfo.h:40
const GrUserStencilSettings * userStencilSettings() const
Definition: GrProgramInfo.h:35
bool isStencilEnabled() const
Definition: GrProgramInfo.h:31
Mipmapped
Definition: GpuTypes.h:53
bool isTwoSided(bool hasStencilClip) const

◆ bindTextures()

void GrOpsRenderPass::bindTextures ( const GrGeometryProcessor geomProc,
const GrSurfaceProxy *const  geomProcTextures[],
const GrPipeline pipeline 
)

Definition at line 141 of file GrOpsRenderPass.cpp.

143 {
144#ifdef SK_DEBUG
145 SkASSERT((geomProc.numTextureSamplers() > 0) == SkToBool(geomProcTextures));
146 for (int i = 0; i < geomProc.numTextureSamplers(); ++i) {
147 const auto& sampler = geomProc.textureSampler(i);
148 const GrSurfaceProxy* proxy = geomProcTextures[i];
149 SkASSERT(proxy);
150 SkASSERT(proxy->backendFormat() == sampler.backendFormat());
151 SkASSERT(proxy->backendFormat().textureType() == sampler.backendFormat().textureType());
152
153 const GrTexture* tex = proxy->peekTexture();
154 SkASSERT(tex);
155 if (sampler.samplerState().mipmapped() == skgpu::Mipmapped::kYes &&
156 (tex->width() != 1 || tex->height() != 1)) {
157 // There are some cases where we might be given a non-mipmapped texture with a mipmap
158 // filter. See skbug.com/7094.
160 }
161 }
162#endif
163
164 if (DrawPipelineStatus::kOk != fDrawPipelineStatus) {
165 SkASSERT(DrawPipelineStatus::kNotConfigured != fDrawPipelineStatus);
166 return;
167 }
168
169 // Don't assert on fTextureBindingStatus. onBindTextures() just turns into a no-op when there
170 // aren't any textures, and it's hard to tell from the GrPipeline whether there are any. For
171 // many clients it is easier to just always call this method.
172 if (!this->onBindTextures(geomProc, geomProcTextures, pipeline)) {
173 fDrawPipelineStatus = DrawPipelineStatus::kFailedToBind;
174 return;
175 }
176
177 SkDEBUGCODE(fTextureBindingStatus = DynamicStateStatus::kConfigured);
178}
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
GrTextureType textureType() const
const TextureSampler & textureSampler(int index) const
virtual bool onBindTextures(const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &)=0
const GrBackendFormat & backendFormat() const
GrTexture * peekTexture() const
int height() const
Definition: GrSurface.h:37
int width() const
Definition: GrSurface.h:32
skgpu::Mipmapped mipmapped() const
Definition: GrTexture.h:62
bool mipmapsAreDirty() const
Definition: GrTexture.h:65

◆ clear()

void GrOpsRenderPass::clear ( const GrScissorState scissor,
std::array< float, 4 >  color 
)

Clear the owned render target. Clears the full target if 'scissor' is disabled, otherwise it is restricted to 'scissor'. Must check caps.performPartialClearsAsDraws() before using an enabled scissor test; must check caps.performColorClearsAsDraws() before using this at all.

Definition at line 48 of file GrOpsRenderPass.cpp.

48 {
50 // A clear at this level will always be a true clear, so make sure clears were not supposed to
51 // be redirected to draws instead
52 SkASSERT(!this->gpu()->caps()->performColorClearsAsDraws());
53 SkASSERT(!scissor.enabled() || !this->gpu()->caps()->performPartialClearsAsDraws());
54 fDrawPipelineStatus = DrawPipelineStatus::kNotConfigured;
55 this->onClear(scissor, color);
56}
virtual void onClear(const GrScissorState &, std::array< float, 4 > color)=0
bool enabled() const
DlColor color

◆ clearStencilClip()

void GrOpsRenderPass::clearStencilClip ( const GrScissorState scissor,
bool  insideStencilMask 
)

Same as clear() but modifies the stencil; check caps.performStencilClearsAsDraws() and caps.performPartialClearsAsDraws().

Definition at line 58 of file GrOpsRenderPass.cpp.

58 {
59 // As above, make sure the stencil clear wasn't supposed to be a draw rect with stencil settings
60 SkASSERT(!this->gpu()->caps()->performStencilClearsAsDraws());
61 SkASSERT(!scissor.enabled() || !this->gpu()->caps()->performPartialClearsAsDraws());
62 fDrawPipelineStatus = DrawPipelineStatus::kNotConfigured;
63 this->onClearStencilClip(scissor, insideStencilMask);
64}
virtual void onClearStencilClip(const GrScissorState &, bool insideStencilMask)=0

◆ draw()

void GrOpsRenderPass::draw ( int  vertexCount,
int  baseVertex 
)

Definition at line 228 of file GrOpsRenderPass.cpp.

228 {
229 if (!this->prepareToDraw()) {
230 return;
231 }
232 SkASSERT(!fHasIndexBuffer);
233 SkASSERT(DynamicStateStatus::kConfigured != fInstanceBufferStatus);
234 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
235 this->onDraw(vertexCount, baseVertex);
236}
virtual void onDraw(int vertexCount, int baseVertex)=0

◆ drawIndexed()

void GrOpsRenderPass::drawIndexed ( int  indexCount,
int  baseIndex,
uint16_t  minIndexValue,
uint16_t  maxIndexValue,
int  baseVertex 
)

Definition at line 238 of file GrOpsRenderPass.cpp.

239 {
240 if (!this->prepareToDraw()) {
241 return;
242 }
243 SkASSERT(fHasIndexBuffer);
244 SkASSERT(DynamicStateStatus::kConfigured != fInstanceBufferStatus);
245 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
246 this->onDrawIndexed(indexCount, baseIndex, minIndexValue, maxIndexValue, baseVertex);
247}
virtual void onDrawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue, uint16_t maxIndexValue, int baseVertex)=0

◆ drawIndexedIndirect()

void GrOpsRenderPass::drawIndexedIndirect ( const GrBuffer drawIndirectBuffer,
size_t  bufferOffset,
int  drawCount 
)

Definition at line 299 of file GrOpsRenderPass.cpp.

300 {
301 SkASSERT(this->gpu()->caps()->drawInstancedSupport());
302 SkASSERT(drawIndirectBuffer->isCpuBuffer() ||
303 !static_cast<const GrGpuBuffer*>(drawIndirectBuffer)->isMapped());
304 if (!this->prepareToDraw()) {
305 return;
306 }
307 SkASSERT(fHasIndexBuffer);
308 SkASSERT(DynamicStateStatus::kUninitialized != fInstanceBufferStatus);
309 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
310 if (!this->gpu()->caps()->nativeDrawIndirectSupport() ||
311 this->gpu()->caps()->nativeDrawIndexedIndirectIsBroken()) {
312 // Polyfill indexedIndirect draws with looping indexedInstanced calls.
313 SkASSERT(drawIndirectBuffer->isCpuBuffer());
314 auto* cpuIndirectBuffer = static_cast<const GrCpuBuffer*>(drawIndirectBuffer);
315 auto* cmds = reinterpret_cast<const GrDrawIndexedIndirectCommand*>(
316 cpuIndirectBuffer->data() + bufferOffset);
317 for (int i = 0; i < drawCount; ++i) {
318 auto [indexCount, instanceCount, baseIndex, baseVertex, baseInstance] = cmds[i];
319 this->onDrawIndexedInstanced(indexCount, baseIndex, instanceCount, baseInstance,
320 baseVertex);
321 }
322 return;
323 }
324 this->onDrawIndexedIndirect(drawIndirectBuffer, bufferOffset, drawCount);
325}
virtual bool isCpuBuffer() const =0
bool isMapped() const
Definition: GrGpuBuffer.cpp:47
virtual void onDrawIndexedIndirect(const GrBuffer *, size_t offset, int drawCount)
virtual void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex)=0

◆ drawIndexedInstanced()

void GrOpsRenderPass::drawIndexedInstanced ( int  indexCount,
int  baseIndex,
int  instanceCount,
int  baseInstance,
int  baseVertex 
)

Definition at line 261 of file GrOpsRenderPass.cpp.

262 {
263 SkASSERT(this->gpu()->caps()->drawInstancedSupport());
264 if (!this->prepareToDraw()) {
265 return;
266 }
267 SkASSERT(fHasIndexBuffer);
268 SkASSERT(DynamicStateStatus::kUninitialized != fInstanceBufferStatus);
269 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
270 this->onDrawIndexedInstanced(indexCount, baseIndex, instanceCount, baseInstance, baseVertex);
271}

◆ drawIndexPattern()

void GrOpsRenderPass::drawIndexPattern ( int  patternIndexCount,
int  patternRepeatCount,
int  maxPatternRepetitionsInIndexBuffer,
int  patternVertexCount,
int  baseVertex 
)

Definition at line 327 of file GrOpsRenderPass.cpp.

329 {
330 int baseRepetition = 0;
331 while (baseRepetition < patternRepeatCount) {
332 int repeatCount = std::min(patternRepeatCount - baseRepetition,
333 maxPatternRepetitionsInIndexBuffer);
334 int drawIndexCount = repeatCount * patternIndexCount;
335 // A patterned index buffer must contain indices in the range [0..vertexCount].
336 int minIndexValue = 0;
337 int maxIndexValue = patternVertexCount * repeatCount - 1;
338 this->drawIndexed(drawIndexCount, 0, minIndexValue, maxIndexValue,
339 patternVertexCount * baseRepetition + baseVertex);
340 baseRepetition += repeatCount;
341 }
342}
void drawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue, uint16_t maxIndexValue, int baseVertex)
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ drawIndirect()

void GrOpsRenderPass::drawIndirect ( const GrBuffer drawIndirectBuffer,
size_t  bufferOffset,
int  drawCount 
)

Definition at line 273 of file GrOpsRenderPass.cpp.

274 {
275 SkASSERT(this->gpu()->caps()->drawInstancedSupport());
276 SkASSERT(drawIndirectBuffer->isCpuBuffer() ||
277 !static_cast<const GrGpuBuffer*>(drawIndirectBuffer)->isMapped());
278 if (!this->prepareToDraw()) {
279 return;
280 }
281 SkASSERT(!fHasIndexBuffer);
282 SkASSERT(DynamicStateStatus::kUninitialized != fInstanceBufferStatus);
283 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
284 if (!this->gpu()->caps()->nativeDrawIndirectSupport()) {
285 // Polyfill indirect draws with looping instanced calls.
286 SkASSERT(drawIndirectBuffer->isCpuBuffer());
287 auto* cpuIndirectBuffer = static_cast<const GrCpuBuffer*>(drawIndirectBuffer);
288 auto* cmds = reinterpret_cast<const GrDrawIndirectCommand*>(
289 cpuIndirectBuffer->data() + bufferOffset);
290 for (int i = 0; i < drawCount; ++i) {
291 auto [vertexCount, instanceCount, baseVertex, baseInstance] = cmds[i];
292 this->onDrawInstanced(instanceCount, baseInstance, vertexCount, baseVertex);
293 }
294 return;
295 }
296 this->onDrawIndirect(drawIndirectBuffer, bufferOffset, drawCount);
297}
virtual void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex)=0
virtual void onDrawIndirect(const GrBuffer *, size_t offset, int drawCount)

◆ drawInstanced()

void GrOpsRenderPass::drawInstanced ( int  instanceCount,
int  baseInstance,
int  vertexCount,
int  baseVertex 
)

Definition at line 249 of file GrOpsRenderPass.cpp.

250 {
251 SkASSERT(this->gpu()->caps()->drawInstancedSupport());
252 if (!this->prepareToDraw()) {
253 return;
254 }
255 SkASSERT(!fHasIndexBuffer);
256 SkASSERT(DynamicStateStatus::kUninitialized != fInstanceBufferStatus);
257 SkASSERT(DynamicStateStatus::kUninitialized != fVertexBufferStatus);
258 this->onDrawInstanced(instanceCount, baseInstance, vertexCount, baseVertex);
259}

◆ end()

void GrOpsRenderPass::end ( )

Definition at line 43 of file GrOpsRenderPass.cpp.

43 {
44 this->onEnd();
45 this->resetActiveBuffers();
46}
virtual void onEnd()

◆ executeDrawable()

void GrOpsRenderPass::executeDrawable ( std::unique_ptr< SkDrawable::GpuDrawHandler drawable)

Executes the SkDrawable object for the underlying backend.

Definition at line 66 of file GrOpsRenderPass.cpp.

66 {
67 fDrawPipelineStatus = DrawPipelineStatus::kNotConfigured;
68 this->onExecuteDrawable(std::move(drawable));
69}
virtual void onExecuteDrawable(std::unique_ptr< SkDrawable::GpuDrawHandler >)

◆ gpu()

virtual GrGpu * GrOpsRenderPass::gpu ( )
privatepure virtual

Implemented in GrMockOpsRenderPass.

◆ inlineUpload()

virtual void GrOpsRenderPass::inlineUpload ( GrOpFlushState ,
GrDeferredTextureUploadFn  
)
pure virtual

◆ onBegin()

virtual void GrOpsRenderPass::onBegin ( )
inlineprivatevirtual

Definition at line 188 of file GrOpsRenderPass.h.

188{}

◆ onBindBuffers()

virtual void GrOpsRenderPass::onBindBuffers ( sk_sp< const GrBuffer indexBuffer,
sk_sp< const GrBuffer instanceBuffer,
sk_sp< const GrBuffer vertexBuffer,
GrPrimitiveRestart   
)
privatepure virtual

◆ onBindPipeline()

virtual bool GrOpsRenderPass::onBindPipeline ( const GrProgramInfo ,
const SkRect drawBounds 
)
privatepure virtual

◆ onBindTextures()

virtual bool GrOpsRenderPass::onBindTextures ( const GrGeometryProcessor ,
const GrSurfaceProxy *const  geomProcTextures[],
const GrPipeline  
)
privatepure virtual

◆ onClear()

virtual void GrOpsRenderPass::onClear ( const GrScissorState ,
std::array< float, 4 >  color 
)
privatepure virtual

◆ onClearStencilClip()

virtual void GrOpsRenderPass::onClearStencilClip ( const GrScissorState ,
bool  insideStencilMask 
)
privatepure virtual

◆ onDraw()

virtual void GrOpsRenderPass::onDraw ( int  vertexCount,
int  baseVertex 
)
privatepure virtual

◆ onDrawIndexed()

virtual void GrOpsRenderPass::onDrawIndexed ( int  indexCount,
int  baseIndex,
uint16_t  minIndexValue,
uint16_t  maxIndexValue,
int  baseVertex 
)
privatepure virtual

◆ onDrawIndexedIndirect()

virtual void GrOpsRenderPass::onDrawIndexedIndirect ( const GrBuffer ,
size_t  offset,
int  drawCount 
)
inlineprivatevirtual

Definition at line 207 of file GrOpsRenderPass.h.

207 {
208 SK_ABORT("Not implemented."); // Only called if caps.nativeDrawIndirectSupport().
209 }
#define SK_ABORT(message,...)
Definition: SkAssert.h:70

◆ onDrawIndexedInstanced()

virtual void GrOpsRenderPass::onDrawIndexedInstanced ( int  indexCount,
int  baseIndex,
int  instanceCount,
int  baseInstance,
int  baseVertex 
)
privatepure virtual

◆ onDrawIndirect()

virtual void GrOpsRenderPass::onDrawIndirect ( const GrBuffer ,
size_t  offset,
int  drawCount 
)
inlineprivatevirtual

Definition at line 204 of file GrOpsRenderPass.h.

204 {
205 SK_ABORT("Not implemented."); // Only called if caps.nativeDrawIndirectSupport().
206 }

◆ onDrawInstanced()

virtual void GrOpsRenderPass::onDrawInstanced ( int  instanceCount,
int  baseInstance,
int  vertexCount,
int  baseVertex 
)
privatepure virtual

◆ onEnd()

virtual void GrOpsRenderPass::onEnd ( )
inlineprivatevirtual

Definition at line 189 of file GrOpsRenderPass.h.

189{}

◆ onExecuteDrawable()

virtual void GrOpsRenderPass::onExecuteDrawable ( std::unique_ptr< SkDrawable::GpuDrawHandler )
inlineprivatevirtual

Reimplemented in GrD3DOpsRenderPass, and GrVkOpsRenderPass.

Definition at line 212 of file GrOpsRenderPass.h.

212{}

◆ onSetScissorRect()

virtual void GrOpsRenderPass::onSetScissorRect ( const SkIRect )
privatepure virtual

◆ set()

void GrOpsRenderPass::set ( GrRenderTarget rt,
GrSurfaceOrigin  origin 
)
inlineprotected

Definition at line 160 of file GrOpsRenderPass.h.

160 {
162
163 fRenderTarget = rt;
164 fOrigin = origin;
165 }

◆ setScissorRect()

void GrOpsRenderPass::setScissorRect ( const SkIRect scissor)

Definition at line 131 of file GrOpsRenderPass.cpp.

131 {
132 if (DrawPipelineStatus::kOk != fDrawPipelineStatus) {
133 SkASSERT(DrawPipelineStatus::kNotConfigured != fDrawPipelineStatus);
134 return;
135 }
136 SkASSERT(DynamicStateStatus::kDisabled != fScissorStatus);
137 this->onSetScissorRect(scissor);
138 SkDEBUGCODE(fScissorStatus = DynamicStateStatus::kConfigured);
139}
virtual void onSetScissorRect(const SkIRect &)=0

Member Data Documentation

◆ fActiveIndexBuffer

sk_sp<const GrBuffer> GrOpsRenderPass::fActiveIndexBuffer
protected

Definition at line 172 of file GrOpsRenderPass.h.

◆ fActiveInstanceBuffer

sk_sp<const GrBuffer> GrOpsRenderPass::fActiveInstanceBuffer
protected

Definition at line 174 of file GrOpsRenderPass.h.

◆ fActiveVertexBuffer

sk_sp<const GrBuffer> GrOpsRenderPass::fActiveVertexBuffer
protected

Definition at line 173 of file GrOpsRenderPass.h.

◆ fOrigin

GrSurfaceOrigin GrOpsRenderPass::fOrigin
protected

Definition at line 167 of file GrOpsRenderPass.h.

◆ fRenderTarget

GrRenderTarget* GrOpsRenderPass::fRenderTarget
protected

Definition at line 168 of file GrOpsRenderPass.h.


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