| 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 #include "GrGLProgramDesc.h" | 7 #include "GrGLProgramDesc.h" |
| 8 | 8 |
| 9 #include "GrGLProcessor.h" | 9 #include "GrGLProcessor.h" |
| 10 #include "GrProcessor.h" | 10 #include "GrProcessor.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 header->fHasGeometryProcessor = optState.hasGeometryProcessor(); | 196 header->fHasGeometryProcessor = optState.hasGeometryProcessor(); |
| 197 | 197 |
| 198 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); | 198 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); |
| 199 if (gpu->caps()->pathRenderingSupport() && isPathRendering) { | 199 if (gpu->caps()->pathRenderingSupport() && isPathRendering) { |
| 200 header->fUseNvpr = true; | 200 header->fUseNvpr = true; |
| 201 SkASSERT(!optState.hasGeometryProcessor()); | 201 SkASSERT(!optState.hasGeometryProcessor()); |
| 202 } else { | 202 } else { |
| 203 header->fUseNvpr = false; | 203 header->fUseNvpr = false; |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo.fHa
sVertexColor); | 206 if (!optState.newStyle()) { |
| 207 bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo
.fHasVertexColor); |
| 207 | 208 |
| 208 if (!inputColorIsUsed) { | 209 if (!inputColorIsUsed) { |
| 209 header->fColorInput = GrProgramDesc::kAllOnes_ColorInput; | 210 header->fColorInput = GrProgramDesc::kAllOnes_ColorInput; |
| 210 } else if (hasUniformColor) { | 211 } else if (hasUniformColor) { |
| 211 header->fColorInput = GrProgramDesc::kUniform_ColorInput; | 212 header->fColorInput = GrProgramDesc::kUniform_ColorInput; |
| 213 } else { |
| 214 header->fColorInput = GrProgramDesc::kAttribute_ColorInput; |
| 215 SkASSERT(!header->fUseNvpr); |
| 216 } |
| 217 |
| 218 bool hasVertexCoverage = !isPathRendering && descInfo.fHasVertexCoverage
; |
| 219 |
| 220 bool covIsSolidWhite = !hasVertexCoverage && 0xffffffff == optState.getC
overageColor(); |
| 221 |
| 222 if (covIsSolidWhite || !inputCoverageIsUsed) { |
| 223 header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput; |
| 224 } else if (!hasVertexCoverage) { |
| 225 header->fCoverageInput = GrProgramDesc::kUniform_ColorInput; |
| 226 } else { |
| 227 header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; |
| 228 SkASSERT(!header->fUseNvpr); |
| 229 } |
| 212 } else { | 230 } else { |
| 213 header->fColorInput = GrProgramDesc::kAttribute_ColorInput; | 231 header->fColorInput = GrProgramDesc::kAttribute_ColorInput; |
| 214 SkASSERT(!header->fUseNvpr); | |
| 215 } | |
| 216 | |
| 217 bool hasVertexCoverage = !isPathRendering && descInfo.fHasVertexCoverage; | |
| 218 | |
| 219 bool covIsSolidWhite = !hasVertexCoverage && 0xffffffff == optState.getCover
ageColor(); | |
| 220 | |
| 221 if (covIsSolidWhite || !inputCoverageIsUsed) { | |
| 222 header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput; | |
| 223 } else if (!hasVertexCoverage) { | |
| 224 header->fCoverageInput = GrProgramDesc::kUniform_ColorInput; | |
| 225 } else { | |
| 226 header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; | 232 header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; |
| 227 SkASSERT(!header->fUseNvpr); | |
| 228 } | 233 } |
| 229 | 234 |
| 230 if (descInfo.fReadsDst) { | 235 if (descInfo.fReadsDst) { |
| 231 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); | 236 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); |
| 232 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); | 237 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); |
| 233 const GrTexture* dstCopyTexture = NULL; | 238 const GrTexture* dstCopyTexture = NULL; |
| 234 if (dstCopy) { | 239 if (dstCopy) { |
| 235 dstCopyTexture = dstCopy->texture(); | 240 dstCopyTexture = dstCopy->texture(); |
| 236 } | 241 } |
| 237 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, | 242 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 250 } | 255 } |
| 251 | 256 |
| 252 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; | 257 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; |
| 253 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; | 258 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; |
| 254 | 259 |
| 255 header->fColorEffectCnt = optState.numColorStages(); | 260 header->fColorEffectCnt = optState.numColorStages(); |
| 256 header->fCoverageEffectCnt = optState.numCoverageStages(); | 261 header->fCoverageEffectCnt = optState.numCoverageStages(); |
| 257 desc->finalize(); | 262 desc->finalize(); |
| 258 return true; | 263 return true; |
| 259 } | 264 } |
| OLD | NEW |