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

Side by Side Diff: src/gpu/glsl/GrGLSLXferProcessor.cpp

Issue 1440073002: Move XferProcessors to glsl (Closed) Base URL: https://skia.googlesource.com/skia.git@fragProcs
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/glsl/GrGLSLXferProcessor.h ('k') | tools/BUILD.public.expected » ('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 "glsl/GrGLSLXferProcessor.h"
9 9
10 #include "GrXferProcessor.h" 10 #include "GrXferProcessor.h"
11 #include "glsl/GrGLSLFragmentShaderBuilder.h" 11 #include "glsl/GrGLSLFragmentShaderBuilder.h"
12 #include "glsl/GrGLSLProgramBuilder.h" 12 #include "glsl/GrGLSLProgramBuilder.h"
13 #include "glsl/GrGLSLProgramDataManager.h" 13 #include "glsl/GrGLSLProgramDataManager.h"
14 14
15 void GrGLXferProcessor::emitCode(const EmitArgs& args) { 15 void GrGLSLXferProcessor::emitCode(const EmitArgs& args) {
16 if (!args.fXP.willReadDstColor()) { 16 if (!args.fXP.willReadDstColor()) {
17 this->emitOutputsForBlendState(args); 17 this->emitOutputsForBlendState(args);
18 return; 18 return;
19 } 19 }
20 20
21 GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 21 GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
22 const char* dstColor = fsBuilder->dstColor(); 22 const char* dstColor = fsBuilder->dstColor();
23 23
24 if (args.fXP.getDstTexture()) { 24 if (args.fXP.getDstTexture()) {
25 bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstTexture()->ori gin(); 25 bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstTexture()->ori gin();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } else { 71 } else {
72 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputSecondary); 72 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputSecondary);
73 } 73 }
74 } else if (args.fXP.readsCoverage()) { 74 } else if (args.fXP.readsCoverage()) {
75 fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;", 75 fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
76 args.fOutputPrimary, args.fInputCoverage, 76 args.fOutputPrimary, args.fInputCoverage,
77 args.fOutputPrimary, args.fInputCoverage, dstColo r); 77 args.fOutputPrimary, args.fInputCoverage, dstColo r);
78 } 78 }
79 } 79 }
80 80
81 void GrGLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrXfe rProcessor& xp) { 81 void GrGLSLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrX ferProcessor& xp) {
82 if (xp.getDstTexture()) { 82 if (xp.getDstTexture()) {
83 if (fDstTopLeftUni.isValid()) { 83 if (fDstTopLeftUni.isValid()) {
84 pdm.set2f(fDstTopLeftUni, static_cast<float>(xp.dstTextureOffset().f X), 84 pdm.set2f(fDstTopLeftUni, static_cast<float>(xp.dstTextureOffset().f X),
85 static_cast<float>(xp.dstTextureOffset().fY)); 85 static_cast<float>(xp.dstTextureOffset().fY));
86 pdm.set2f(fDstScaleUni, 1.f / xp.getDstTexture()->width(), 86 pdm.set2f(fDstScaleUni, 1.f / xp.getDstTexture()->width(),
87 1.f / xp.getDstTexture()->height()); 87 1.f / xp.getDstTexture()->height());
88 } else { 88 } else {
89 SkASSERT(!fDstScaleUni.isValid()); 89 SkASSERT(!fDstScaleUni.isValid());
90 } 90 }
91 } else { 91 } else {
92 SkASSERT(!fDstTopLeftUni.isValid()); 92 SkASSERT(!fDstTopLeftUni.isValid());
93 SkASSERT(!fDstScaleUni.isValid()); 93 SkASSERT(!fDstScaleUni.isValid());
94 } 94 }
95 this->onSetData(pdm, xp); 95 this->onSetData(pdm, xp);
96 } 96 }
97 97
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLXferProcessor.h ('k') | tools/BUILD.public.expected » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698