| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrFragmentProcessor_DEFINED | 8 #ifndef GrFragmentProcessor_DEFINED |
| 9 #define GrFragmentProcessor_DEFINED | 9 #define GrFragmentProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
| 12 | 12 |
| 13 class GrCoordTransform; | 13 class GrCoordTransform; |
| 14 class GrGLCaps; | 14 class GrGLCaps; |
| 15 typedef GrGLCaps GrGLSLCaps; |
| 15 class GrGLFragmentProcessor; | 16 class GrGLFragmentProcessor; |
| 16 class GrProcessorKeyBuilder; | 17 class GrProcessorKeyBuilder; |
| 17 | 18 |
| 18 /** Provides custom fragment shader code. Fragment processors receive an input c
olor (vec4f) and | 19 /** Provides custom fragment shader code. Fragment processors receive an input c
olor (vec4f) and |
| 19 produce an output color. They may reference textures and uniforms. They may
use | 20 produce an output color. They may reference textures and uniforms. They may
use |
| 20 GrCoordTransforms to receive a transformation of the local coordinates that
map from local space | 21 GrCoordTransforms to receive a transformation of the local coordinates that
map from local space |
| 21 to the fragment being processed. | 22 to the fragment being processed. |
| 22 */ | 23 */ |
| 23 class GrFragmentProcessor : public GrProcessor { | 24 class GrFragmentProcessor : public GrProcessor { |
| 24 public: | 25 public: |
| 25 GrFragmentProcessor() | 26 GrFragmentProcessor() |
| 26 : INHERITED() | 27 : INHERITED() |
| 27 , fWillUseInputColor(true) | 28 , fWillUseInputColor(true) |
| 28 , fUsesLocalCoords(false) {} | 29 , fUsesLocalCoords(false) {} |
| 29 | 30 |
| 30 /** Implemented using GLFragmentProcessor::GenKey as described in this class
's comment. */ | 31 /** Implemented using GLFragmentProcessor::GenKey as described in this class
's comment. */ |
| 31 virtual void getGLProcessorKey(const GrGLCaps& caps, | 32 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
| 32 GrProcessorKeyBuilder* b) const = 0; | 33 GrProcessorKeyBuilder* b) const = 0; |
| 33 | 34 |
| 34 /** Returns a new instance of the appropriate *GL* implementation class | 35 /** Returns a new instance of the appropriate *GL* implementation class |
| 35 for the given GrFragmentProcessor; caller is responsible for deleting | 36 for the given GrFragmentProcessor; caller is responsible for deleting |
| 36 the object. */ | 37 the object. */ |
| 37 virtual GrGLFragmentProcessor* createGLInstance() const = 0; | 38 virtual GrGLFragmentProcessor* createGLInstance() const = 0; |
| 38 | 39 |
| 39 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb
edded | 40 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb
edded |
| 40 in generated shader code. */ | 41 in generated shader code. */ |
| 41 virtual const char* name() const = 0; | 42 virtual const char* name() const = 0; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 bool hasSameTransforms(const GrFragmentProcessor&) const; | 126 bool hasSameTransforms(const GrFragmentProcessor&) const; |
| 126 | 127 |
| 127 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; | 128 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
| 128 bool fWillUseInputColor; | 129 bool fWillUseInputColor; |
| 129 bool fUsesLocalCoords; | 130 bool fUsesLocalCoords; |
| 130 | 131 |
| 131 typedef GrProcessor INHERITED; | 132 typedef GrProcessor INHERITED; |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 #endif | 135 #endif |
| OLD | NEW |