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

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

Issue 1116713002: Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up some comments Created 5 years, 7 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/GrGLFragmentShaderBuilder.cpp ('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 9
10 #include "gl/GrGLGeometryProcessor.h" 10 #include "gl/GrGLGeometryProcessor.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 GrGLSLExpr4 inputCoverage; 68 GrGLSLExpr4 inputCoverage;
69 69
70 pb->emitAndInstallProcs(&inputColor, &inputCoverage); 70 pb->emitAndInstallProcs(&inputColor, &inputCoverage);
71 71
72 return pb->finalize(); 72 return pb->finalize();
73 } 73 }
74 74
75 GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const DrawArgs& arg s, 75 GrGLProgramBuilder* GrGLProgramBuilder::CreateProgramBuilder(const DrawArgs& arg s,
76 GrGLGpu* gpu) { 76 GrGLGpu* gpu) {
77 if (args.fPrimitiveProcessor->isPathRendering()) { 77 if (args.fPrimitiveProcessor->isPathRendering()) {
78 SkASSERT(gpu->glCaps().pathRenderingSupport() && 78 SkASSERT(gpu->glCaps().shaderCaps()->pathRenderingSupport() &&
79 !args.fPrimitiveProcessor->willUseGeoShader() && 79 !args.fPrimitiveProcessor->willUseGeoShader() &&
80 args.fPrimitiveProcessor->numAttribs() == 0); 80 args.fPrimitiveProcessor->numAttribs() == 0);
81 return SkNEW_ARGS(GrGLNvprProgramBuilder, (gpu, args)); 81 return SkNEW_ARGS(GrGLNvprProgramBuilder, (gpu, args));
82 } else { 82 } else {
83 return SkNEW_ARGS(GrGLProgramBuilder, (gpu, args)); 83 return SkNEW_ARGS(GrGLProgramBuilder, (gpu, args));
84 } 84 }
85 } 85 }
86 86
87 ///////////////////////////////////////////////////////////////////////////// 87 /////////////////////////////////////////////////////////////////////////////
88 88
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 fFragmentProcessors->fProcs.push_back(ifp); 295 fFragmentProcessors->fProcs.push_back(ifp);
296 } 296 }
297 297
298 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp, 298 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp,
299 const char* outColor, 299 const char* outColor,
300 const char* outCoverage) { 300 const char* outCoverage) {
301 SkASSERT(!fGeometryProcessor); 301 SkASSERT(!fGeometryProcessor);
302 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); 302 fGeometryProcessor = SkNEW(GrGLInstalledGeoProc);
303 303
304 const GrBatchTracker& bt = this->batchTracker(); 304 const GrBatchTracker& bt = this->batchTracker();
305 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt, fGpu->glCaps())); 305 fGeometryProcessor->fGLProc.reset(gp.createGLInstance(bt, *fGpu->glCaps().gl slCaps()));
306 306
307 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); 307 SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures());
308 this->emitSamplers(gp, &samplers, fGeometryProcessor); 308 this->emitSamplers(gp, &samplers, fGeometryProcessor);
309 309
310 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa mplers, 310 GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, sa mplers,
311 fCoordTransforms, &fOutCoords); 311 fCoordTransforms, &fOutCoords);
312 fGeometryProcessor->fGLProc->emitCode(args); 312 fGeometryProcessor->fGLProc->emitCode(args);
313 313
314 // We have to check that effects and the code they emit are consistent, ie i f an effect 314 // We have to check that effects and the code they emit are consistent, ie i f an effect
315 // asks for dst color, then the emit code needs to follow suit 315 // asks for dst color, then the emit code needs to follow suit
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 493
494 //////////////////////////////////////////////////////////////////////////////// /////////////////// 494 //////////////////////////////////////////////////////////////////////////////// ///////////////////
495 495
496 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 496 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
497 int numProcs = fProcs.count(); 497 int numProcs = fProcs.count();
498 for (int e = 0; e < numProcs; ++e) { 498 for (int e = 0; e < numProcs; ++e) {
499 SkDELETE(fProcs[e]); 499 SkDELETE(fProcs[e]);
500 } 500 }
501 } 501 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698