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 "GrProcessor.h" | 9 #include "GrProcessor.h" |
10 #include "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- | 136 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- |
137 // Because header is a pointer into the dynamic array, we can't push any new
data into the key | 137 // Because header is a pointer into the dynamic array, we can't push any new
data into the key |
138 // below here. | 138 // below here. |
139 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); | 139 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); |
140 | 140 |
141 // make sure any padding in the header is zeroed. | 141 // make sure any padding in the header is zeroed. |
142 memset(header, 0, kHeaderSize); | 142 memset(header, 0, kHeaderSize); |
143 | 143 |
| 144 header->fSwapDstRedAndAlpha = false; |
| 145 if (GrPixelConfigIsAlphaOnly(pipeline.getRenderTarget()->config()) && |
| 146 gpu->glCaps().textureRedSupport()) { |
| 147 header->fSwapDstRedAndAlpha = true; |
| 148 } |
| 149 |
144 if (pipeline.readsFragPosition()) { | 150 if (pipeline.readsFragPosition()) { |
145 header->fFragPosKey = | 151 header->fFragPosKey = |
146 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get
RenderTarget()); | 152 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get
RenderTarget()); |
147 } else { | 153 } else { |
148 header->fFragPosKey = 0; | 154 header->fFragPosKey = 0; |
149 } | 155 } |
150 | 156 |
151 if (pipeline.ignoresCoverage()) { | 157 if (pipeline.ignoresCoverage()) { |
152 header->fIgnoresCoverage = 1; | 158 header->fIgnoresCoverage = 1; |
153 } else { | 159 } else { |
154 header->fIgnoresCoverage = 0; | 160 header->fIgnoresCoverage = 0; |
155 } | 161 } |
156 | 162 |
157 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); | 163 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); |
158 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); | 164 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); |
159 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); | 165 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); |
160 glDesc->finalize(); | 166 glDesc->finalize(); |
161 return true; | 167 return true; |
162 } | 168 } |
OLD | NEW |