| 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 GrGLProgramDesc_DEFINED | 8 #ifndef GrGLProgramDesc_DEFINED |
| 9 #define GrGLProgramDesc_DEFINED | 9 #define GrGLProgramDesc_DEFINED |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Gets the number of bytes in asKey(). It will be a 4-byte aligned value. W
hen comparing two | 38 // Gets the number of bytes in asKey(). It will be a 4-byte aligned value. W
hen comparing two |
| 39 // keys the size of either key can be used with memcmp() since the lengths t
hemselves begin the | 39 // keys the size of either key can be used with memcmp() since the lengths t
hemselves begin the |
| 40 // keys and thus the memcmp will exit early if the keys are of different len
gths. | 40 // keys and thus the memcmp will exit early if the keys are of different len
gths. |
| 41 uint32_t keyLength() const { return *this->atOffset<uint32_t, kLengthOffset>
(); } | 41 uint32_t keyLength() const { return *this->atOffset<uint32_t, kLengthOffset>
(); } |
| 42 | 42 |
| 43 // Gets the a checksum of the key. Can be used as a hash value for a fast lo
okup in a cache. | 43 // Gets the a checksum of the key. Can be used as a hash value for a fast lo
okup in a cache. |
| 44 uint32_t getChecksum() const { return *this->atOffset<uint32_t, kChecksumOff
set>(); } | 44 uint32_t getChecksum() const { return *this->atOffset<uint32_t, kChecksumOff
set>(); } |
| 45 | 45 |
| 46 // For unit testing. | 46 // For unit testing. |
| 47 bool setRandom(SkRandom*, | 47 bool setRandom(SkRandom*, |
| 48 const GrGpuGL* gpu, | 48 GrGpuGL* gpu, |
| 49 const GrRenderTarget* dummyDstRenderTarget, | 49 const GrRenderTarget* dummyDstRenderTarget, |
| 50 const GrTexture* dummyDstCopyTexture, | 50 const GrTexture* dummyDstCopyTexture, |
| 51 const GrEffectStage* geometryProcessor, | 51 const GrEffectStage* geometryProcessor, |
| 52 const GrEffectStage* stages[], | 52 const GrEffectStage* stages[], |
| 53 int numColorStages, | 53 int numColorStages, |
| 54 int numCoverageStages, | 54 int numCoverageStages, |
| 55 int currAttribIndex); | 55 int currAttribIndex, |
| 56 GrGpu::DrawType); |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * Builds a program descriptor from a GrOptDrawState. Whether the primitive
type is points, and | 59 * Builds a program descriptor from a GrOptDrawState. Whether the primitive
type is points, and |
| 59 * the caps of the GrGpuGL are also inputs. It also outputs the color and co
verage stages | 60 * the caps of the GrGpuGL are also inputs. It also outputs the color and co
verage stages |
| 60 * referenced by the generated descriptor. Coverage stages from the drawStat
e may be treated as | 61 * referenced by the generated descriptor. Coverage stages from the drawStat
e may be treated as |
| 61 * color stages in the output. | 62 * color stages in the output. |
| 62 */ | 63 */ |
| 63 static bool Build(const GrOptDrawState&, | 64 static bool Build(const GrOptDrawState&, |
| 64 GrGpu::DrawType drawType, | 65 GrGpu::DrawType drawType, |
| 65 GrBlendCoeff srcCoeff, | 66 GrBlendCoeff srcCoeff, |
| 66 GrBlendCoeff dstCoeff, | 67 GrBlendCoeff dstCoeff, |
| 67 const GrGpuGL* gpu, | 68 GrGpuGL* gpu, |
| 68 const GrDeviceCoordTexture* dstCopy, | 69 const GrDeviceCoordTexture* dstCopy, |
| 69 const GrEffectStage** outGeometryProcessor, | 70 const GrEffectStage** outGeometryProcessor, |
| 70 SkTArray<const GrEffectStage*, true>* outColorStages, | 71 SkTArray<const GrEffectStage*, true>* outColorStages, |
| 71 SkTArray<const GrEffectStage*, true>* outCoverageStages, | 72 SkTArray<const GrEffectStage*, true>* outCoverageStages, |
| 72 GrGLProgramDesc* outDesc); | 73 GrGLProgramDesc* outDesc); |
| 73 | 74 |
| 74 bool hasGeometryProcessor() const { | 75 bool hasGeometryProcessor() const { |
| 75 return SkToBool(this->getHeader().fHasGeometryProcessor); | 76 return SkToBool(this->getHeader().fHasGeometryProcessor); |
| 76 } | 77 } |
| 77 | 78 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 uint8_t fDstReadKey; // set by GrGLShaderBuil
der if there | 145 uint8_t fDstReadKey; // set by GrGLShaderBuil
der if there |
| 145 // are effects that must
read the dst. | 146 // are effects that must
read the dst. |
| 146 // Otherwise, 0. | 147 // Otherwise, 0. |
| 147 uint8_t fFragPosKey; // set by GrGLShaderBuil
der if there are | 148 uint8_t fFragPosKey; // set by GrGLShaderBuil
der if there are |
| 148 // effects that read the
fragment position. | 149 // effects that read the
fragment position. |
| 149 // Otherwise, 0. | 150 // Otherwise, 0. |
| 150 ColorInput fColorInput : 8; | 151 ColorInput fColorInput : 8; |
| 151 ColorInput fCoverageInput : 8; | 152 ColorInput fCoverageInput : 8; |
| 152 CoverageOutput fCoverageOutput : 8; | 153 CoverageOutput fCoverageOutput : 8; |
| 153 | 154 |
| 154 SkBool8 fRequiresVertexShader; | 155 SkBool8 fUseFragShaderOnly; |
| 155 SkBool8 fEmitsPointSize; | 156 SkBool8 fEmitsPointSize; |
| 156 | 157 |
| 157 // To enable experimental geometry shader code (not for use in | 158 // To enable experimental geometry shader code (not for use in |
| 158 // production) | 159 // production) |
| 159 #if GR_GL_EXPERIMENTAL_GS | 160 #if GR_GL_EXPERIMENTAL_GS |
| 160 SkBool8 fExperimentalGS; | 161 SkBool8 fExperimentalGS; |
| 161 #endif | 162 #endif |
| 162 | 163 |
| 163 int8_t fPositionAttributeIndex; | 164 int8_t fPositionAttributeIndex; |
| 164 int8_t fLocalCoordAttributeIndex; | 165 int8_t fLocalCoordAttributeIndex; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 friend class GrGLProgram; | 266 friend class GrGLProgram; |
| 266 friend class GrGLProgramBuilder; | 267 friend class GrGLProgramBuilder; |
| 267 friend class GrGLFullProgramBuilder; | 268 friend class GrGLFullProgramBuilder; |
| 268 friend class GrGLFragmentOnlyProgramBuilder; | 269 friend class GrGLFragmentOnlyProgramBuilder; |
| 269 friend class GrGLVertexShaderBuilder; | 270 friend class GrGLVertexShaderBuilder; |
| 270 friend class GrGLFragmentShaderBuilder; | 271 friend class GrGLFragmentShaderBuilder; |
| 271 friend class GrGLGeometryShaderBuilder; | 272 friend class GrGLGeometryShaderBuilder; |
| 272 }; | 273 }; |
| 273 | 274 |
| 274 #endif | 275 #endif |
| OLD | NEW |