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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 | 205 |
206 } | 206 } |
207 | 207 |
208 bool GrGLProgram::genProgram(const GrEffectStage* colorStages[], | 208 bool GrGLProgram::genProgram(const GrEffectStage* colorStages[], |
209 const GrEffectStage* coverageStages[]) { | 209 const GrEffectStage* coverageStages[]) { |
210 SkASSERT(0 == fProgramID); | 210 SkASSERT(0 == fProgramID); |
211 | 211 |
212 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 212 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
213 | 213 |
214 bool needsVertexShader = true; | 214 GrGLFullShaderBuilder builder(fGpu, fUniformManager, fDesc); |
215 | 215 fUniformHandles.fViewMatrixUni = builder.getViewMatrixUniform(); |
216 GrGLShaderBuilder builder(fGpu, fUniformManager, fDesc, needsVertexShader); | |
217 if (GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder.getVertexBuild
er()) { | |
218 fUniformHandles.fViewMatrixUni = vertexBuilder->getViewMatrixUniform(); | |
219 } | |
220 | 216 |
221 // incoming color to current stage being processed. | 217 // incoming color to current stage being processed. |
222 SkString inColor = builder.getInputColor(); | 218 SkString inColor = builder.getInputColor(); |
223 GrSLConstantVec knownColorValue = builder.getKnownColorValue(); | 219 GrSLConstantVec knownColorValue = builder.getKnownColorValue(); |
224 | 220 |
225 // Get the coeffs for the Mode-based color filter, determine if color is nee
ded. | 221 // Get the coeffs for the Mode-based color filter, determine if color is nee
ded. |
226 SkXfermode::Coeff colorCoeff; | 222 SkXfermode::Coeff colorCoeff; |
227 SkXfermode::Coeff filterColorCoeff; | 223 SkXfermode::Coeff filterColorCoeff; |
228 SkAssertResult( | 224 SkAssertResult( |
229 SkXfermode::ModeAsCoeff(header.fColorFilterXfermode, | 225 SkXfermode::ModeAsCoeff(header.fColorFilterXfermode, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 543 |
548 fMatrixState.fViewMatrix = drawState.getViewMatrix(); | 544 fMatrixState.fViewMatrix = drawState.getViewMatrix(); |
549 fMatrixState.fRenderTargetSize = size; | 545 fMatrixState.fRenderTargetSize = size; |
550 fMatrixState.fRenderTargetOrigin = rt->origin(); | 546 fMatrixState.fRenderTargetOrigin = rt->origin(); |
551 | 547 |
552 GrGLfloat viewMatrix[3 * 3]; | 548 GrGLfloat viewMatrix[3 * 3]; |
553 fMatrixState.getGLMatrix<3>(viewMatrix); | 549 fMatrixState.getGLMatrix<3>(viewMatrix); |
554 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix); | 550 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix); |
555 } | 551 } |
556 } | 552 } |
OLD | NEW |