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

Unified Diff: src/gpu/gl/GrGLXferProcessor.cpp

Issue 1170553002: Apply coverage in XP base class when using dst reads (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_reenablebea
Patch Set: names Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLXferProcessor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLXferProcessor.cpp
diff --git a/src/gpu/gl/GrGLXferProcessor.cpp b/src/gpu/gl/GrGLXferProcessor.cpp
index b707a3f632047d4892518d42f55f1b2454bcc83f..3d3ab49dadc89ba64e0c84c40ca21284286af26a 100644
--- a/src/gpu/gl/GrGLXferProcessor.cpp
+++ b/src/gpu/gl/GrGLXferProcessor.cpp
@@ -12,11 +12,17 @@
#include "gl/builders/GrGLProgramBuilder.h"
void GrGLXferProcessor::emitCode(const EmitArgs& args) {
+ if (!args.fXP.willReadDstColor()) {
+ this->emitOutputsForBlendState(args);
+ return;
+ }
+
+ GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ const char* dstColor = fsBuilder->dstColor();
+
if (args.fXP.getDstTexture()) {
bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstTexture()->origin();
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
-
if (args.fXP.readsCoverage()) {
// We don't think any shaders actually output negative coverage, but just as a safety
// check for floating point precision errors we compare with <= here
@@ -25,8 +31,6 @@ void GrGLXferProcessor::emitCode(const EmitArgs& args) {
"}", args.fInputCoverage);
}
- const char* dstColor = fsBuilder->dstColor();
-
const char* dstTopLeftName;
const char* dstCoordScaleName;
@@ -55,7 +59,15 @@ void GrGLXferProcessor::emitCode(const EmitArgs& args) {
fsBuilder->codeAppend(";");
}
- this->onEmitCode(args);
+ this->emitBlendCodeForDstRead(args.fPB, args.fInputColor, dstColor, args.fOutputPrimary,
+ args.fXP);
+
+ // Apply coverage.
+ if (args.fXP.readsCoverage()) {
+ fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
+ args.fOutputPrimary, args.fInputCoverage,
+ args.fOutputPrimary, args.fInputCoverage, dstColor);
+ }
}
void GrGLXferProcessor::setData(const GrGLProgramDataManager& pdm, const GrXferProcessor& xp) {
« no previous file with comments | « src/gpu/gl/GrGLXferProcessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698