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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // Currently the experimental GS will only work with triangle prims (and it
doesn't do anything | 116 // Currently the experimental GS will only work with triangle prims (and it
doesn't do anything |
117 // other than pass through values from the VS to the FS anyway). | 117 // other than pass through values from the VS to the FS anyway). |
118 #if GR_GL_EXPERIMENTAL_GS | 118 #if GR_GL_EXPERIMENTAL_GS |
119 #if 0 | 119 #if 0 |
120 header->fExperimentalGS = gpu->caps().geometryShaderSupport(); | 120 header->fExperimentalGS = gpu->caps().geometryShaderSupport(); |
121 #else | 121 #else |
122 header->fExperimentalGS = false; | 122 header->fExperimentalGS = false; |
123 #endif | 123 #endif |
124 #endif | 124 #endif |
| 125 bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->p
athRenderingSupport(); |
| 126 |
125 if (colorIsTransBlack) { | 127 if (colorIsTransBlack) { |
126 header->fColorInput = kTransBlack_ColorInput; | 128 header->fColorInput = kTransBlack_ColorInput; |
127 } else if (colorIsSolidWhite) { | 129 } else if (colorIsSolidWhite) { |
128 header->fColorInput = kSolidWhite_ColorInput; | 130 header->fColorInput = kSolidWhite_ColorInput; |
129 } else if (GR_GL_NO_CONSTANT_ATTRIBUTES && !requiresColorAttrib) { | 131 } else if (defaultToUniformInputs && !requiresColorAttrib) { |
130 header->fColorInput = kUniform_ColorInput; | 132 header->fColorInput = kUniform_ColorInput; |
131 } else { | 133 } else { |
132 header->fColorInput = kAttribute_ColorInput; | 134 header->fColorInput = kAttribute_ColorInput; |
133 header->fHasVertexCode = true; | 135 header->fHasVertexCode = true; |
134 } | 136 } |
135 | 137 |
136 bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.ge
tCoverage(); | 138 bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.ge
tCoverage(); |
137 | 139 |
138 if (skipCoverage) { | 140 if (skipCoverage) { |
139 header->fCoverageInput = kTransBlack_ColorInput; | 141 header->fCoverageInput = kTransBlack_ColorInput; |
140 } else if (covIsSolidWhite) { | 142 } else if (covIsSolidWhite) { |
141 header->fCoverageInput = kSolidWhite_ColorInput; | 143 header->fCoverageInput = kSolidWhite_ColorInput; |
142 } else if (GR_GL_NO_CONSTANT_ATTRIBUTES && !requiresCoverageAttrib) { | 144 } else if (defaultToUniformInputs && !requiresCoverageAttrib) { |
143 header->fCoverageInput = kUniform_ColorInput; | 145 header->fCoverageInput = kUniform_ColorInput; |
144 } else { | 146 } else { |
145 header->fCoverageInput = kAttribute_ColorInput; | 147 header->fCoverageInput = kAttribute_ColorInput; |
146 header->fHasVertexCode = true; | 148 header->fHasVertexCode = true; |
147 } | 149 } |
148 | 150 |
149 if (readsDst) { | 151 if (readsDst) { |
150 SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport()); | 152 SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport()); |
151 const GrTexture* dstCopyTexture = NULL; | 153 const GrTexture* dstCopyTexture = NULL; |
152 if (NULL != dstCopy) { | 154 if (NULL != dstCopy) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 264 |
263 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { | 265 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { |
264 fInitialized = other.fInitialized; | 266 fInitialized = other.fInitialized; |
265 if (fInitialized) { | 267 if (fInitialized) { |
266 size_t keyLength = other.keyLength(); | 268 size_t keyLength = other.keyLength(); |
267 fKey.reset(keyLength); | 269 fKey.reset(keyLength); |
268 memcpy(fKey.get(), other.fKey.get(), keyLength); | 270 memcpy(fKey.get(), other.fKey.get(), keyLength); |
269 } | 271 } |
270 return *this; | 272 return *this; |
271 } | 273 } |
OLD | NEW |