diff options
Diffstat (limited to 'src/gpu/GrPipeline.h')
-rw-r--r-- | src/gpu/GrPipeline.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 3ace0f0a1c..f60a6d410b 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -79,16 +79,26 @@ public: }; /** - * Graphics state that can change dynamically without creating a new pipeline. + * Some state can be changed between GrMeshes without changing GrPipelines. This is generally + * less expensive then using multiple pipelines. Such state is called "dynamic state". It can + * be specified in two ways: + * 1) FixedDynamicState - use this to specify state that does not vary between GrMeshes. + * 2) DynamicStateArrays - use this to specify per mesh values for dynamic state. **/ - struct DynamicState { - // Overrides the scissor rectangle (if scissor is enabled in the pipeline). - // TODO: eventually this should be the only way to specify a scissor rectangle, as is the - // case with the simple constructor. + struct FixedDynamicState { + FixedDynamicState(const SkIRect& scissorRect) : fScissorRect(scissorRect) {} SkIRect fScissorRect; }; /** + * Any non-null array overrides the FixedDynamicState on a mesh-by-mesh basis. Arrays must + * have one entry for each GrMesh. + */ + struct DynamicStateArrays { + const SkIRect* fScissorRects = nullptr; + }; + + /** * Creates a simple pipeline with default settings and no processors. The provided blend mode * must be "Porter Duff" (<= kLastCoeffMode). If using ScissorState::kEnabled, the caller must * specify a scissor rectangle through the DynamicState struct. @@ -169,7 +179,9 @@ public: const GrUserStencilSettings* getUserStencil() const { return fUserStencilSettings; } - const GrScissorState& getScissorState() const { return fScissorState; } + ScissorState isScissorEnabled() const { + return ScissorState(SkToBool(fFlags & kScissorEnabled_Flag)); + } const GrWindowRectsState& getWindowRectsState() const { return fWindowRectsState; } @@ -214,7 +226,8 @@ private: enum PrivateFlags { kHasStencilClip_Flag = 0x10, kStencilEnabled_Flag = 0x20, - kIsBad_Flag = 0x40, + kScissorEnabled_Flag = 0x40, + kIsBad_Flag = 0x80, }; using RenderTargetProxy = GrPendingIOResource<GrRenderTargetProxy, kWrite_GrIOType>; @@ -225,7 +238,6 @@ private: SkIPoint fDstTextureOffset; // MDB TODO: do we still need the destination proxy here? RenderTargetProxy fProxy; - GrScissorState fScissorState; GrWindowRectsState fWindowRectsState; const GrUserStencilSettings* fUserStencilSettings; uint16_t fFlags; |