| 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 "gl/builders/GrGLProgramBuilder.h" |
| 8 #include "GrGLProgramDesc.h" | 9 #include "GrGLProgramDesc.h" |
| 9 #include "GrBackendEffectFactory.h" | 10 #include "GrBackendEffectFactory.h" |
| 10 #include "GrDrawEffect.h" | 11 #include "GrDrawEffect.h" |
| 11 #include "GrEffect.h" | 12 #include "GrEffect.h" |
| 12 #include "GrGLShaderBuilder.h" | |
| 13 #include "GrGpuGL.h" | 13 #include "GrGpuGL.h" |
| 14 | 14 |
| 15 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
| 16 | 16 |
| 17 bool GrGLProgramDesc::GetEffectKeyAndUpdateStats(const GrEffectStage& stage, | 17 bool GrGLProgramDesc::GetEffectKeyAndUpdateStats(const GrEffectStage& stage, |
| 18 const GrGLCaps& caps, | 18 const GrGLCaps& caps, |
| 19 bool useExplicitLocalCoords, | 19 bool useExplicitLocalCoords, |
| 20 GrEffectKeyBuilder* b, | 20 GrEffectKeyBuilder* b, |
| 21 uint16_t* effectKeySize, | 21 uint16_t* effectKeySize, |
| 22 bool* setTrueIfReadsDst, | 22 bool* setTrueIfReadsDst, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 header->fCoverageInput = kAttribute_ColorInput; | 205 header->fCoverageInput = kAttribute_ColorInput; |
| 206 header->fHasVertexCode = true; | 206 header->fHasVertexCode = true; |
| 207 } | 207 } |
| 208 | 208 |
| 209 if (readsDst) { | 209 if (readsDst) { |
| 210 SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport()); | 210 SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport()); |
| 211 const GrTexture* dstCopyTexture = NULL; | 211 const GrTexture* dstCopyTexture = NULL; |
| 212 if (NULL != dstCopy) { | 212 if (NULL != dstCopy) { |
| 213 dstCopyTexture = dstCopy->texture(); | 213 dstCopyTexture = dstCopy->texture(); |
| 214 } | 214 } |
| 215 header->fDstReadKey = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, g
pu->glCaps()); | 215 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, |
| 216 gpu->glCaps()); |
| 216 SkASSERT(0 != header->fDstReadKey); | 217 SkASSERT(0 != header->fDstReadKey); |
| 217 } else { | 218 } else { |
| 218 header->fDstReadKey = 0; | 219 header->fDstReadKey = 0; |
| 219 } | 220 } |
| 220 | 221 |
| 221 if (readFragPosition) { | 222 if (readFragPosition) { |
| 222 header->fFragPosKey = GrGLShaderBuilder::KeyForFragmentPosition(drawStat
e.getRenderTarget(), | 223 header->fFragPosKey = GrGLFragmentShaderBuilder::KeyForFragmentPosition( |
| 223 gpu->glCap
s()); | 224 drawState.getRenderTarget(), gpu->glCaps()); |
| 224 } else { | 225 } else { |
| 225 header->fFragPosKey = 0; | 226 header->fFragPosKey = 0; |
| 226 } | 227 } |
| 227 | 228 |
| 228 // Record attribute indices | 229 // Record attribute indices |
| 229 header->fPositionAttributeIndex = drawState.positionAttributeIndex(); | 230 header->fPositionAttributeIndex = drawState.positionAttributeIndex(); |
| 230 header->fLocalCoordAttributeIndex = drawState.localCoordAttributeIndex(); | 231 header->fLocalCoordAttributeIndex = drawState.localCoordAttributeIndex(); |
| 231 | 232 |
| 232 // For constant color and coverage we need an attribute with an index beyond
those already set | 233 // For constant color and coverage we need an attribute with an index beyond
those already set |
| 233 int availableAttributeIndex = drawState.getVertexAttribCount(); | 234 int availableAttributeIndex = drawState.getVertexAttribCount(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 *checksum = 0; | 316 *checksum = 0; |
| 316 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k
eyLength); | 317 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k
eyLength); |
| 317 } | 318 } |
| 318 | 319 |
| 319 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { | 320 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { |
| 320 size_t keyLength = other.keyLength(); | 321 size_t keyLength = other.keyLength(); |
| 321 fKey.reset(keyLength); | 322 fKey.reset(keyLength); |
| 322 memcpy(fKey.begin(), other.fKey.begin(), keyLength); | 323 memcpy(fKey.begin(), other.fKey.begin(), keyLength); |
| 323 return *this; | 324 return *this; |
| 324 } | 325 } |
| OLD | NEW |