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) { |