| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 | 142 |
| 143 uint32_t* key = b->add32n(2); | 143 uint32_t* key = b->add32n(2); |
| 144 key[0] = (textureKey << 16 | transformKey); | 144 key[0] = (textureKey << 16 | transformKey); |
| 145 key[1] = (classID << 16 | SkToU16(processorKeySize)); | 145 key[1] = (classID << 16 | SkToU16(processorKeySize)); |
| 146 return true; | 146 return true; |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, | 149 bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, |
| 150 const GrProgramDesc::DescInfo& descInfo, | |
| 151 GrGpu::DrawType drawType, | 150 GrGpu::DrawType drawType, |
| 152 GrGpuGL* gpu, | 151 GrGpuGL* gpu, |
| 153 GrProgramDesc* desc) { | 152 GrProgramDesc* desc) { |
| 153 const GrProgramDesc::DescInfo& descInfo = optState.descInfo(); |
| 154 bool inputColorIsUsed = descInfo.fInputColorIsUsed; | 154 bool inputColorIsUsed = descInfo.fInputColorIsUsed; |
| 155 bool inputCoverageIsUsed = descInfo.fInputCoverageIsUsed; | 155 bool inputCoverageIsUsed = descInfo.fInputCoverageIsUsed; |
| 156 | 156 |
| 157 // The descriptor is used as a cache key. Thus when a field of the | 157 // The descriptor is used as a cache key. Thus when a field of the |
| 158 // descriptor will not affect program generation (because of the attribute | 158 // descriptor will not affect program generation (because of the attribute |
| 159 // bindings in use or other descriptor field settings) it should be set | 159 // bindings in use or other descriptor field settings) it should be set |
| 160 // to a canonical value to avoid duplicate programs with different keys. | 160 // to a canonical value to avoid duplicate programs with different keys. |
| 161 | 161 |
| 162 bool requiresLocalCoordAttrib = descInfo.fRequiresLocalCoordAttrib; | 162 bool requiresLocalCoordAttrib = descInfo.fRequiresLocalCoordAttrib; |
| 163 | 163 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 189 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- | 189 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- |
| 190 // Because header is a pointer into the dynamic array, we can't push any new
data into the key | 190 // Because header is a pointer into the dynamic array, we can't push any new
data into the key |
| 191 // below here. | 191 // below here. |
| 192 GLKeyHeader* header = desc->atOffset<GLKeyHeader, kHeaderOffset>(); | 192 GLKeyHeader* header = desc->atOffset<GLKeyHeader, kHeaderOffset>(); |
| 193 | 193 |
| 194 // make sure any padding in the header is zeroed. | 194 // make sure any padding in the header is zeroed. |
| 195 memset(header, 0, kHeaderSize); | 195 memset(header, 0, kHeaderSize); |
| 196 | 196 |
| 197 header->fHasGeometryProcessor = optState.hasGeometryProcessor(); | 197 header->fHasGeometryProcessor = optState.hasGeometryProcessor(); |
| 198 | 198 |
| 199 header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType; | |
| 200 | |
| 201 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); | 199 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); |
| 202 if (gpu->caps()->pathRenderingSupport() && isPathRendering) { | 200 if (gpu->caps()->pathRenderingSupport() && isPathRendering) { |
| 203 header->fUseNvpr = true; | 201 header->fUseNvpr = true; |
| 204 SkASSERT(!optState.hasGeometryProcessor()); | 202 SkASSERT(!optState.hasGeometryProcessor()); |
| 205 } else { | 203 } else { |
| 206 header->fUseNvpr = false; | 204 header->fUseNvpr = false; |
| 207 } | 205 } |
| 208 | 206 |
| 209 bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo.fHa
sVertexColor); | 207 bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo.fHa
sVertexColor); |
| 210 | 208 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 251 } |
| 254 | 252 |
| 255 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; | 253 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; |
| 256 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; | 254 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; |
| 257 | 255 |
| 258 header->fColorEffectCnt = optState.numColorStages(); | 256 header->fColorEffectCnt = optState.numColorStages(); |
| 259 header->fCoverageEffectCnt = optState.numCoverageStages(); | 257 header->fCoverageEffectCnt = optState.numCoverageStages(); |
| 260 desc->finalize(); | 258 desc->finalize(); |
| 261 return true; | 259 return true; |
| 262 } | 260 } |
| OLD | NEW |