OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
9 | 9 |
10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 fColorEffects->setData(fGpu, fProgramDataManager, colorStages); | 149 fColorEffects->setData(fGpu, fProgramDataManager, colorStages); |
150 fCoverageEffects->setData(fGpu, fProgramDataManager, coverageStages); | 150 fCoverageEffects->setData(fGpu, fProgramDataManager, coverageStages); |
151 | 151 |
152 | 152 |
153 // PathTexGen state applies to the the fixed function vertex shader. For | 153 // PathTexGen state applies to the the fixed function vertex shader. For |
154 // custom shaders, it's ignored, so we don't need to change the texgen | 154 // custom shaders, it's ignored, so we don't need to change the texgen |
155 // settings in that case. | 155 // settings in that case. |
156 if (!fHasVertexShader) { | 156 if (!fHasVertexShader) { |
157 fGpu->flushPathTexGenSettings(fTexCoordSetCnt); | 157 fGpu->glPathRendering()->flushPathTexGenSettings(fTexCoordSetCnt); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void GrGLProgram::setColor(const GrDrawState& drawState, | 161 void GrGLProgram::setColor(const GrDrawState& drawState, |
162 GrColor color, | 162 GrColor color, |
163 SharedGLState* sharedState) { | 163 SharedGLState* sharedState) { |
164 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 164 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
165 if (!drawState.hasColorVertexAttribute() || drawState.canIgnoreColorAttribut
e()) { | 165 if (!drawState.hasColorVertexAttribute() || drawState.canIgnoreColorAttribut
e()) { |
166 switch (header.fColorInput) { | 166 switch (header.fColorInput) { |
167 case GrGLProgramDesc::kAttribute_ColorInput: | 167 case GrGLProgramDesc::kAttribute_ColorInput: |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. | 240 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. |
241 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && | 241 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && |
242 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) { | 242 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) { |
243 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, | 243 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, |
244 SkIntToScalar(size.fHeight)); | 244 SkIntToScalar(size.fHeight)); |
245 } | 245 } |
246 | 246 |
247 if (!fHasVertexShader) { | 247 if (!fHasVertexShader) { |
248 SkASSERT(!fBuiltinUniformHandles.fViewMatrixUni.isValid()); | 248 SkASSERT(!fBuiltinUniformHandles.fViewMatrixUni.isValid()); |
249 SkASSERT(!fBuiltinUniformHandles.fRTAdjustmentUni.isValid()); | 249 SkASSERT(!fBuiltinUniformHandles.fRTAdjustmentUni.isValid()); |
250 fGpu->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin())
; | 250 fGpu->glPathRendering()->setProjectionMatrix(drawState.getViewMatrix(),
size, rt->origin()); |
251 } else if (fMatrixState.fRenderTargetOrigin != rt->origin() || | 251 } else if (fMatrixState.fRenderTargetOrigin != rt->origin() || |
252 fMatrixState.fRenderTargetSize != size || | 252 fMatrixState.fRenderTargetSize != size || |
253 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix())
) { | 253 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix())
) { |
254 SkASSERT(fBuiltinUniformHandles.fViewMatrixUni.isValid()); | 254 SkASSERT(fBuiltinUniformHandles.fViewMatrixUni.isValid()); |
255 | 255 |
256 fMatrixState.fViewMatrix = drawState.getViewMatrix(); | 256 fMatrixState.fViewMatrix = drawState.getViewMatrix(); |
257 fMatrixState.fRenderTargetSize = size; | 257 fMatrixState.fRenderTargetSize = size; |
258 fMatrixState.fRenderTargetOrigin = rt->origin(); | 258 fMatrixState.fRenderTargetOrigin = rt->origin(); |
259 | 259 |
260 GrGLfloat viewMatrix[3 * 3]; | 260 GrGLfloat viewMatrix[3 * 3]; |
261 fMatrixState.getGLMatrix<3>(viewMatrix); | 261 fMatrixState.getGLMatrix<3>(viewMatrix); |
262 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); | 262 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); |
263 | 263 |
264 GrGLfloat rtAdjustmentVec[4]; | 264 GrGLfloat rtAdjustmentVec[4]; |
265 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 265 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
266 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); | 266 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); |
267 } | 267 } |
268 } | 268 } |
OLD | NEW |