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 "GrBackendProcessorFactory.h" | 10 #include "GrBackendProcessorFactory.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 offsetAndSize[0] = SkToU16(processorOffset); | 197 offsetAndSize[0] = SkToU16(processorOffset); |
198 offsetAndSize[1] = processorKeySize; | 198 offsetAndSize[1] = processorKeySize; |
199 ++(*offsetAndSizeIndex); | 199 ++(*offsetAndSizeIndex); |
200 return true; | 200 return true; |
201 } | 201 } |
202 | 202 |
203 bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, | 203 bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, |
204 const GrProgramDesc::DescInfo& descInfo, | 204 const GrProgramDesc::DescInfo& descInfo, |
205 GrGpu::DrawType drawType, | 205 GrGpu::DrawType drawType, |
206 GrGpuGL* gpu, | 206 GrGpuGL* gpu, |
207 const GrDeviceCoordTexture* dstCopy, | |
208 GrProgramDesc* desc) { | 207 GrProgramDesc* desc) { |
209 bool inputColorIsUsed = descInfo.fInputColorIsUsed; | 208 bool inputColorIsUsed = descInfo.fInputColorIsUsed; |
210 bool inputCoverageIsUsed = descInfo.fInputCoverageIsUsed; | 209 bool inputCoverageIsUsed = descInfo.fInputCoverageIsUsed; |
211 | 210 |
212 // The descriptor is used as a cache key. Thus when a field of the | 211 // The descriptor is used as a cache key. Thus when a field of the |
213 // descriptor will not affect program generation (because of the attribute | 212 // descriptor will not affect program generation (because of the attribute |
214 // bindings in use or other descriptor field settings) it should be set | 213 // bindings in use or other descriptor field settings) it should be set |
215 // to a canonical value to avoid duplicate programs with different keys. | 214 // to a canonical value to avoid duplicate programs with different keys. |
216 | 215 |
217 bool requiresLocalCoordAttrib = descInfo.fRequiresLocalCoordAttrib; | 216 bool requiresLocalCoordAttrib = descInfo.fRequiresLocalCoordAttrib; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 if (covIsSolidWhite || !inputCoverageIsUsed) { | 286 if (covIsSolidWhite || !inputCoverageIsUsed) { |
288 header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput; | 287 header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput; |
289 } else if (hasUniformCoverage) { | 288 } else if (hasUniformCoverage) { |
290 header->fCoverageInput = GrProgramDesc::kUniform_ColorInput; | 289 header->fCoverageInput = GrProgramDesc::kUniform_ColorInput; |
291 } else { | 290 } else { |
292 header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; | 291 header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; |
293 SkASSERT(!header->fUseNvpr); | 292 SkASSERT(!header->fUseNvpr); |
294 } | 293 } |
295 | 294 |
296 if (descInfo.fReadsDst) { | 295 if (descInfo.fReadsDst) { |
| 296 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); |
297 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); | 297 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); |
298 const GrTexture* dstCopyTexture = NULL; | 298 const GrTexture* dstCopyTexture = NULL; |
299 if (dstCopy) { | 299 if (dstCopy) { |
300 dstCopyTexture = dstCopy->texture(); | 300 dstCopyTexture = dstCopy->texture(); |
301 } | 301 } |
302 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, | 302 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, |
303 gpu->glCa
ps()); | 303 gpu->glCa
ps()); |
304 SkASSERT(0 != header->fDstReadKey); | 304 SkASSERT(0 != header->fDstReadKey); |
305 } else { | 305 } else { |
306 header->fDstReadKey = 0; | 306 header->fDstReadKey = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 340 } |
341 | 341 |
342 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; | 342 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; |
343 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; | 343 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; |
344 | 344 |
345 header->fColorEffectCnt = optState.numColorStages(); | 345 header->fColorEffectCnt = optState.numColorStages(); |
346 header->fCoverageEffectCnt = optState.numCoverageStages(); | 346 header->fCoverageEffectCnt = optState.numCoverageStages(); |
347 desc->finalize(); | 347 desc->finalize(); |
348 return true; | 348 return true; |
349 } | 349 } |
OLD | NEW |