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

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

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space 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/GrGLXferProcessor.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 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 "gl/GrGLXferProcessor.h" 8 #include "gl/GrGLXferProcessor.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
11 #include "gl/builders/GrGLFragmentShaderBuilder.h" 11 #include "gl/builders/GrGLFragmentShaderBuilder.h"
12 #include "gl/builders/GrGLProgramBuilder.h" 12 #include "gl/builders/GrGLProgramBuilder.h"
13 #include "glsl/GrGLSLProgramDataManager.h"
13 14
14 void GrGLXferProcessor::emitCode(const EmitArgs& args) { 15 void GrGLXferProcessor::emitCode(const EmitArgs& args) {
15 if (!args.fXP.willReadDstColor()) { 16 if (!args.fXP.willReadDstColor()) {
16 this->emitOutputsForBlendState(args); 17 this->emitOutputsForBlendState(args);
17 return; 18 return;
18 } 19 }
19 20
20 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 21 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
21 const char* dstColor = fsBuilder->dstColor(); 22 const char* dstColor = fsBuilder->dstColor();
22 23
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } else { 71 } else {
71 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputSecondary); 72 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputSecondary);
72 } 73 }
73 } else if (args.fXP.readsCoverage()) { 74 } else if (args.fXP.readsCoverage()) {
74 fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", 75 fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
75 args.fOutputPrimary, args.fInputCoverage, 76 args.fOutputPrimary, args.fInputCoverage,
76 args.fOutputPrimary, args.fInputCoverage, dstColo r); 77 args.fOutputPrimary, args.fInputCoverage, dstColo r);
77 } 78 }
78 } 79 }
79 80
80 void GrGLXferProcessor::setData(const GrGLProgramDataManager& pdm, const GrXferP rocessor& xp) { 81 void GrGLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrXfe rProcessor& xp) {
81 if (xp.getDstTexture()) { 82 if (xp.getDstTexture()) {
82 if (fDstTopLeftUni.isValid()) { 83 if (fDstTopLeftUni.isValid()) {
83 pdm.set2f(fDstTopLeftUni, static_cast<GrGLfloat>(xp.dstTextureOffset ().fX), 84 pdm.set2f(fDstTopLeftUni, static_cast<float>(xp.dstTextureOffset().f X),
84 static_cast<GrGLfloat>(xp.dstTextureOffset().fY)); 85 static_cast<float>(xp.dstTextureOffset().fY));
85 pdm.set2f(fDstScaleUni, 1.f / xp.getDstTexture()->width(), 86 pdm.set2f(fDstScaleUni, 1.f / xp.getDstTexture()->width(),
86 1.f / xp.getDstTexture()->height()); 87 1.f / xp.getDstTexture()->height());
87 } else { 88 } else {
88 SkASSERT(!fDstScaleUni.isValid()); 89 SkASSERT(!fDstScaleUni.isValid());
89 } 90 }
90 } else { 91 } else {
91 SkASSERT(!fDstTopLeftUni.isValid()); 92 SkASSERT(!fDstTopLeftUni.isValid());
92 SkASSERT(!fDstScaleUni.isValid()); 93 SkASSERT(!fDstScaleUni.isValid());
93 } 94 }
94 this->onSetData(pdm, xp); 95 this->onSetData(pdm, xp);
95 } 96 }
96 97
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLXferProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698