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 #include "GrGLProgramDesc.h" | 8 #include "GrGLProgramDesc.h" |
9 #include "GrBackendEffectFactory.h" | 9 #include "GrBackendEffectFactory.h" |
10 #include "GrDrawEffect.h" | 10 #include "GrDrawEffect.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 // write the key length | 107 // write the key length |
108 *desc->atOffset<uint32_t, kLengthOffset>() = SkToU32(newKeyLength); | 108 *desc->atOffset<uint32_t, kLengthOffset>() = SkToU32(newKeyLength); |
109 | 109 |
110 KeyHeader* header = desc->header(); | 110 KeyHeader* header = desc->header(); |
111 EffectKey* effectKeys = desc->effectKeys(); | 111 EffectKey* effectKeys = desc->effectKeys(); |
112 | 112 |
113 int currEffectKey = 0; | 113 int currEffectKey = 0; |
114 bool readsDst = false; | 114 bool readsDst = false; |
115 bool readFragPosition = false; | 115 bool readFragPosition = false; |
116 // We use vertexshader-less shader programs only when drawing paths. | 116 |
117 bool hasVertexCode = !(GrGpu::kDrawPath_DrawType == drawType || | 117 // Provide option for shader programs without vertex shader only when drawin
g paths. |
118 GrGpu::kDrawPaths_DrawType == drawType); | 118 bool hasVertexCode = !GrGpu::IsPathRenderingDrawType(drawType); |
119 | 119 |
120 if (!skipColor) { | 120 if (!skipColor) { |
121 for (int s = firstEffectiveColorStage; s < drawState.numColorStages(); +
+s) { | 121 for (int s = firstEffectiveColorStage; s < drawState.numColorStages(); +
+s) { |
122 effectKeys[currEffectKey++] = | 122 effectKeys[currEffectKey++] = |
123 get_key_and_update_stats(drawState.getColorStage(s), gpu->glCaps
(), | 123 get_key_and_update_stats(drawState.getColorStage(s), gpu->glCaps
(), |
124 requiresLocalCoordAttrib, &readsDst, &r
eadFragPosition, | 124 requiresLocalCoordAttrib, &readsDst, &r
eadFragPosition, |
125 &hasVertexCode); | 125 &hasVertexCode); |
126 } | 126 } |
127 } | 127 } |
128 if (!skipCoverage) { | 128 if (!skipCoverage) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { | 277 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { |
278 fInitialized = other.fInitialized; | 278 fInitialized = other.fInitialized; |
279 if (fInitialized) { | 279 if (fInitialized) { |
280 size_t keyLength = other.keyLength(); | 280 size_t keyLength = other.keyLength(); |
281 fKey.reset(keyLength); | 281 fKey.reset(keyLength); |
282 memcpy(fKey.get(), other.fKey.get(), keyLength); | 282 memcpy(fKey.get(), other.fKey.get(), keyLength); |
283 } | 283 } |
284 return *this; | 284 return *this; |
285 } | 285 } |
OLD | NEW |