Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLPrimitiveProcessor_DEFINED | 8 #ifndef GrGLPrimitiveProcessor_DEFINED |
| 9 #define GrGLPrimitiveProcessor_DEFINED | 9 #define GrGLPrimitiveProcessor_DEFINED |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH andle; | 24 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH andle; |
| 25 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | 25 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
| 26 | 26 |
| 27 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; | 27 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; |
| 28 typedef SkSTArray<8, ProcCoords> TransformsIn; | 28 typedef SkSTArray<8, ProcCoords> TransformsIn; |
| 29 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; | 29 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; |
| 30 | 30 |
| 31 struct EmitArgs { | 31 struct EmitArgs { |
| 32 EmitArgs(GrGLGPBuilder* pb, | 32 EmitArgs(GrGLGPBuilder* pb, |
| 33 const GrPrimitiveProcessor& gp, | 33 const GrPrimitiveProcessor& gp, |
| 34 const GrBatchTracker& bt, | |
| 35 const char* outputColor, | 34 const char* outputColor, |
| 36 const char* outputCoverage, | 35 const char* outputCoverage, |
| 37 const TextureSamplerArray& samplers, | 36 const TextureSamplerArray& samplers, |
| 38 const TransformsIn& transformsIn, | 37 const TransformsIn& transformsIn, |
| 39 TransformsOut* transformsOut) | 38 TransformsOut* transformsOut) |
| 40 : fPB(pb) | 39 : fPB(pb) |
| 41 , fGP(gp) | 40 , fGP(gp) |
| 42 , fBT(bt) | |
| 43 , fOutputColor(outputColor) | 41 , fOutputColor(outputColor) |
| 44 , fOutputCoverage(outputCoverage) | 42 , fOutputCoverage(outputCoverage) |
| 45 , fSamplers(samplers) | 43 , fSamplers(samplers) |
| 46 , fTransformsIn(transformsIn) | 44 , fTransformsIn(transformsIn) |
| 47 , fTransformsOut(transformsOut) {} | 45 , fTransformsOut(transformsOut) {} |
| 48 GrGLGPBuilder* fPB; | 46 GrGLGPBuilder* fPB; |
| 49 const GrPrimitiveProcessor& fGP; | 47 const GrPrimitiveProcessor& fGP; |
| 50 const GrBatchTracker& fBT; | |
| 51 const char* fOutputColor; | 48 const char* fOutputColor; |
| 52 const char* fOutputCoverage; | 49 const char* fOutputCoverage; |
| 53 const TextureSamplerArray& fSamplers; | 50 const TextureSamplerArray& fSamplers; |
| 54 const TransformsIn& fTransformsIn; | 51 const TransformsIn& fTransformsIn; |
| 55 TransformsOut* fTransformsOut; | 52 TransformsOut* fTransformsOut; |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 /** | 55 /** |
| 59 * This is similar to emitCode() in the base class, except it takes a full s hader builder. | 56 * This is similar to emitCode() in the base class, except it takes a full s hader builder. |
| 60 * This allows the effect subclass to emit vertex code. | 57 * This allows the effect subclass to emit vertex code. |
| 61 */ | 58 */ |
| 62 virtual void emitCode(EmitArgs&) = 0; | 59 virtual void emitCode(EmitArgs&) = 0; |
| 63 | 60 |
| 64 | 61 |
| 65 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr ocessor that | 62 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr ocessor that |
| 66 produces the same stage key; this function reads data from a GrGLPrimiti veProcessor and | 63 produces the same stage key; this function reads data from a GrGLPrimiti veProcessor and |
| 67 uploads any uniform variables required by the shaders created in emitCo de(). The | 64 uploads any uniform variables required by the shaders created in emitCo de(). The |
| 68 GrPrimitiveProcessor parameter is guaranteed to be of the same type that created this | 65 GrPrimitiveProcessor parameter is guaranteed to be of the same type that created this |
| 69 GrGLPrimitiveProcessor and to have an identical processor key as the one that created this | 66 GrGLPrimitiveProcessor and to have an identical processor key as the one that created this |
| 70 GrGLPrimitiveProcessor. */ | 67 GrGLPrimitiveProcessor. */ |
| 71 virtual void setData(const GrGLProgramDataManager&, | 68 virtual void setData(const GrGLProgramDataManager&, |
|
bsalomon
2015/09/10 18:55:32
one line?
joshualitt
2015/09/10 20:08:06
Acknowledged.
| |
| 72 const GrPrimitiveProcessor&, | 69 const GrPrimitiveProcessor&) = 0; |
| 73 const GrBatchTracker&) = 0; | |
| 74 | 70 |
| 75 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&); | 71 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor dTransform&); |
| 76 | 72 |
| 77 protected: | 73 protected: |
| 78 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform); | 74 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan dle* colorUniform); |
| 79 | 75 |
| 80 class ShaderVarHandle { | 76 class ShaderVarHandle { |
| 81 public: | 77 public: |
| 82 bool isValid() const { return fHandle > -1; } | 78 bool isValid() const { return fHandle > -1; } |
| 83 ShaderVarHandle() : fHandle(-1) {} | 79 ShaderVarHandle() : fHandle(-1) {} |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 100 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); } | 96 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM atrix(); } |
| 101 ShaderVarHandle fHandle; | 97 ShaderVarHandle fHandle; |
| 102 SkMatrix fCurrentValue; | 98 SkMatrix fCurrentValue; |
| 103 GrSLType fType; | 99 GrSLType fType; |
| 104 }; | 100 }; |
| 105 | 101 |
| 106 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; | 102 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; |
| 107 }; | 103 }; |
| 108 | 104 |
| 109 #endif | 105 #endif |
| OLD | NEW |