Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/gpu/gl/GrGLProgram.cpp

Issue 864853002: remove drawType from optState (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleaning Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 this->bindTextures(fGeometryProcessor.get(), primProc); 135 this->bindTextures(fGeometryProcessor.get(), primProc);
136 136
137 if (fXferProcessor.get()) { 137 if (fXferProcessor.get()) {
138 const GrXferProcessor& xp = *optState.getXferProcessor(); 138 const GrXferProcessor& xp = *optState.getXferProcessor();
139 fXferProcessor->fGLProc->setData(fProgramDataManager, xp); 139 fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
140 this->bindTextures(fXferProcessor.get(), xp); 140 this->bindTextures(fXferProcessor.get(), xp);
141 } 141 }
142 this->setFragmentData(primProc, optState); 142 this->setFragmentData(primProc, optState);
143 143
144 // Some of GrGLProgram subclasses need to update state here 144 // Some of GrGLProgram subclasses need to update state here
145 this->didSetData(optState.drawType()); 145 this->didSetData();
146 } 146 }
147 147
148 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, 148 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
149 const GrOptDrawState& optState) { 149 const GrOptDrawState& optState) {
150 int numProcessors = fFragmentProcessors->fProcs.count(); 150 int numProcessors = fFragmentProcessors->fProcs.count();
151 for (int e = 0; e < numProcessors; ++e) { 151 for (int e = 0; e < numProcessors; ++e) {
152 const GrPendingFragmentStage& stage = optState.getFragmentStage(e); 152 const GrPendingFragmentStage& stage = optState.getFragmentStage(e);
153 const GrProcessor& processor = *stage.processor(); 153 const GrProcessor& processor = *stage.processor();
154 fFragmentProcessors->fProcs[e]->fGLProc->setData(fProgramDataManager, pr ocessor); 154 fFragmentProcessors->fProcs[e]->fGLProc->setData(fProgramDataManager, pr ocessor);
155 this->setTransformData(primProc, 155 this->setTransformData(primProc,
156 stage, 156 stage,
157 e, 157 e,
158 fFragmentProcessors->fProcs[e]); 158 fFragmentProcessors->fProcs[e]);
159 this->bindTextures(fFragmentProcessors->fProcs[e], processor); 159 this->bindTextures(fFragmentProcessors->fProcs[e], processor);
160 } 160 }
161 } 161 }
162 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, 162 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc,
163 const GrPendingFragmentStage& processor, 163 const GrPendingFragmentStage& processor,
164 int index, 164 int index,
165 GrGLInstalledFragProc* ip) { 165 GrGLInstalledFragProc* ip) {
166 GrGLGeometryProcessor* gp = 166 GrGLGeometryProcessor* gp =
167 static_cast<GrGLGeometryProcessor*>(fGeometryProcessor.get()->fGLPro c.get()); 167 static_cast<GrGLGeometryProcessor*>(fGeometryProcessor.get()->fGLPro c.get());
168 gp->setTransformData(primProc, fProgramDataManager, index, 168 gp->setTransformData(primProc, fProgramDataManager, index,
169 processor.processor()->coordTransforms()); 169 processor.processor()->coordTransforms());
170 } 170 }
171 171
172 void GrGLProgram::didSetData(GrGpu::DrawType drawType) {
173 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType));
174 }
175
176 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, 172 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
177 const GrOptDrawState& optState) { 173 const GrOptDrawState& optState) {
178 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. 174 // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
179 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && 175 if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
180 fRenderTargetState.fRenderTargetSize.fHeight != optState.getRenderTarget ()->height()) { 176 fRenderTargetState.fRenderTargetSize.fHeight != optState.getRenderTarget ()->height()) {
181 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, 177 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
182 SkIntToScalar(optState.getRenderTarget()->hei ght())); 178 SkIntToScalar(optState.getRenderTarget()->hei ght()));
183 } 179 }
184 180
185 // call subclasses to set the actual view matrix 181 // call subclasses to set the actual view matrix
(...skipping 22 matching lines...) Expand all
208 const GrProgramDesc& desc, 204 const GrProgramDesc& desc,
209 const BuiltinUniformHandles& builtinUniforms, 205 const BuiltinUniformHandles& builtinUniforms,
210 GrGLuint programID, 206 GrGLuint programID,
211 const UniformInfoArray& uniforms, 207 const UniformInfoArray& uniforms,
212 GrGLInstalledGeoProc* primProc, 208 GrGLInstalledGeoProc* primProc,
213 GrGLInstalledXferProc* xferProcessor, 209 GrGLInstalledXferProc* xferProcessor,
214 GrGLInstalledFragProcs* fragmentProcessors) 210 GrGLInstalledFragProcs* fragmentProcessors)
215 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, 211 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc,
216 xferProcessor, fragmentProcessors) { 212 xferProcessor, fragmentProcessors) {
217 } 213 }
218 void GrGLNvprProgram::didSetData(GrGpu::DrawType drawType) { 214 void GrGLNvprProgram::didSetData() {
219 SkASSERT(GrGpu::IsPathRenderingDrawType(drawType));
220 GrGLPathProcessor* pathProc = 215 GrGLPathProcessor* pathProc =
221 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t()); 216 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t());
222 pathProc->didSetData(fGpu->glPathRendering()); 217 pathProc->didSetData(fGpu->glPathRendering());
223 } 218 }
224 219
225 void GrGLNvprProgram::setTransformData(const GrPrimitiveProcessor& primProc, 220 void GrGLNvprProgram::setTransformData(const GrPrimitiveProcessor& primProc,
226 const GrPendingFragmentStage& proc, 221 const GrPendingFragmentStage& proc,
227 int index, 222 int index,
228 GrGLInstalledFragProc* ip) { 223 GrGLInstalledFragProc* ip) {
229 GrGLPathProcessor* pathProc = 224 GrGLPathProcessor* pathProc =
230 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t()); 225 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t());
231 pathProc->setTransformData(primProc, index, proc.processor()->coordTransform s(), 226 pathProc->setTransformData(primProc, index, proc.processor()->coordTransform s(),
232 fGpu->glPathRendering(), fProgramID); 227 fGpu->glPathRendering(), fProgramID);
233 } 228 }
234 229
235 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c, 230 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c,
236 const GrOptDrawState& optState) { 231 const GrOptDrawState& optState) {
237 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType()) && 232 SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0);
238 !primProc.willUseGeoShader() && primProc.numAttribs() == 0);
239 const GrRenderTarget* rt = optState.getRenderTarget(); 233 const GrRenderTarget* rt = optState.getRenderTarget();
240 SkISize size; 234 SkISize size;
241 size.set(rt->width(), rt->height()); 235 size.set(rt->width(), rt->height());
242 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(), 236 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(),
243 size, rt->origin()); 237 size, rt->origin());
244 } 238 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698