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

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: 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 fGpu->bindTexture(samplers[s].fTextureUnit, 97 fGpu->bindTexture(samplers[s].fTextureUnit,
98 textureAccess.getParams(), 98 textureAccess.getParams(),
99 static_cast<GrGLTexture*>(textureAccess.getTexture())) ; 99 static_cast<GrGLTexture*>(textureAccess.getTexture())) ;
100 } 100 }
101 } 101 }
102 102
103 103
104 /////////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////////
105 105
106 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrOptDrawS tate& optState, 106 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrOptDrawS tate& optState,
107 const GrBatchTracker& batchTracker) { 107 const GrBatchTracker& batchTracker, GrGpu::DrawType dr awtype) {
108 this->setRenderTargetState(primProc, optState); 108 this->setRenderTargetState(primProc, optState);
109 109
110 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); 110 const GrDeviceCoordTexture* dstCopy = optState.getDstCopy();
111 if (dstCopy) { 111 if (dstCopy) {
112 if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) { 112 if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
113 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni, 113 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
114 static_cast<GrGLfloat>(dstCopy->offset(). fX), 114 static_cast<GrGLfloat>(dstCopy->offset(). fX),
115 static_cast<GrGLfloat>(dstCopy->offset(). fY)); 115 static_cast<GrGLfloat>(dstCopy->offset(). fY));
116 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni, 116 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni,
117 1.f / dstCopy->texture()->width(), 117 1.f / dstCopy->texture()->width(),
(...skipping 17 matching lines...) Expand all
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(drawtype);
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,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 int index, 227 int index,
228 GrGLInstalledFragProc* ip) { 228 GrGLInstalledFragProc* ip) {
229 GrGLPathProcessor* pathProc = 229 GrGLPathProcessor* pathProc =
230 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t()); 230 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge t());
231 pathProc->setTransformData(primProc, index, proc.processor()->coordTransform s(), 231 pathProc->setTransformData(primProc, index, proc.processor()->coordTransform s(),
232 fGpu->glPathRendering(), fProgramID); 232 fGpu->glPathRendering(), fProgramID);
233 } 233 }
234 234
235 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c, 235 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c,
236 const GrOptDrawState& optState) { 236 const GrOptDrawState& optState) {
237 SkASSERT(GrGpu::IsPathRenderingDrawType(optState.drawType()) && 237 SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0);
238 !primProc.willUseGeoShader() && primProc.numAttribs() == 0);
239 const GrRenderTarget* rt = optState.getRenderTarget(); 238 const GrRenderTarget* rt = optState.getRenderTarget();
240 SkISize size; 239 SkISize size;
241 size.set(rt->width(), rt->height()); 240 size.set(rt->width(), rt->height());
242 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(), 241 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(),
243 size, rt->origin()); 242 size, rt->origin());
244 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698