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

Unified Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 665893008: Bug fix for es 3.00 fb fetch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 2 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/builders/GrGLFragmentShaderBuilder.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/builders/GrGLFragmentShaderBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index 5d5741ef9bc8f4cb04379b6e1dc60b73d34698de..76558d8875fc9be54a772790a3c7bd87ff56c50c 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -75,6 +75,7 @@ GrGLFragmentShaderBuilder::GrGLFragmentShaderBuilder(GrGLProgramBuilder* program
, fHasSecondaryOutput(false)
, fSetupFragPosition(false)
, fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == desc.getHeader().fFragPosKey)
+ , fCustomColorOutputIndex(-1)
, fHasReadDstColor(false)
, fHasReadFragmentPosition(false) {
}
@@ -172,7 +173,15 @@ const char* GrGLFragmentShaderBuilder::dstColor() {
if (gpu->glCaps().fbFetchSupport()) {
this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1),
gpu->glCaps().fbFetchExtensionString());
- return gpu->glCaps().fbFetchColorName();
+
+ // On ES 3.0 we have to declare this, and use the custom color output name
+ const char* fbFetchColorName = gpu->glCaps().fbFetchColorName();
+ if (gpu->glslGeneration() >= k330_GrGLSLGeneration) {
+ this->enableCustomOutput();
+ fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOut_TypeModifier);
+ fbFetchColorName = declared_color_output_name();
+ }
+ return fbFetchColorName;
} else if (fProgramBuilder->fUniformHandles.fDstCopySamplerUni.isValid()) {
return kDstCopyColorName;
} else {
@@ -223,11 +232,13 @@ void GrGLFragmentShaderBuilder::emitCodeToReadDstTexture() {
}
void GrGLFragmentShaderBuilder::enableCustomOutput() {
- SkASSERT(!fHasCustomColorOutput);
- fHasCustomColorOutput = true;
- fOutputs.push_back().set(kVec4f_GrSLType,
- GrGLShaderVar::kOut_TypeModifier,
- declared_color_output_name());
+ if (!fHasCustomColorOutput) {
+ fHasCustomColorOutput = true;
+ fCustomColorOutputIndex = fOutputs.count();
+ fOutputs.push_back().set(kVec4f_GrSLType,
+ GrGLShaderVar::kOut_TypeModifier,
+ declared_color_output_name());
+ }
}
void GrGLFragmentShaderBuilder::enableSecondaryOutput() {
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698