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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 append_texture_bindings(fXferProcessor.get(), xp, textureBindings); | 98 append_texture_bindings(fXferProcessor.get(), xp, textureBindings); |
99 | 99 |
100 // Some of GrGLProgram subclasses need to update state here | 100 // Some of GrGLProgram subclasses need to update state here |
101 this->didSetData(); | 101 this->didSetData(); |
102 } | 102 } |
103 | 103 |
104 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, | 104 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, |
105 const GrPipeline& pipeline, | 105 const GrPipeline& pipeline, |
106 SkTArray<const GrTextureAccess*>* textureBindi
ngs) { | 106 SkTArray<const GrTextureAccess*>* textureBindi
ngs) { |
107 int numProcessors = fFragmentProcessors->fProcs.count(); | 107 int numProcessors = fFragmentProcessors->fProcs.count(); |
108 for (int e = 0; e < numProcessors; ++e) { | 108 for (int i = 0; i < numProcessors; ++i) { |
109 const GrPendingFragmentStage& stage = pipeline.getFragmentStage(e); | 109 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); |
110 const GrFragmentProcessor& processor = *stage.processor(); | 110 fFragmentProcessors->fProcs[i]->fGLProc->setData(fProgramDataManager, pr
ocessor); |
111 fFragmentProcessors->fProcs[e]->fGLProc->setData(fProgramDataManager, pr
ocessor); | |
112 this->setTransformData(primProc, | 111 this->setTransformData(primProc, |
113 stage, | 112 processor, |
114 e, | 113 i, |
115 fFragmentProcessors->fProcs[e]); | 114 fFragmentProcessors->fProcs[i]); |
116 append_texture_bindings(fFragmentProcessors->fProcs[e], processor, textu
reBindings); | 115 append_texture_bindings(fFragmentProcessors->fProcs[i], processor, textu
reBindings); |
117 } | 116 } |
118 } | 117 } |
119 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, | 118 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, |
120 const GrPendingFragmentStage& processor, | 119 const GrFragmentProcessor& processor, |
121 int index, | 120 int index, |
122 GrGLInstalledFragProc* ip) { | 121 GrGLInstalledFragProc* ip) { |
123 GrGLGeometryProcessor* gp = | 122 GrGLGeometryProcessor* gp = |
124 static_cast<GrGLGeometryProcessor*>(fGeometryProcessor.get()->fGLPro
c.get()); | 123 static_cast<GrGLGeometryProcessor*>(fGeometryProcessor.get()->fGLPro
c.get()); |
125 gp->setTransformData(primProc, fProgramDataManager, index, | 124 gp->setTransformData(primProc, fProgramDataManager, index, |
126 processor.processor()->coordTransforms()); | 125 processor.coordTransforms()); |
127 } | 126 } |
128 | 127 |
129 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, | 128 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, |
130 const GrPipeline& pipeline) { | 129 const GrPipeline& pipeline) { |
131 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. | 130 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. |
132 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && | 131 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && |
133 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget
()->height()) { | 132 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget
()->height()) { |
134 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, | 133 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, |
135 SkIntToScalar(pipeline.getRenderTarget()->hei
ght())); | 134 SkIntToScalar(pipeline.getRenderTarget()->hei
ght())); |
136 } | 135 } |
(...skipping 11 matching lines...) Expand all Loading... |
148 fRenderTargetState.fRenderTargetSize != size) { | 147 fRenderTargetState.fRenderTargetSize != size) { |
149 fRenderTargetState.fRenderTargetSize = size; | 148 fRenderTargetState.fRenderTargetSize = size; |
150 fRenderTargetState.fRenderTargetOrigin = rt->origin(); | 149 fRenderTargetState.fRenderTargetOrigin = rt->origin(); |
151 | 150 |
152 GrGLfloat rtAdjustmentVec[4]; | 151 GrGLfloat rtAdjustmentVec[4]; |
153 fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec); | 152 fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec); |
154 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); | 153 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); |
155 } | 154 } |
156 } | 155 } |
157 | 156 |
OLD | NEW |