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

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

Issue 14998007: Make GrGLShaderBuilder check whether GrEffect advertised that it would require the dst color or frag (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address comments Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index c1732b20e766b3b32016b6efe57344f3eb9f5afa..98d7e4c97e80e486b9e837211fdff8a2e2939e0e 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -230,6 +230,14 @@ void GrGLShaderBuilder::nameVariable(SkString* out, char prefix, const char* nam
}
const char* GrGLShaderBuilder::dstColor() {
+ if (fCodeStage.inStageCode()) {
+ const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect();
+ if (!effect->willReadDstColor()) {
+ GrDebugCrash("GrGLEffect asked for dst color but its generating GrEffect "
+ "did not request access.");
+ return "";
+ }
+ }
static const char kFBFetchColorName[] = "gl_LastFragData[0]";
GrGLCaps::FBFetchType fetchType = fCtxInfo.caps()->fbFetchType();
if (GrGLCaps::kEXT_FBFetchType == fetchType) {
@@ -241,7 +249,7 @@ const char* GrGLShaderBuilder::dstColor() {
} else if (fDstCopySampler.isInitialized()) {
return kDstCopyColorName;
} else {
- return NULL;
+ return "";
}
}
@@ -457,6 +465,14 @@ void GrGLShaderBuilder::addVarying(GrSLType type,
}
const char* GrGLShaderBuilder::fragmentPosition() {
+ if (fCodeStage.inStageCode()) {
+ const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect();
+ if (!effect->willReadFragmentPosition()) {
+ GrDebugCrash("GrGLEffect asked for frag position but its generating GrEffect "
+ "did not request access.");
+ return "";
+ }
+ }
#if 1
if (fCtxInfo.caps()->fragCoordConventionsSupport()) {
if (!fSetupFragPosition) {
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698