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