Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrVkOpsRenderPass.h
Go to the documentation of this file.
1/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#ifndef GrVkOpsRenderPass_DEFINED
9#define GrVkOpsRenderPass_DEFINED
10
12
13#include "include/gpu/GrTypes.h"
18
19class GrVkFramebuffer;
20class GrVkGpu;
21class GrVkImage;
24
26public:
28
29 ~GrVkOpsRenderPass() override;
30
32
33 void onExecuteDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler>) override;
34
35 bool set(GrRenderTarget*,
38 const SkIRect& bounds,
41 const GrOpsRenderPass::LoadAndStoreInfo& resolveInfo,
43 GrVkRenderPass::LoadFromResolve loadFromResolve,
45 void reset();
46
47 void submit();
48
49#ifdef SK_DEBUG
50 bool isActive() const { return fIsActive; }
51#endif
52
53private:
54 bool init(const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
55 const GrOpsRenderPass::LoadAndStoreInfo& resolveInfo,
57
58 // Called instead of init when we are drawing to a render target that already wraps a secondary
59 // command buffer.
60 bool initWrapped();
61
62 bool wrapsSecondaryCommandBuffer() const;
63
64 GrGpu* gpu() override;
65
66 GrVkCommandBuffer* currentCommandBuffer();
67
68 void onEnd() override;
69
70 bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
71 void onSetScissorRect(const SkIRect&) override;
73 const GrSurfaceProxy* const geomProcTextures[],
74 const GrPipeline&) override;
75 void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
76 sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
77 void onDraw(int vertexCount, int baseVertex) override {
78 this->onDrawInstanced(1, 0, vertexCount, baseVertex);
79 }
80 void onDrawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue,
81 uint16_t maxIndexValue, int baseVertex) override {
82 this->onDrawIndexedInstanced(indexCount, baseIndex, 1, 0, baseVertex);
83 }
84 void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount,
85 int baseVertex) override;
86 void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance,
87 int baseVertex) override;
88 void onDrawIndirect(const GrBuffer* drawIndirectBuffer, size_t offset, int drawCount) override;
89 void onDrawIndexedIndirect(const GrBuffer* drawIndirectBuffer, size_t offset,
90 int drawCount) override;
91
92 void onClear(const GrScissorState& scissor, std::array<float, 4> color) override;
93
94 void onClearStencilClip(const GrScissorState& scissor, bool insideStencilMask) override;
95
96 using LoadFromResolve = GrVkRenderPass::LoadFromResolve;
97
98 bool beginRenderPass(const VkClearValue& clearColor, LoadFromResolve loadFromResolve);
99
100 void addAdditionalRenderPass(bool mustUseSecondaryCommandBuffer);
101
102 void setAttachmentLayouts(LoadFromResolve loadFromResolve);
103
104 void loadResolveIntoMSAA(const SkIRect& nativeBounds);
105
106 using SelfDependencyFlags = GrVkRenderPass::SelfDependencyFlags;
107
108 sk_sp<GrVkFramebuffer> fFramebuffer;
109 std::unique_ptr<GrVkSecondaryCommandBuffer> fCurrentSecondaryCommandBuffer;
110 const GrVkRenderPass* fCurrentRenderPass;
111 SkIRect fCurrentPipelineBounds;
112 GrVkPipelineState* fCurrentPipelineState = nullptr;
113 bool fCurrentCBIsEmpty = true;
114 SkIRect fBounds;
115 SelfDependencyFlags fSelfDependencyFlags = SelfDependencyFlags::kNone;
116 LoadFromResolve fLoadFromResolve = LoadFromResolve::kNo;
117 bool fOverridePipelinesForResolveLoad = false;
118
119 GrVkGpu* fGpu;
120
121#ifdef SK_DEBUG
122 // When we are actively recording into the GrVkOpsRenderPass we set this flag to true. This
123 // then allows us to assert that we never submit a primary command buffer to the queue while in
124 // a recording state. This is needed since when we submit to the queue we change command pools
125 // and may trigger the old one to be reset, but a recording GrVkOpsRenderPass may still have
126 // a outstanding secondary command buffer allocated from that pool that we'll try to access
127 // after the pool as been reset.
128 bool fIsActive = false;
129#endif
130
131 using INHERITED = GrOpsRenderPass;
132};
133
134#endif
std::function< void(GrDeferredTextureUploadWritePixelsFn &)> GrDeferredTextureUploadFn
GrPrimitiveRestart
Definition GrTypesPriv.h:55
GrSurfaceOrigin
Definition GrTypes.h:147
SkColor4f color
Definition GrGpu.h:62
void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex) override
bool set(GrRenderTarget *, sk_sp< GrVkFramebuffer >, GrSurfaceOrigin, const SkIRect &bounds, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const GrOpsRenderPass::LoadAndStoreInfo &resolveInfo, GrVkRenderPass::SelfDependencyFlags selfDepFlags, GrVkRenderPass::LoadFromResolve loadFromResolve, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies)
void onClearStencilClip(const GrScissorState &scissor, bool insideStencilMask) override
void onBindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart) override
void onDrawIndexedIndirect(const GrBuffer *drawIndirectBuffer, size_t offset, int drawCount) override
void onSetScissorRect(const SkIRect &) override
void onDraw(int vertexCount, int baseVertex) override
void onDrawIndirect(const GrBuffer *drawIndirectBuffer, size_t offset, int drawCount) override
GrGpu * gpu() override
bool onBindTextures(const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &) override
void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex) override
bool onBindPipeline(const GrProgramInfo &, const SkRect &drawBounds) override
void onExecuteDrawable(std::unique_ptr< SkDrawable::GpuDrawHandler >) override
void onDrawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue, uint16_t maxIndexValue, int baseVertex) override
void onClear(const GrScissorState &scissor, std::array< float, 4 > color) override
void inlineUpload(GrOpFlushState *state, GrDeferredTextureUploadFn &upload) override
AtkStateType state
Point offset