| 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 GrGeometryProcessor_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
| 9 #define GrGeometryProcessor_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const GrGLCaps& caps, | 162 const GrGLCaps& caps, |
| 163 GrProcessorKeyBuilder* b) const = 0; | 163 GrProcessorKeyBuilder* b) const = 0; |
| 164 | 164 |
| 165 | 165 |
| 166 /** Returns a new instance of the appropriate *GL* implementation class | 166 /** Returns a new instance of the appropriate *GL* implementation class |
| 167 for the given GrProcessor; caller is responsible for deleting | 167 for the given GrProcessor; caller is responsible for deleting |
| 168 the object. */ | 168 the object. */ |
| 169 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 169 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
| 170 const GrGLCaps& caps) const
= 0; | 170 const GrGLCaps& caps) const
= 0; |
| 171 | 171 |
| 172 bool isPathRendering() const { return fIsPathRendering; } |
| 173 |
| 172 protected: | 174 protected: |
| 173 GrPrimitiveProcessor(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
) | 175 GrPrimitiveProcessor(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, |
| 176 bool isPathRendering) |
| 174 : fNumAttribs(0) | 177 : fNumAttribs(0) |
| 175 , fVertexStride(0) | 178 , fVertexStride(0) |
| 176 , fViewMatrix(viewMatrix) | 179 , fViewMatrix(viewMatrix) |
| 177 , fLocalMatrix(localMatrix) {} | 180 , fLocalMatrix(localMatrix) |
| 181 , fIsPathRendering(isPathRendering) {} |
| 178 | 182 |
| 179 /* | 183 /* |
| 180 * CanCombineOutput will return true if two draws are 'batchable' from a col
or perspective. | 184 * CanCombineOutput will return true if two draws are 'batchable' from a col
or perspective. |
| 181 * TODO remove this when GPs can upgrade to attribute color | 185 * TODO remove this when GPs can upgrade to attribute color |
| 182 */ | 186 */ |
| 183 static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right
, GrColor rColor) { | 187 static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right
, GrColor rColor) { |
| 184 if (left != right) { | 188 if (left != right) { |
| 185 return false; | 189 return false; |
| 186 } | 190 } |
| 187 | 191 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 208 | 212 |
| 209 Attribute fAttribs[kMaxVertexAttribs]; | 213 Attribute fAttribs[kMaxVertexAttribs]; |
| 210 int fNumAttribs; | 214 int fNumAttribs; |
| 211 size_t fVertexStride; | 215 size_t fVertexStride; |
| 212 | 216 |
| 213 private: | 217 private: |
| 214 virtual bool hasExplicitLocalCoords() const = 0; | 218 virtual bool hasExplicitLocalCoords() const = 0; |
| 215 | 219 |
| 216 const SkMatrix fViewMatrix; | 220 const SkMatrix fViewMatrix; |
| 217 SkMatrix fLocalMatrix; | 221 SkMatrix fLocalMatrix; |
| 222 bool fIsPathRendering; |
| 218 | 223 |
| 219 typedef GrProcessor INHERITED; | 224 typedef GrProcessor INHERITED; |
| 220 }; | 225 }; |
| 221 | 226 |
| 222 /** | 227 /** |
| 223 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor | 228 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor |
| 224 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it | 229 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it |
| 225 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and | 230 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and |
| 226 * coverage into the fragment shader. Where this color and coverage come from i
s completely the | 231 * coverage into the fragment shader. Where this color and coverage come from i
s completely the |
| 227 * responsibility of the GrGeometryProcessor. | 232 * responsibility of the GrGeometryProcessor. |
| 228 */ | 233 */ |
| 229 class GrGeometryProcessor : public GrPrimitiveProcessor { | 234 class GrGeometryProcessor : public GrPrimitiveProcessor { |
| 230 public: | 235 public: |
| 231 // TODO the Hint can be handled in a much more clean way when we have deferr
ed geometry or | 236 // TODO the Hint can be handled in a much more clean way when we have deferr
ed geometry or |
| 232 // atleast bundles | 237 // atleast bundles |
| 233 GrGeometryProcessor(GrColor color, | 238 GrGeometryProcessor(GrColor color, |
| 234 const SkMatrix& viewMatrix = SkMatrix::I(), | 239 const SkMatrix& viewMatrix = SkMatrix::I(), |
| 235 const SkMatrix& localMatrix = SkMatrix::I(), | 240 const SkMatrix& localMatrix = SkMatrix::I(), |
| 236 bool opaqueVertexColors = false) | 241 bool opaqueVertexColors = false) |
| 237 : INHERITED(viewMatrix, localMatrix) | 242 : INHERITED(viewMatrix, localMatrix, false) |
| 238 , fColor(color) | 243 , fColor(color) |
| 239 , fOpaqueVertexColors(opaqueVertexColors) | 244 , fOpaqueVertexColors(opaqueVertexColors) |
| 240 , fWillUseGeoShader(false) | 245 , fWillUseGeoShader(false) |
| 241 , fHasVertexColor(false) | 246 , fHasVertexColor(false) |
| 242 , fHasLocalCoords(false) {} | 247 , fHasLocalCoords(false) {} |
| 243 | 248 |
| 244 bool willUseGeoShader() const { return fWillUseGeoShader; } | 249 bool willUseGeoShader() const { return fWillUseGeoShader; } |
| 245 | 250 |
| 246 /* | 251 /* |
| 247 * In an ideal world, two GrGeometryProcessors with the same class id and te
xture accesses | 252 * In an ideal world, two GrGeometryProcessors with the same class id and te
xture accesses |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 405 |
| 401 private: | 406 private: |
| 402 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; } | 407 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; } |
| 403 | 408 |
| 404 GrColor fColor; | 409 GrColor fColor; |
| 405 | 410 |
| 406 typedef GrPrimitiveProcessor INHERITED; | 411 typedef GrPrimitiveProcessor INHERITED; |
| 407 }; | 412 }; |
| 408 | 413 |
| 409 #endif | 414 #endif |
| OLD | NEW |