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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits 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/builders/GrGLProgramBuilder.h ('k') | tests/GLProgramsTest.cpp » ('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 2014 Google Inc. 2 * Copyright 2014 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 "GrGLProgramBuilder.h" 8 #include "GrGLProgramBuilder.h"
9 #include "gl/GrGLProgram.h" 9 #include "gl/GrGLProgram.h"
10 #include "gl/GrGLSLPrettyPrint.h" 10 #include "gl/GrGLSLPrettyPrint.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const { 188 const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const {
189 return fGpu->ctxInfo(); 189 return fGpu->ctxInfo();
190 } 190 }
191 191
192 void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr 4* inputCoverage) { 192 void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr 4* inputCoverage) {
193 // First we loop over all of the installed processors and collect coord tran sforms. These will 193 // First we loop over all of the installed processors and collect coord tran sforms. These will
194 // be sent to the GrGLPrimitiveProcessor in its emitCode function 194 // be sent to the GrGLPrimitiveProcessor in its emitCode function
195 SkSTArray<8, GrGLProcessor::TransformedCoordsArray> outCoords; 195 SkSTArray<8, GrGLProcessor::TransformedCoordsArray> outCoords;
196 for (int i = 0; i < this->optState().numFragmentStages(); i++) { 196 for (int i = 0; i < this->pipeline().numFragmentStages(); i++) {
197 const GrFragmentProcessor* processor = this->optState().getFragmentStage (i).processor(); 197 const GrFragmentProcessor* processor = this->pipeline().getFragmentStage (i).processor();
198 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransfor ms.push_back(); 198 SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransfor ms.push_back();
199 for (int t = 0; t < processor->numTransforms(); t++) { 199 for (int t = 0; t < processor->numTransforms(); t++) {
200 procCoords.push_back(&processor->coordTransform(t)); 200 procCoords.push_back(&processor->coordTransform(t));
201 } 201 }
202 } 202 }
203 203
204 const GrPrimitiveProcessor& primProc = this->primitiveProcessor(); 204 const GrPrimitiveProcessor& primProc = this->primitiveProcessor();
205 this->emitAndInstallProc(primProc, inputColor, inputCoverage); 205 this->emitAndInstallProc(primProc, inputColor, inputCoverage);
206 206
207 fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs)); 207 fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));
208 int numProcs = this->optState().numFragmentStages(); 208 int numProcs = this->pipeline().numFragmentStages();
209 this->emitAndInstallFragProcs(0, this->optState().numColorStages(), inputCol or); 209 this->emitAndInstallFragProcs(0, this->pipeline().numColorStages(), inputCol or);
210 this->emitAndInstallFragProcs(this->optState().numColorStages(), numProcs, inputCoverage); 210 this->emitAndInstallFragProcs(this->pipeline().numColorStages(), numProcs, inputCoverage);
211 this->emitAndInstallXferProc(*this->optState().getXferProcessor(), *inputCol or, *inputCoverage); 211 this->emitAndInstallXferProc(*this->pipeline().getXferProcessor(), *inputCol or, *inputCoverage);
212 } 212 }
213 213
214 void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, 214 void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset,
215 int numProcs, 215 int numProcs,
216 GrGLSLExpr4* inOut) { 216 GrGLSLExpr4* inOut) {
217 for (int e = procOffset; e < numProcs; ++e) { 217 for (int e = procOffset; e < numProcs; ++e) {
218 GrGLSLExpr4 output; 218 GrGLSLExpr4 output;
219 const GrPendingFragmentStage& stage = this->optState().getFragmentStage( e); 219 const GrPendingFragmentStage& stage = this->pipeline().getFragmentStage( e);
220 this->emitAndInstallProc(stage, e, *inOut, &output); 220 this->emitAndInstallProc(stage, e, *inOut, &output);
221 *inOut = output; 221 *inOut = output;
222 } 222 }
223 } 223 }
224 224
225 void GrGLProgramBuilder::nameExpression(GrGLSLExpr4* output, const char* baseNam e) { 225 void GrGLProgramBuilder::nameExpression(GrGLSLExpr4* output, const char* baseNam e) {
226 // create var to hold stage result. If we already have a valid output name, just use that 226 // create var to hold stage result. If we already have a valid output name, just use that
227 // otherwise create a new mangled one. This name is only valid if we are re ordering stages 227 // otherwise create a new mangled one. This name is only valid if we are re ordering stages
228 // and have to tell stage exactly where to put its output. 228 // and have to tell stage exactly where to put its output.
229 SkString outName; 229 SkString outName;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 496
497 //////////////////////////////////////////////////////////////////////////////// /////////////////// 497 //////////////////////////////////////////////////////////////////////////////// ///////////////////
498 498
499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 499 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
500 int numProcs = fProcs.count(); 500 int numProcs = fProcs.count();
501 for (int e = 0; e < numProcs; ++e) { 501 for (int e = 0; e < numProcs; ++e) {
502 SkDELETE(fProcs[e]); 502 SkDELETE(fProcs[e]);
503 } 503 }
504 } 504 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698