diff options
author | 2017-06-06 12:27:16 -0600 | |
---|---|---|
committer | 2017-06-07 18:26:11 +0000 | |
commit | 46983b7dd88603bb2a9a3c3e1ce3e147f5615f2f (patch) | |
tree | cb2dccc7b6d44b1100dc34af92c60d7b243d01c7 /src/gpu/GrPipeline.h | |
parent | 912e6b883782cd6a53348056012ff7ed38658c79 (diff) |
Introduce dynamic pipeline state
Adds a DynamicState struct to GrPipeline that has a field for the
scissor rect. Eventually this should become the only way to specify a
scissor rectangle and may grow to contain more fields. Adds an array of
DynamicStates to GrGpuCommandBuffer::draw and implements support in GL
and Vulkan.
Bug: skia:
Change-Id: If5aebbf9da5d192acf7e68e7def4674ffc7ec310
Reviewed-on: https://skia-review.googlesource.com/18510
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.h')
-rw-r--r-- | src/gpu/GrPipeline.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 078cb68437..3fd518985d 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -68,6 +68,11 @@ public: return flags; } + enum ScissorState : bool { + kEnabled = true, + kDisabled = false + }; + struct InitArgs { uint32_t fFlags = 0; const GrProcessorSet* fProcessors = nullptr; // Must be finalized @@ -80,16 +85,26 @@ public: }; /** + * Graphics state that can change dynamically without creating a new pipeline. + **/ + 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. + SkIRect fScissorRect; + }; + + /** * A Default constructed pipeline is unusable until init() is called. **/ GrPipeline() = default; /** * Creates a simple pipeline with default settings and no processors. The provided blend mode - * must be "Porter Duff" (<= kLastCoeffMode). This pipeline is initialized without requiring - * a call to init(). + * must be "Porter Duff" (<= kLastCoeffMode). If using ScissorState::kEnabled, the caller must + * specify a scissor rectangle through the DynamicState struct. **/ - GrPipeline(GrRenderTarget*, SkBlendMode); + GrPipeline(GrRenderTarget*, ScissorState, SkBlendMode); GrPipeline(const InitArgs& args) { this->init(args); } |