Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: src/gpu/GrDrawState.h

Issue 647183002: Revert of Opt state takes a GP instead of a GeometryStage (Closed) Base URL: https://skia.googlesource.com/skia.git@builder_cleanup
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDrawState_DEFINED 8 #ifndef GrDrawState_DEFINED
9 #define GrDrawState_DEFINED 9 #define GrDrawState_DEFINED
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 /** 215 /**
216 * The geometry processor is the sole element of the skia pipeline which can use the vertex, 216 * The geometry processor is the sole element of the skia pipeline which can use the vertex,
217 * geometry, and tesselation shaders. The GP may also compute a coverage in its fragment shader 217 * geometry, and tesselation shaders. The GP may also compute a coverage in its fragment shader
218 * but is never put in the color processing pipeline. 218 * but is never put in the color processing pipeline.
219 */ 219 */
220 220
221 const GrGeometryProcessor* setGeometryProcessor(const GrGeometryProcessor* g eometryProcessor) { 221 const GrGeometryProcessor* setGeometryProcessor(const GrGeometryProcessor* g eometryProcessor) {
222 SkASSERT(geometryProcessor); 222 SkASSERT(geometryProcessor);
223 SkASSERT(!this->hasGeometryProcessor()); 223 SkASSERT(!this->hasGeometryProcessor());
224 fGeometryProcessor.reset(SkRef(geometryProcessor)); 224 fGeometryProcessor.reset(new GrGeometryStage(geometryProcessor));
225 this->invalidateOptState(); 225 this->invalidateOptState();
226 return geometryProcessor; 226 return geometryProcessor;
227 } 227 }
228 228
229 /////////////////////////////////////////////////////////////////////////// 229 ///////////////////////////////////////////////////////////////////////////
230 /// @name Effect Stages 230 /// @name Effect Stages
231 /// Each stage hosts a GrProcessor. The effect produces an output color or c overage in the 231 /// Each stage hosts a GrProcessor. The effect produces an output color or c overage in the
232 /// fragment shader. Its inputs are the output from the previous stage as we ll as some variables 232 /// fragment shader. Its inputs are the output from the previous stage as we ll as some variables
233 /// available to it in the fragment and vertex shader (e.g. the vertex posit ion, the dst color, 233 /// available to it in the fragment and vertex shader (e.g. the vertex posit ion, the dst color,
234 /// the fragment position, local coordinates). 234 /// the fragment position, local coordinates).
(...skipping 12 matching lines...) Expand all
247 //// 247 ////
248 248
249 int numColorStages() const { return fColorStages.count(); } 249 int numColorStages() const { return fColorStages.count(); }
250 int numCoverageStages() const { return fCoverageStages.count(); } 250 int numCoverageStages() const { return fCoverageStages.count(); }
251 int numTotalStages() const { 251 int numTotalStages() const {
252 return this->numColorStages() + this->numCoverageStages() + 252 return this->numColorStages() + this->numCoverageStages() +
253 (this->hasGeometryProcessor() ? 1 : 0); 253 (this->hasGeometryProcessor() ? 1 : 0);
254 } 254 }
255 255
256 bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get() ); } 256 bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get() ); }
257 const GrGeometryProcessor* getGeometryProcessor() const { return fGeometryPr ocessor.get(); } 257 const GrGeometryStage* getGeometryProcessor() const { return fGeometryProces sor.get(); }
258 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id x]; } 258 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id x]; }
259 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta ges[idx]; } 259 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta ges[idx]; }
260 260
261 /** 261 /**
262 * Checks whether any of the effects will read the dst pixel color. 262 * Checks whether any of the effects will read the dst pixel color.
263 */ 263 */
264 bool willEffectReadDstColor() const; 264 bool willEffectReadDstColor() const;
265 265
266 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe ct) { 266 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe ct) {
267 SkASSERT(effect); 267 SkASSERT(effect);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 /** Sets the draw state's matrix to identity. This can fail because the current view matrix 478 /** Sets the draw state's matrix to identity. This can fail because the current view matrix
479 is not invertible. */ 479 is not invertible. */
480 bool setIdentity(GrDrawState* drawState); 480 bool setIdentity(GrDrawState* drawState);
481 481
482 private: 482 private:
483 void doEffectCoordChanges(const SkMatrix& coordChangeMatrix); 483 void doEffectCoordChanges(const SkMatrix& coordChangeMatrix);
484 484
485 GrDrawState* fDrawState; 485 GrDrawState* fDrawState;
486 SkMatrix fViewMatrix; 486 SkMatrix fViewMatrix;
487 int fNumColorStages; 487 int fNumColorStages;
488 SkAutoSTArray<8, GrFragmentStage::SavedCoordChange> fSavedCoordChange s; 488 bool fHasGeometryProce ssor;
489 SkAutoSTArray<8, GrProcessorStage::SavedCoordChange> fSavedCoordChange s;
489 }; 490 };
490 491
491 /// @} 492 /// @}
492 493
493 /////////////////////////////////////////////////////////////////////////// 494 ///////////////////////////////////////////////////////////////////////////
494 /// @name Render Target 495 /// @name Render Target
495 //// 496 ////
496 497
497 /** 498 /**
498 * Retrieves the currently set render-target. 499 * Retrieves the currently set render-target.
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 uint32_t fFlagBits; 803 uint32_t fFlagBits;
803 const GrVertexAttrib* fVAPtr; 804 const GrVertexAttrib* fVAPtr;
804 int fVACount; 805 int fVACount;
805 size_t fVAStride; 806 size_t fVAStride;
806 GrStencilSettings fStencilSettings; 807 GrStencilSettings fStencilSettings;
807 uint8_t fCoverage; 808 uint8_t fCoverage;
808 DrawFace fDrawFace; 809 DrawFace fDrawFace;
809 GrBlendCoeff fSrcBlend; 810 GrBlendCoeff fSrcBlend;
810 GrBlendCoeff fDstBlend; 811 GrBlendCoeff fDstBlend;
811 812
812 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; 813 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray;
813 typedef GrProgramElementRef<const GrGeometryProcessor> ProgramGeometryProces sor; 814 SkAutoTDelete<GrGeometryStage> fGeometryProcessor;
814 ProgramGeometryProcessor fGeometryProcessor; 815 FragmentStageArray fColorStages;
815 FragmentStageArray fColorStages; 816 FragmentStageArray fCoverageStages;
816 FragmentStageArray fCoverageStages;
817 817
818 uint32_t fHints; 818 uint32_t fHints;
819 819
820 // This is simply a different representation of info in fVertexAttribs and t hus does 820 // This is simply a different representation of info in fVertexAttribs and t hus does
821 // not need to be compared in op==. 821 // not need to be compared in op==.
822 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ]; 822 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ];
823 823
824 mutable GrOptDrawState* fCachedOptState; 824 mutable GrOptDrawState* fCachedOptState;
825 mutable uint32_t fCachedCapsID; 825 mutable uint32_t fCachedCapsID;
826 826
827 friend class GrOptDrawState; 827 friend class GrOptDrawState;
828 828
829 typedef SkRefCnt INHERITED; 829 typedef SkRefCnt INHERITED;
830 }; 830 };
831 831
832 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 832 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
833 833
834 #endif 834 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698