diff options
author | 2017-03-21 14:22:38 -0400 | |
---|---|---|
committer | 2017-03-21 23:55:32 +0000 | |
commit | 54d212e1bfaea0be88c3c40820d0b1ae0daebecf (patch) | |
tree | ce606e9d88dfd04d592d406881b7e6e5d9a855cf /src/gpu/ops/GrMeshDrawOp.h | |
parent | 337432dc092619431eaa62f13e6347f2272f1fa7 (diff) |
Revert "Revert "Remove GrPipeline from GrDrawOp.""
This reverts commit c48af934608bbb65650641f66adb51f2102d4274.
Change-Id: I4ba78fd7e5a7d406b88223ca6f7245c029b60f76
Reviewed-on: https://skia-review.googlesource.com/9981
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ops/GrMeshDrawOp.h')
-rw-r--r-- | src/gpu/ops/GrMeshDrawOp.h | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h index a7d312f151..4cf7c52672 100644 --- a/src/gpu/ops/GrMeshDrawOp.h +++ b/src/gpu/ops/GrMeshDrawOp.h @@ -15,6 +15,7 @@ #include "SkTLList.h" +class GrCaps; class GrOpFlushState; /** @@ -24,9 +25,39 @@ class GrMeshDrawOp : public GrDrawOp { public: class Target; - GrMeshDrawOp(uint32_t classID); + /** + * Performs analysis of the fragment processors in GrProcessorSet and GrAppliedClip using the + * initial color and coverage from this op's geometry processor. + */ + void analyzeProcessors(GrProcessorSet::FragmentProcessorAnalysis* analysis, + const GrProcessorSet& processors, + const GrAppliedClip* appliedClip, + const GrCaps& caps) const { + FragmentProcessorAnalysisInputs input; + this->getFragmentProcessorAnalysisInputs(&input); + analysis->init(*input.colorInput(), *input.coverageInput(), processors, appliedClip, caps); + } + + void initPipeline(const GrPipeline::InitArgs& args) { + this->applyPipelineOptimizations(fPipeline.init(args)); + } + + /** + * Mesh draw ops use a legacy system in GrRenderTargetContext where the pipeline is created when + * the op is recorded. These methods are unnecessary as this information is in the pipeline. + */ + FixedFunctionFlags fixedFunctionFlags() const override { + SkFAIL("This should never be called for mesh draw ops."); + return FixedFunctionFlags::kNone; + } + bool xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*) override { + SkFAIL("Should never be called for mesh draw ops."); + return false; + } protected: + GrMeshDrawOp(uint32_t classID); + /** Helper for rendering instances using an instanced index index buffer. This class creates the space for the vertices and flushes the draws to the GrMeshDrawOp::Target. */ class InstancedHelper { @@ -62,7 +93,39 @@ protected: typedef InstancedHelper INHERITED; }; + const GrPipeline* pipeline() const { + SkASSERT(fPipeline.isInitialized()); + return &fPipeline; + } + + /** + * This describes aspects of the GrPrimitiveProcessor produced by a GrDrawOp that are used in + * pipeline analysis. + */ + class FragmentProcessorAnalysisInputs { + public: + FragmentProcessorAnalysisInputs() = default; + GrPipelineInput* colorInput() { return &fColorInput; } + GrPipelineInput* coverageInput() { return &fCoverageInput; } + + private: + GrPipelineInput fColorInput; + GrPipelineInput fCoverageInput; + }; + private: + /** + * Provides information about the GrPrimitiveProccesor color and coverage outputs which become + * inputs to the first color and coverage fragment processors. + */ + virtual void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs*) const = 0; + + /** + * After GrPipeline analysis is complete this is called so that the op can use the analysis + * results when constructing its GrPrimitiveProcessor. + */ + virtual void applyPipelineOptimizations(const GrPipelineOptimizations&) = 0; + void onPrepare(GrOpFlushState* state) final; void onExecute(GrOpFlushState* state) final; @@ -82,7 +145,7 @@ private: // globally across all ops. This is the offset of the first entry in fQueuedDraws. // fQueuedDraws[i]'s token is fBaseDrawToken + i. GrDrawOpUploadToken fBaseDrawToken; - + GrPipeline fPipeline; SkSTArray<4, GrMesh> fMeshes; SkSTArray<4, QueuedDraw, true> fQueuedDraws; |