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 12 matching lines...) Expand all Loading... |
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 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 26 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
27 | 27 |
28 GrGLProgram::GrGLProgram(GrGLGpu* gpu, | 28 GrGLProgram::GrGLProgram(GrGLGpu* gpu, |
29 const GrProgramDesc& desc, | 29 const GrProgramDesc& desc, |
30 const BuiltinUniformHandles& builtinUniforms, | 30 const BuiltinUniformHandles& builtinUniforms, |
31 GrGLuint programID, | 31 GrGLuint programID, |
32 const UniformInfoArray& uniforms, | 32 const UniformInfoArray& uniforms, |
33 const SeparableVaryingInfoArray& separableVaryings, | 33 const VaryingInfoArray& pathProcVaryings, |
34 GrGLInstalledGeoProc* geometryProcessor, | 34 GrGLInstalledGeoProc* geometryProcessor, |
35 GrGLInstalledXferProc* xferProcessor, | 35 GrGLInstalledXferProc* xferProcessor, |
36 GrGLInstalledFragProcs* fragmentProcessors, | 36 GrGLInstalledFragProcs* fragmentProcessors, |
37 SkTArray<UniformHandle>* passSamplerUniforms) | 37 SkTArray<UniformHandle>* passSamplerUniforms) |
38 : fBuiltinUniformHandles(builtinUniforms) | 38 : fBuiltinUniformHandles(builtinUniforms) |
39 , fProgramID(programID) | 39 , fProgramID(programID) |
40 , fGeometryProcessor(geometryProcessor) | 40 , fGeometryProcessor(geometryProcessor) |
41 , fXferProcessor(xferProcessor) | 41 , fXferProcessor(xferProcessor) |
42 , fFragmentProcessors(SkRef(fragmentProcessors)) | 42 , fFragmentProcessors(SkRef(fragmentProcessors)) |
43 , fDesc(desc) | 43 , fDesc(desc) |
44 , fGpu(gpu) | 44 , fGpu(gpu) |
45 , fProgramDataManager(gpu, programID, uniforms, separableVaryings) { | 45 , fProgramDataManager(gpu, programID, uniforms, pathProcVaryings) { |
46 fSamplerUniforms.swap(passSamplerUniforms); | 46 fSamplerUniforms.swap(passSamplerUniforms); |
47 // Assign texture units to sampler uniforms one time up front. | 47 // Assign texture units to sampler uniforms one time up front. |
48 GL_CALL(UseProgram(fProgramID)); | 48 GL_CALL(UseProgram(fProgramID)); |
49 for (int i = 0; i < fSamplerUniforms.count(); i++) { | 49 for (int i = 0; i < fSamplerUniforms.count(); i++) { |
50 fProgramDataManager.setSampler(fSamplerUniforms[i], i); | 50 fProgramDataManager.setSampler(fSamplerUniforms[i], i); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 GrGLProgram::~GrGLProgram() { | 54 GrGLProgram::~GrGLProgram() { |
55 if (fProgramID) { | 55 if (fProgramID) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec); | 140 fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec); |
141 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni,
1, rtAdjustmentVec); | 141 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni,
1, rtAdjustmentVec); |
142 } | 142 } |
143 } else { | 143 } else { |
144 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); | 144 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); |
145 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); | 145 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
146 fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(), | 146 fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(), |
147 size, rt->origin()); | 147 size, rt->origin()); |
148 } | 148 } |
149 } | 149 } |
OLD | NEW |