| 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 30 matching lines...) Expand all Loading... |
| 41 : fProgramID(builderOutput.fProgramID) | 41 : fProgramID(builderOutput.fProgramID) |
| 42 , fColor(GrColor_ILLEGAL) | 42 , fColor(GrColor_ILLEGAL) |
| 43 , fCoverage(GrColor_ILLEGAL) | 43 , fCoverage(GrColor_ILLEGAL) |
| 44 , fDstCopyTexUnit(-1) | 44 , fDstCopyTexUnit(-1) |
| 45 , fColorEffects(builderOutput.fColorEffects) | 45 , fColorEffects(builderOutput.fColorEffects) |
| 46 , fCoverageEffects(builderOutput.fCoverageEffects) | 46 , fCoverageEffects(builderOutput.fCoverageEffects) |
| 47 , fDesc(desc) | 47 , fDesc(desc) |
| 48 , fGpu(gpu) | 48 , fGpu(gpu) |
| 49 , fUniformManager(SkRef(uman)) | 49 , fUniformManager(SkRef(uman)) |
| 50 , fUniformHandles(builderOutput.fUniformHandles) | 50 , fUniformHandles(builderOutput.fUniformHandles) |
| 51 , fHasVertexShader(builderOutput.fHasVS) | 51 , fHasVertexShader(builderOutput.fHasVertexShader) |
| 52 , fNumTexCoordSets(builderOutput.fNumTexCoordSets) { | 52 , fTexCoordSetCnt(builderOutput.fTexCoordSetCnt) { |
| 53 this->initSamplerUniforms(); | 53 this->initSamplerUniforms(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 GrGLProgram::~GrGLProgram() { | 56 GrGLProgram::~GrGLProgram() { |
| 57 if (fProgramID) { | 57 if (fProgramID) { |
| 58 GL_CALL(DeleteProgram(fProgramID)); | 58 GL_CALL(DeleteProgram(fProgramID)); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void GrGLProgram::abandon() { | 62 void GrGLProgram::abandon() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 fColorEffects->setData(fGpu, *fUniformManager, colorStages); | 146 fColorEffects->setData(fGpu, *fUniformManager, colorStages); |
| 147 fCoverageEffects->setData(fGpu, *fUniformManager, coverageStages); | 147 fCoverageEffects->setData(fGpu, *fUniformManager, coverageStages); |
| 148 | 148 |
| 149 | 149 |
| 150 // PathTexGen state applies to the the fixed function vertex shader. For | 150 // PathTexGen state applies to the the fixed function vertex shader. For |
| 151 // custom shaders, it's ignored, so we don't need to change the texgen | 151 // custom shaders, it's ignored, so we don't need to change the texgen |
| 152 // settings in that case. | 152 // settings in that case. |
| 153 if (!fHasVertexShader) { | 153 if (!fHasVertexShader) { |
| 154 fGpu->flushPathTexGenSettings(fNumTexCoordSets); | 154 fGpu->flushPathTexGenSettings(fTexCoordSetCnt); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void GrGLProgram::setColor(const GrDrawState& drawState, | 158 void GrGLProgram::setColor(const GrDrawState& drawState, |
| 159 GrColor color, | 159 GrColor color, |
| 160 SharedGLState* sharedState) { | 160 SharedGLState* sharedState) { |
| 161 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 161 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
| 162 if (!drawState.hasColorVertexAttribute()) { | 162 if (!drawState.hasColorVertexAttribute()) { |
| 163 switch (header.fColorInput) { | 163 switch (header.fColorInput) { |
| 164 case GrGLProgramDesc::kAttribute_ColorInput: | 164 case GrGLProgramDesc::kAttribute_ColorInput: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 GrGLfloat viewMatrix[3 * 3]; | 261 GrGLfloat viewMatrix[3 * 3]; |
| 262 fMatrixState.getGLMatrix<3>(viewMatrix); | 262 fMatrixState.getGLMatrix<3>(viewMatrix); |
| 263 fUniformManager->setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix)
; | 263 fUniformManager->setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix)
; |
| 264 | 264 |
| 265 GrGLfloat rtAdjustmentVec[4]; | 265 GrGLfloat rtAdjustmentVec[4]; |
| 266 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 266 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
| 267 fUniformManager->set4fv(fUniformHandles.fRTAdjustmentUni, 1, rtAdjustmen
tVec); | 267 fUniformManager->set4fv(fUniformHandles.fRTAdjustmentUni, 1, rtAdjustmen
tVec); |
| 268 } | 268 } |
| 269 } | 269 } |
| OLD | NEW |