Make GrGpuCommandBuffer infer its render target from first draw
This is a temporary workaround to allow removal of GrBatch::renderTarget().
Change-Id: Ic14710a369802064cf6446e8191a98ea3595556d
Reviewed-on: https://skia-review.googlesource.com/5342
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.h b/src/gpu/vk/GrVkGpuCommandBuffer.h
index 160e4ca..9c6f03d 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.h
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.h
@@ -24,7 +24,6 @@
class GrVkGpuCommandBuffer : public GrGpuCommandBuffer {
public:
GrVkGpuCommandBuffer(GrVkGpu* gpu,
- GrVkRenderTarget*,
const LoadAndStoreInfo& colorInfo,
const LoadAndStoreInfo& stencilInfo);
@@ -32,11 +31,14 @@
void end() override;
- void discard() override;
+ void discard(GrRenderTarget*) override;
void inlineUpload(GrBatchFlushState* state, GrDrawBatch::DeferredUploadFn& upload) override;
private:
+ // Performs lazy initialization on the first operation seen by the command buffer.
+ void init(GrVkRenderTarget* rt);
+
GrGpu* gpu() override;
GrRenderTarget* renderTarget() override;
@@ -55,9 +57,9 @@
int meshCount,
const SkRect& bounds) override;
- void onClear(const GrFixedClip&, GrColor color) override;
+ void onClear(GrRenderTarget*, const GrFixedClip&, GrColor color) override;
- void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) override;
+ void onClearStencilClip(GrRenderTarget*, const GrFixedClip&, bool insideStencilMask) override;
void addAdditionalCommandBuffer();
@@ -85,6 +87,11 @@
GrVkGpu* fGpu;
GrVkRenderTarget* fRenderTarget;
+ VkAttachmentLoadOp fVkColorLoadOp;
+ VkAttachmentStoreOp fVkColorStoreOp;
+ VkAttachmentLoadOp fVkStencilLoadOp;
+ VkAttachmentStoreOp fVkStencilStoreOp;
+ GrColor4f fClearColor;
typedef GrGpuCommandBuffer INHERITED;
};