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" |
11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
12 #include "GrCoordTransform.h" | 12 #include "GrCoordTransform.h" |
13 #include "GrGLGeometryProcessor.h" | |
14 #include "GrGLGpu.h" | 13 #include "GrGLGpu.h" |
15 #include "GrGLPathRendering.h" | 14 #include "GrGLPathRendering.h" |
16 #include "GrPathProcessor.h" | 15 #include "GrPathProcessor.h" |
17 #include "GrPipeline.h" | 16 #include "GrPipeline.h" |
18 #include "GrXferProcessor.h" | 17 #include "GrXferProcessor.h" |
19 #include "glsl/GrGLSLFragmentProcessor.h" | 18 #include "glsl/GrGLSLFragmentProcessor.h" |
| 19 #include "glsl/GrGLSLGeometryProcessor.h" |
20 #include "glsl/GrGLSLXferProcessor.h" | 20 #include "glsl/GrGLSLXferProcessor.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 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 26 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
27 | 27 |
28 GrGLProgram::GrGLProgram(GrGLGpu* gpu, | 28 GrGLProgram::GrGLProgram(GrGLGpu* gpu, |
29 const GrProgramDesc& desc, | 29 const GrProgramDesc& desc, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 processor, | 105 processor, |
106 i, | 106 i, |
107 fFragmentProcessors->fProcs[i]); | 107 fFragmentProcessors->fProcs[i]); |
108 append_texture_bindings(fFragmentProcessors->fProcs[i], processor, textu
reBindings); | 108 append_texture_bindings(fFragmentProcessors->fProcs[i], processor, textu
reBindings); |
109 } | 109 } |
110 } | 110 } |
111 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, | 111 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, |
112 const GrFragmentProcessor& processor, | 112 const GrFragmentProcessor& processor, |
113 int index, | 113 int index, |
114 GrGLInstalledFragProc* ip) { | 114 GrGLInstalledFragProc* ip) { |
115 GrGLPrimitiveProcessor* gp = fGeometryProcessor.get()->fGLProc.get(); | 115 GrGLSLPrimitiveProcessor* gp = fGeometryProcessor.get()->fGLProc.get(); |
116 gp->setTransformData(primProc, fProgramDataManager, index, | 116 gp->setTransformData(primProc, fProgramDataManager, index, |
117 processor.coordTransforms()); | 117 processor.coordTransforms()); |
118 } | 118 } |
119 | 119 |
120 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, | 120 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, |
121 const GrPipeline& pipeline) { | 121 const GrPipeline& pipeline) { |
122 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. | 122 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. |
123 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && | 123 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && |
124 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget
()->height()) { | 124 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget
()->height()) { |
125 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, | 125 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, |
(...skipping 14 matching lines...) Expand all 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 |