Flutter Engine
The Flutter Engine
GrMtlOpsRenderPass.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 GrMtlOpsRenderPass_DEFINED
9#define GrMtlOpsRenderPass_DEFINED
10
14
15#import <Metal/Metal.h>
16
17typedef uint32_t GrColor;
18class GrMtlBuffer;
23
25public:
29
30 ~GrMtlOpsRenderPass() override;
31
33
35 void submit();
36
37private:
38 GrGpu* gpu() override { return fGpu; }
39
40 bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override;
41 void onSetScissorRect(const SkIRect&) override;
42 bool onBindTextures(const GrGeometryProcessor&,
43 const GrSurfaceProxy* const geomProcTextures[],
44 const GrPipeline&) override;
45 void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer,
46 sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override;
47 void onDraw(int vertexCount, int baseVertex) override;
48 void onDrawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue,
49 uint16_t maxIndexValue, int baseVertex) override;
50 void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount,
51 int baseVertex) override;
52 void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance,
53 int baseVertex) override;
54 void onDrawIndirect(const GrBuffer* drawIndirectBuffer, size_t bufferOffset,
55 int drawCount) override;
56 void onDrawIndexedIndirect(const GrBuffer* drawIndirectBuffer, size_t bufferOffset,
57 int drawCount) override;
58
59 void onClear(const GrScissorState& scissor, std::array<float, 4> color) override;
60
61 void onClearStencilClip(const GrScissorState& scissor, bool insideStencilMask) override;
62
63 void setupRenderPass(const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
65
66 void setVertexBuffer(GrMtlRenderCommandEncoder*, const GrBuffer*, size_t offset,
67 size_t inputBufferIndex);
68
69 bool setupResolve();
70 void setupRenderCommandEncoder(GrMtlPipelineState*);
71
72 GrMtlGpu* fGpu;
73
74 sk_sp<GrMtlFramebuffer> fFramebuffer;
75 GrMtlRenderCommandEncoder* fActiveRenderCmdEncoder;
76 GrMtlPipelineState* fActivePipelineState = nullptr;
77 MTLPrimitiveType fActivePrimitiveType;
78 MTLRenderPassDescriptor* fRenderPassDesc;
79 SkRect fBounds;
80 size_t fCurrentVertexStride;
81#ifdef SK_ENABLE_MTL_DEBUG_INFO
82 bool fDebugGroupActive = false;
83#endif
84
86};
87
88#endif
std::function< void(GrDeferredTextureUploadWritePixelsFn &)> GrDeferredTextureUploadFn
uint32_t GrColor
GrPrimitiveRestart
Definition: GrTypesPriv.h:56
GrSurfaceOrigin
Definition: GrTypes.h:147
Definition: GrGpu.h:62
~GrMtlOpsRenderPass() override
GrMtlOpsRenderPass(GrMtlGpu *gpu, GrRenderTarget *rt, sk_sp< GrMtlFramebuffer >, GrSurfaceOrigin origin, const GrOpsRenderPass::LoadAndStoreInfo &colorInfo, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilInfo)
void inlineUpload(GrOpFlushState *state, GrDeferredTextureUploadFn &upload) override
void initRenderState(GrMtlRenderCommandEncoder *)
DlColor color
AtkStateType state
Definition: upload.py:1
SeparatedVector2 offset
Definition: SkRect.h:32