| 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 GrGLGeometryProcessor_DEFINED | 8 #ifndef GrGLGeometryProcessor_DEFINED |
| 9 #define GrGLGeometryProcessor_DEFINED | 9 #define GrGLGeometryProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrGLProcessor.h" | 11 #include "GrGLProcessor.h" |
| 12 | 12 |
| 13 class GrBatchTracker; | 13 class GrBatchTracker; |
| 14 class GrGLGPBuilder; | 14 class GrGLGPBuilder; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit | 17 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit |
| 18 * from this class. Since paths don't have vertices, this class is only meant to
be used internally | 18 * from this class. Since paths don't have vertices, this class is only meant to
be used internally |
| 19 * by skia, for special cases. | 19 * by skia, for special cases. |
| 20 */ | 20 */ |
| 21 class GrGLGeometryProcessor { | 21 class GrGLGeometryProcessor { |
| 22 public: | 22 public: |
| 23 GrGLGeometryProcessor() {} | 23 GrGLGeometryProcessor() : fViewMatrixName(NULL) { fViewMatrix = SkMatrix::In
validMatrix(); } |
| 24 virtual ~GrGLGeometryProcessor() {} | 24 virtual ~GrGLGeometryProcessor() {} |
| 25 | 25 |
| 26 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 26 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
| 27 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | 27 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
| 28 | 28 |
| 29 struct EmitArgs { | 29 struct EmitArgs { |
| 30 EmitArgs(GrGLGPBuilder* pb, | 30 EmitArgs(GrGLGPBuilder* pb, |
| 31 const GrPrimitiveProcessor& gp, | 31 const GrPrimitiveProcessor& gp, |
| 32 const GrBatchTracker& bt, | 32 const GrBatchTracker& bt, |
| 33 const char* outputColor, | 33 const char* outputColor, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 * This function will only do the minimum required to emit the correct shad
er code. If | 67 * This function will only do the minimum required to emit the correct shad
er code. If |
| 68 * inputType == attribute, then colorAttr must not be NULL. Likewise, if i
nputType == Uniform | 68 * inputType == attribute, then colorAttr must not be NULL. Likewise, if i
nputType == Uniform |
| 69 * then colorUniform must not be NULL. | 69 * then colorUniform must not be NULL. |
| 70 */ | 70 */ |
| 71 void setupColorPassThrough(GrGLGPBuilder* pb, | 71 void setupColorPassThrough(GrGLGPBuilder* pb, |
| 72 GrGPInput inputType, | 72 GrGPInput inputType, |
| 73 const char* inputName, | 73 const char* inputName, |
| 74 const GrGeometryProcessor::GrAttribute* colorAttr
, | 74 const GrGeometryProcessor::GrAttribute* colorAttr
, |
| 75 UniformHandle* colorUniform); | 75 UniformHandle* colorUniform); |
| 76 | 76 |
| 77 const char* uViewM() const { return fViewMatrixName; } |
| 78 |
| 79 /** a helper function to setup the uniform handle for the uniform view matri
x */ |
| 80 void addUniformViewMatrix(GrGLGPBuilder*); |
| 81 |
| 82 |
| 83 /** a helper function to upload a uniform viewmatrix. |
| 84 * TODO we can remove this function when we have deferred geometry in place |
| 85 */ |
| 86 void setUniformViewMatrix(const GrGLProgramDataManager&, |
| 87 const SkMatrix& viewMatrix); |
| 88 |
| 77 private: | 89 private: |
| 90 UniformHandle fViewMatrixUniform; |
| 91 SkMatrix fViewMatrix; |
| 92 const char* fViewMatrixName; |
| 93 |
| 78 typedef GrGLProcessor INHERITED; | 94 typedef GrGLProcessor INHERITED; |
| 79 }; | 95 }; |
| 80 | 96 |
| 81 #endif | 97 #endif |
| OLD | NEW |