| 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 "builders/GrGLFullProgramBuilder.h" | 10 #include "builders/GrGLFullProgramBuilder.h" |
| 11 #include "builders/GrGLFragmentOnlyProgramBuilder.h" | 11 #include "builders/GrGLFragmentOnlyProgramBuilder.h" |
| 12 #include "GrAllocator.h" | 12 #include "GrAllocator.h" |
| 13 #include "GrProcessor.h" | 13 #include "GrProcessor.h" |
| 14 #include "GrCoordTransform.h" | 14 #include "GrCoordTransform.h" |
| 15 #include "GrGLProcessor.h" | 15 #include "GrGLProcessor.h" |
| 16 #include "GrGpuGL.h" | 16 #include "GrGpuGL.h" |
| 17 #include "GrGLPathRendering.h" | 17 #include "GrGLPathRendering.h" |
| 18 #include "GrGLShaderVar.h" | 18 #include "GrGLShaderVar.h" |
| 19 #include "GrGLSL.h" | 19 #include "GrGLSL.h" |
| 20 #include "GrOptDrawState.h" | 20 #include "GrOptDrawState.h" |
| 21 #include "SkXfermode.h" | 21 #include "SkXfermode.h" |
| 22 | 22 |
| 23 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) | 23 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) |
| 24 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) | 24 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) |
| 25 | 25 |
| 26 GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu, | 26 GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu, |
| 27 const GrOptDrawState& optState, |
| 27 const GrGLProgramDesc& desc, | 28 const GrGLProgramDesc& desc, |
| 28 const GrGeometryStage* geometryProcessor, | 29 const GrGeometryStage* geometryProcessor, |
| 29 const GrFragmentStage* colorStages[], | 30 const GrFragmentStage* colorStages[], |
| 30 const GrFragmentStage* coverageStages[]) { | 31 const GrFragmentStage* coverageStages[]) { |
| 31 SkAutoTDelete<GrGLProgramBuilder> builder; | 32 SkAutoTDelete<GrGLProgramBuilder> builder; |
| 32 if (desc.getHeader().fUseFragShaderOnly) { | 33 if (desc.getHeader().fUseFragShaderOnly) { |
| 33 SkASSERT(gpu->glCaps().pathRenderingSupport()); | 34 SkASSERT(gpu->glCaps().pathRenderingSupport()); |
| 34 SkASSERT(gpu->glPathRendering()->texturingMode() == | 35 SkASSERT(gpu->glPathRendering()->texturingMode() == |
| 35 GrGLPathRendering::FixedFunction_TexturingMode); | 36 GrGLPathRendering::FixedFunction_TexturingMode); |
| 36 SkASSERT(NULL == geometryProcessor); | 37 SkASSERT(NULL == geometryProcessor); |
| 37 builder.reset(SkNEW_ARGS(GrGLFragmentOnlyProgramBuilder, (gpu, desc))); | 38 builder.reset(SkNEW_ARGS(GrGLFragmentOnlyProgramBuilder, (gpu, optState,
desc))); |
| 38 } else { | 39 } else { |
| 39 builder.reset(SkNEW_ARGS(GrGLFullProgramBuilder, (gpu, desc))); | 40 builder.reset(SkNEW_ARGS(GrGLFullProgramBuilder, (gpu, optState, desc)))
; |
| 40 } | 41 } |
| 41 if (builder->genProgram(geometryProcessor, colorStages, coverageStages)) { | 42 if (builder->genProgram(geometryProcessor, colorStages, coverageStages)) { |
| 42 SkASSERT(0 != builder->getProgramID()); | 43 SkASSERT(0 != builder->getProgramID()); |
| 43 return SkNEW_ARGS(GrGLProgram, (gpu, desc, *builder)); | 44 return SkNEW_ARGS(GrGLProgram, (gpu, desc, *builder)); |
| 44 } | 45 } |
| 45 return NULL; | 46 return NULL; |
| 46 } | 47 } |
| 47 | 48 |
| 48 GrGLProgram::GrGLProgram(GrGpuGL* gpu, | 49 GrGLProgram::GrGLProgram(GrGpuGL* gpu, |
| 49 const GrGLProgramDesc& desc, | 50 const GrGLProgramDesc& desc, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 244 |
| 244 GrGLfloat viewMatrix[3 * 3]; | 245 GrGLfloat viewMatrix[3 * 3]; |
| 245 fMatrixState.getGLMatrix<3>(viewMatrix); | 246 fMatrixState.getGLMatrix<3>(viewMatrix); |
| 246 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); | 247 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); |
| 247 | 248 |
| 248 GrGLfloat rtAdjustmentVec[4]; | 249 GrGLfloat rtAdjustmentVec[4]; |
| 249 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 250 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
| 250 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); | 251 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); |
| 251 } | 252 } |
| 252 } | 253 } |
| OLD | NEW |