diff options
author | joshualitt <joshualitt@chromium.org> | 2015-01-13 13:13:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-13 13:13:59 -0800 |
commit | 3c1096fc0740a1b572fdae6f879ac62d516ebc39 (patch) | |
tree | 9967c5e67b5101ca1992d43ff7a5a024c7641227 /src | |
parent | bb928a0c0a4ddc11b05771e9eaa33f1058cc022a (diff) |
fix for FB fetch on nexus 10 ES3.0
BUG=skia:3304
Review URL: https://codereview.chromium.org/807143006
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index b729820ca5..376bfd432a 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -50,6 +50,7 @@ void GrGLCaps::reset() { fFullClearIsFree = false; fDropsTileOnZeroDivide = false; fFBFetchSupport = false; + fFBFetchNeedsCustomOutput = false; fFBFetchColorName = NULL; fFBFetchExtensionString = NULL; @@ -93,6 +94,7 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { fFullClearIsFree = caps.fFullClearIsFree; fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide; fFBFetchSupport = caps.fFBFetchSupport; + fFBFetchNeedsCustomOutput = caps.fFBFetchNeedsCustomOutput; fFBFetchColorName = caps.fFBFetchColorName; fFBFetchExtensionString = caps.fFBFetchExtensionString; @@ -250,16 +252,19 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { if (kGLES_GrGLStandard == standard) { if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { + fFBFetchNeedsCustomOutput = (version >= GR_GL_VER(3, 0)); fFBFetchSupport = true; fFBFetchColorName = "gl_LastFragData[0]"; fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch"; } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { + // Actually, we haven't seen an ES3.0 device with this extension yet, so we don't know + fFBFetchNeedsCustomOutput = false; fFBFetchSupport = true; fFBFetchColorName = "gl_LastFragData[0]"; fFBFetchExtensionString = "GL_NV_shader_framebuffer_fetch"; } else if (ctxInfo.hasExtension("GL_ARM_shader_framebuffer_fetch")) { // The arm extension also requires an additional flag which we will set onResetContext - // This is all temporary. + fFBFetchNeedsCustomOutput = false; fFBFetchSupport = true; fFBFetchColorName = "gl_LastFragColorARM"; fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 7ccb1d9f5d..77baf38a96 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -172,6 +172,8 @@ public: */ bool fbFetchSupport() const { return fFBFetchSupport; } + bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } + const char* fbFetchColorName() const { return fFBFetchColorName; } const char* fbFetchExtensionString() const { return fFBFetchExtensionString; } @@ -372,8 +374,8 @@ private: bool fIsCoreProfile : 1; bool fFullClearIsFree : 1; bool fDropsTileOnZeroDivide : 1; - // TODO(joshualitt) encapsulate the FB Fetch logic in a feature object bool fFBFetchSupport : 1; + bool fFBFetchNeedsCustomOutput : 1; const char* fFBFetchColorName; const char* fFBFetchExtensionString; diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp index b59df57512..46433f01c2 100644 --- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp +++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp @@ -171,9 +171,9 @@ const char* GrGLFragmentShaderBuilder::dstColor() { this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1), gpu->glCaps().fbFetchExtensionString()); - // On ES 3.0 we have to declare this, and use the custom color output name + // Some versions of this extension string require declaring custom color output on ES 3.0+ const char* fbFetchColorName = gpu->glCaps().fbFetchColorName(); - if (gpu->glslGeneration() >= k330_GrGLSLGeneration) { + if (gpu->glCaps().fbFetchNeedsCustomOutput()) { this->enableCustomOutput(); fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOut_TypeModifier); fbFetchColorName = declared_color_output_name(); |