diff options
Diffstat (limited to 'src/gpu/gl/GrGLCaps.cpp')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 7dee3de4b1..f12871192c 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -22,7 +22,6 @@ void GrGLCaps::reset() { fStencilFormats.reset(); fStencilVerifiedColorConfigs.reset(); fMSFBOType = kNone_MSFBOType; - fFBFetchType = kNone_FBFetchType; fInvalidateFBType = kNone_InvalidateFBType; fLATCAlias = kLATC_LATCAlias; fMapBufferType = kNone_MapBufferType; @@ -48,6 +47,9 @@ void GrGLCaps::reset() { fIsCoreProfile = false; fFullClearIsFree = false; fDropsTileOnZeroDivide = false; + fFBFetchSupport = false; + fFBFetchColorName = NULL; + fFBFetchExtensionString = NULL; } GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { @@ -65,7 +67,6 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; fMSFBOType = caps.fMSFBOType; - fFBFetchType = caps.fFBFetchType; fInvalidateFBType = caps.fInvalidateFBType; fMapBufferType = caps.fMapBufferType; fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; @@ -86,6 +87,9 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { fIsCoreProfile = caps.fIsCoreProfile; fFullClearIsFree = caps.fFullClearIsFree; fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide; + fFBFetchSupport = caps.fFBFetchSupport; + fFBFetchColorName = caps.fFBFetchColorName; + fFBFetchExtensionString = caps.fFBFetchExtensionString; return *this; } @@ -233,9 +237,19 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { if (kGLES_GrGLStandard == standard) { if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { - fFBFetchType = kEXT_FBFetchType; + fFBFetchSupport = true; + fFBFetchColorName = "gl_LastFragData[0]"; + fFBFetchExtensionString = "GL_EXT_shader_framebuffer_fetch"; } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { - fFBFetchType = kNV_FBFetchType; + 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. + fFBFetchSupport = true; + fFBFetchColorName = "gl_LastFragColorARM"; + fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; } } @@ -335,7 +349,8 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); - fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; + // For now these two are equivalent but we could have dst read in shader via some other method + fDstReadInShaderSupport = fFBFetchSupport; // Disable scratch texture reuse on Mali and Adreno devices fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && @@ -777,16 +792,6 @@ SkString GrGLCaps::dump() const { GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); - static const char* kFBFetchTypeStr[] = { - "None", - "EXT", - "NV", - }; - GR_STATIC_ASSERT(0 == kNone_FBFetchType); - GR_STATIC_ASSERT(1 == kEXT_FBFetchType); - GR_STATIC_ASSERT(2 == kNV_FBFetchType); - GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); - static const char* kInvalidateFBTypeStr[] = { "None", "Discard", @@ -811,7 +816,7 @@ SkString GrGLCaps::dump() const { r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); - r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); + r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType]); r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]); r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |