Chromium Code Reviews| Index: src/gpu/gl/GrGLCaps.cpp |
| diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp |
| index 8474873ffff5d937f5edc2084e67e0bc5002ac17..c6ab3268f43f0e7dbf2f60db7fe2bd405b5251a2 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,20 @@ 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 requires specifically enabling MSAA fetching per sample. |
| + // On some devices this may have a perf hit. Also multiple render targets are disabled |
| + GR_GL_CALL(gli, Enable(GR_GL_FETCH_PER_SAMPLE_ARM)); |
|
bsalomon
2014/07/31 13:45:05
I don't think that this is the right place for thi
|
| + fFBFetchSupport = true; |
| + fFBFetchColorName = "gl_LastFragColorARM"; |
| + fFBFetchExtensionString = "GL_ARM_shader_framebuffer_fetch"; |
| } |
| } |
| @@ -335,7 +350,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() && |
| @@ -775,16 +791,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", |
| @@ -809,7 +815,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); |