| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const GrXferProcessor& xp = *optState.getXferProcessor(); | 123 const GrXferProcessor& xp = *optState.getXferProcessor(); |
| 124 xp.getGLProcessorKey(gpu->glCaps(), &b); | 124 xp.getGLProcessorKey(gpu->glCaps(), &b); |
| 125 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) { | 125 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) { |
| 126 desc->fKey.reset(); | 126 desc->fKey.reset(); |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- | 130 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- |
| 131 // Because header is a pointer into the dynamic array, we can't push any new
data into the key | 131 // Because header is a pointer into the dynamic array, we can't push any new
data into the key |
| 132 // below here. | 132 // below here. |
| 133 GLKeyHeader* header = desc->atOffset<GLKeyHeader, kHeaderOffset>(); | 133 KeyHeader* header = desc->atOffset<KeyHeader, kHeaderOffset>(); |
| 134 | 134 |
| 135 // make sure any padding in the header is zeroed. | 135 // make sure any padding in the header is zeroed. |
| 136 memset(header, 0, kHeaderSize); | 136 memset(header, 0, kHeaderSize); |
| 137 | 137 |
| 138 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); | |
| 139 if (gpu->caps()->pathRenderingSupport() && isPathRendering) { | |
| 140 header->fUseNvpr = true; | |
| 141 } else { | |
| 142 header->fUseNvpr = false; | |
| 143 } | |
| 144 | |
| 145 if (descInfo.fReadsDst) { | 138 if (descInfo.fReadsDst) { |
| 146 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); | 139 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); |
| 147 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); | 140 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); |
| 148 const GrTexture* dstCopyTexture = NULL; | 141 const GrTexture* dstCopyTexture = NULL; |
| 149 if (dstCopy) { | 142 if (dstCopy) { |
| 150 dstCopyTexture = dstCopy->texture(); | 143 dstCopyTexture = dstCopy->texture(); |
| 151 } | 144 } |
| 152 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, | 145 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe
xture, |
| 153 gpu->glCa
ps()); | 146 gpu->glCa
ps()); |
| 154 SkASSERT(0 != header->fDstReadKey); | 147 SkASSERT(0 != header->fDstReadKey); |
| 155 } else { | 148 } else { |
| 156 header->fDstReadKey = 0; | 149 header->fDstReadKey = 0; |
| 157 } | 150 } |
| 158 | 151 |
| 159 if (descInfo.fReadsFragPosition) { | 152 if (descInfo.fReadsFragPosition) { |
| 160 header->fFragPosKey = | 153 header->fFragPosKey = |
| 161 GrGLFragmentShaderBuilder::KeyForFragmentPosition(optState.getRe
nderTarget(), | 154 GrGLFragmentShaderBuilder::KeyForFragmentPosition(optState.getRe
nderTarget(), |
| 162 gpu->glCaps())
; | 155 gpu->glCaps())
; |
| 163 } else { | 156 } else { |
| 164 header->fFragPosKey = 0; | 157 header->fFragPosKey = 0; |
| 165 } | 158 } |
| 166 | 159 |
| 167 header->fColorEffectCnt = optState.numColorStages(); | 160 header->fColorEffectCnt = optState.numColorStages(); |
| 168 header->fCoverageEffectCnt = optState.numCoverageStages(); | 161 header->fCoverageEffectCnt = optState.numCoverageStages(); |
| 169 desc->finalize(); | 162 desc->finalize(); |
| 170 return true; | 163 return true; |
| 171 } | 164 } |
| OLD | NEW |