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

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

Issue 1434313002: Make all GrFragmentProcessors GL independent. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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') | src/gpu/glsl/GrGLSLBlend.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 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 "GrAutoLocaleSetter.h" 10 #include "GrAutoLocaleSetter.h"
11 #include "GrCoordTransform.h" 11 #include "GrCoordTransform.h"
12 #include "GrGLProgramBuilder.h" 12 #include "GrGLProgramBuilder.h"
13 #include "GrTexture.h" 13 #include "GrTexture.h"
14 #include "SkRTConf.h" 14 #include "SkRTConf.h"
15 #include "SkTraceEvent.h" 15 #include "SkTraceEvent.h"
16 #include "gl/GrGLFragmentProcessor.h"
17 #include "gl/GrGLGeometryProcessor.h" 16 #include "gl/GrGLGeometryProcessor.h"
18 #include "gl/GrGLGpu.h" 17 #include "gl/GrGLGpu.h"
19 #include "gl/GrGLProgram.h" 18 #include "gl/GrGLProgram.h"
20 #include "gl/GrGLSLPrettyPrint.h" 19 #include "gl/GrGLSLPrettyPrint.h"
21 #include "gl/GrGLXferProcessor.h" 20 #include "gl/GrGLXferProcessor.h"
22 #include "gl/builders/GrGLShaderStringBuilder.h" 21 #include "gl/builders/GrGLShaderStringBuilder.h"
23 #include "glsl/GrGLSLCaps.h" 22 #include "glsl/GrGLSLCaps.h"
23 #include "glsl/GrGLSLFragmentProcessor.h"
24 #include "glsl/GrGLSLProgramDataManager.h" 24 #include "glsl/GrGLSLProgramDataManager.h"
25 #include "glsl/GrGLSLTextureSampler.h" 25 #include "glsl/GrGLSLTextureSampler.h"
26 26
27 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) 27 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
28 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) 28 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
29 29
30 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp u) { 30 GrGLProgram* GrGLProgramBuilder::CreateProgram(const DrawArgs& args, GrGLGpu* gp u) {
31 GrAutoLocaleSetter als("C"); 31 GrAutoLocaleSetter als("C");
32 32
33 // create a builder. This will be handed off to effects so they can use it to add 33 // create a builder. This will be handed off to effects so they can use it to add
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 int index, 252 int index,
253 const char* outColor, 253 const char* outColor,
254 const char* inColor) { 254 const char* inColor) {
255 GrGLInstalledFragProc* ifp = new GrGLInstalledFragProc; 255 GrGLInstalledFragProc* ifp = new GrGLInstalledFragProc;
256 256
257 ifp->fGLProc.reset(fp.createGLInstance()); 257 ifp->fGLProc.reset(fp.createGLInstance());
258 258
259 SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures()); 259 SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures());
260 this->emitSamplers(fp, &samplers, ifp); 260 this->emitSamplers(fp, &samplers, ifp);
261 261
262 GrGLFragmentProcessor::EmitArgs args(this, fp, outColor, inColor, fOutCoords [index], samplers); 262 GrGLSLFragmentProcessor::EmitArgs args(this,
263 fp,
264 outColor,
265 inColor,
266 fOutCoords[index],
267 samplers);
263 ifp->fGLProc->emitCode(args); 268 ifp->fGLProc->emitCode(args);
264 269
265 // We have to check that effects and the code they emit are consistent, ie i f an effect 270 // We have to check that effects and the code they emit are consistent, ie i f an effect
266 // asks for dst color, then the emit code needs to follow suit 271 // asks for dst color, then the emit code needs to follow suit
267 verify(fp); 272 verify(fp);
268 fFragmentProcessors->fProcs.push_back(ifp); 273 fFragmentProcessors->fProcs.push_back(ifp);
269 } 274 }
270 275
271 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp, 276 void GrGLProgramBuilder::emitAndInstallProc(const GrPrimitiveProcessor& gp,
272 const char* outColor, 277 const char* outColor,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 536 }
532 537
533 //////////////////////////////////////////////////////////////////////////////// /////////////////// 538 //////////////////////////////////////////////////////////////////////////////// ///////////////////
534 539
535 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 540 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
536 int numProcs = fProcs.count(); 541 int numProcs = fProcs.count();
537 for (int i = 0; i < numProcs; ++i) { 542 for (int i = 0; i < numProcs; ++i) {
538 delete fProcs[i]; 543 delete fProcs[i];
539 } 544 }
540 } 545 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLBlend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698