From ae95aea501332b4bd0be17532e8fda95d44b17d6 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Wed, 2 Sep 2015 20:35:45 -0700 Subject: [PATCH] Back out 71886d218c12 (bug 1200864) for Win8 mochitest-gl failures CLOSED TREE --- dom/canvas/WebGLContextDraw.cpp | 21 ++++------ gfx/gl/GLContext.cpp | 15 ------- gfx/gl/GLContext.h | 9 ---- gfx/gl/GLContextEGL.h | 4 -- gfx/gl/GLContextFeatures.cpp | 17 -------- gfx/gl/GLContextProviderEGL.cpp | 73 ++++++++++++--------------------- gfx/gl/GLDefs.h | 1 + 7 files changed, 36 insertions(+), 104 deletions(-) diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp index e8b6ec984e9f..47afcbf0473b 100644 --- a/dom/canvas/WebGLContextDraw.cpp +++ b/dom/canvas/WebGLContextDraw.cpp @@ -254,18 +254,13 @@ WebGLContext::DrawElements_check(GLsizei count, GLenum type, if (!ValidateBufferFetching(info)) return false; - if (gl->IsSupported(GLFeature::robust_buffer_access_behavior)) { - *out_upperBound = 0; - } else { - if (!mMaxFetchedVertices || - !elemArrayBuffer.Validate(type, mMaxFetchedVertices - 1, first, count, - out_upperBound)) - { - ErrorInvalidOperation( - "%s: bound vertex attribute buffers do not have sufficient " - "size for given indices from the bound element array", info); - return false; - } + if (!mMaxFetchedVertices || + !elemArrayBuffer.Validate(type, mMaxFetchedVertices - 1, first, count, out_upperBound)) + { + ErrorInvalidOperation( + "%s: bound vertex attribute buffers do not have sufficient " + "size for given indices from the bound element array", info); + return false; } if (uint32_t(primcount) > mMaxFetchedInstances) { @@ -327,7 +322,7 @@ WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type, { ScopedMaskWorkaround autoMask(*this); - if (upperBound && gl->IsSupported(gl::GLFeature::draw_range_elements)) { + if (gl->IsSupported(gl::GLFeature::draw_range_elements)) { gl->fDrawRangeElements(mode, 0, upperBound, count, type, reinterpret_cast(byteOffset)); } else { diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 73e449800985..3bedf3bbe402 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -97,7 +97,6 @@ static const char *sExtensionNames[] = { "GL_ARB_map_buffer_range", "GL_ARB_occlusion_query2", "GL_ARB_pixel_buffer_object", - "GL_ARB_robust_buffer_access_behavior", "GL_ARB_robustness", "GL_ARB_sampler_objects", "GL_ARB_sync", @@ -149,7 +148,6 @@ static const char *sExtensionNames[] = { "GL_IMG_texture_compression_pvrtc", "GL_IMG_texture_npot", "GL_KHR_debug", - "GL_KHR_robust_buffer_access_behavior", "GL_NV_draw_instanced", "GL_NV_fence", "GL_NV_framebuffer_blit", @@ -1644,19 +1642,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) true); } - // Until ANGLE supports robust_buffer_access_behavior explicitly, we'll need to - // add it ourselves for D3D10+. (D3D10+ always supports - // robust_buffer_access_behavior) - if (IsANGLE()) { - const char* renderer = (const char*)fGetString(LOCAL_GL_RENDERER); - if (strstr(renderer, "Direct3D10") || strstr(renderer, "Direct3D11")) { - MOZ_ASSERT(!IsSupported(GLFeature::robust_buffer_access_behavior), - "Since ANGLE supports robust_buffer_access_behavior now, we can" - " remove this block of code."); - MarkSupported(GLFeature::robust_buffer_access_behavior); - } - } - reporter.SetSuccessful(); } else { // if initialization fails, ensure all symbols are zero, to avoid hard-to-understand bugs diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index 1aa68ecd51c7..0f23d13e7184 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -119,7 +119,6 @@ enum class GLFeature { read_buffer, renderbuffer_color_float, renderbuffer_color_half_float, - robust_buffer_access_behavior, robustness, sRGB_framebuffer, sRGB_texture, @@ -408,7 +407,6 @@ public: ARB_map_buffer_range, ARB_occlusion_query2, ARB_pixel_buffer_object, - ARB_robust_buffer_access_behavior, ARB_robustness, ARB_sampler_objects, ARB_sync, @@ -460,7 +458,6 @@ public: IMG_texture_compression_pvrtc, IMG_texture_npot, KHR_debug, - KHR_robust_buffer_access_behavior, NV_draw_instanced, NV_fence, NV_framebuffer_blit, @@ -530,8 +527,6 @@ private: */ void InitFeatures(); - void MarkSupported(GLFeature feature); - /** * Mark the feature and associated extensions as unsupported */ @@ -3619,10 +3614,6 @@ public: static bool ShouldSpew(); static bool ShouldDumpExts(); void Readback(SharedSurface* src, gfx::DataSourceSurface* dest); - - virtual bool NeedsDrawElementsValidation() const { - return true; - } }; bool DoesStringMatch(const char* aString, const char *aWantedString); diff --git a/gfx/gl/GLContextEGL.h b/gfx/gl/GLContextEGL.h index e212ee66e7ca..5a4d3b7222d6 100644 --- a/gfx/gl/GLContextEGL.h +++ b/gfx/gl/GLContextEGL.h @@ -70,10 +70,6 @@ public: return sEGLLibrary.IsWARP(); } - virtual bool NeedsDrawElementsValidation() const override { - return true; - } - virtual bool BindTexImage() override; virtual bool ReleaseTexImage() override; diff --git a/gfx/gl/GLContextFeatures.cpp b/gfx/gl/GLContextFeatures.cpp index 2f1c3e9c220d..780a9950169a 100644 --- a/gfx/gl/GLContextFeatures.cpp +++ b/gfx/gl/GLContextFeatures.cpp @@ -505,17 +505,6 @@ static const FeatureInfo sFeatureInfoArr[] = { GLContext::Extensions_End } }, - { - "robust_buffer_access_behavior", - GLVersion::NONE, - GLESVersion::NONE, - GLContext::Extension_None, - { - GLContext::ARB_robust_buffer_access_behavior, - GLContext::KHR_robust_buffer_access_behavior, - GLContext::Extensions_End - } - }, { "robustness", GLVersion::NONE, @@ -842,12 +831,6 @@ GLContext::InitFeatures() } } -void -GLContext::MarkSupported(GLFeature feature) -{ - mAvailableFeatures[size_t(feature)] = true; -} - void GLContext::MarkUnsupported(GLFeature feature) { diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 3bcc8838b63b..c42b56272c29 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -137,25 +137,19 @@ CreateConfig(EGLConfig* aConfig, nsIWidget* aWidget); #define EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS \ LOCAL_EGL_NONE, 0, 0, 0 -static EGLint kTerminationAttribs[] = { +static EGLint gTerminationAttribs[] = { EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS }; -static EGLint kContextAttribs[] = { +static EGLint gContextAttribs[] = { LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2, EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS }; -static EGLint kContextAttribsRobustness[] = { +static EGLint gContextAttribsRobustness[] = { LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2, - LOCAL_EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT, - EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS -}; - -static EGLint kContextAttribsRobustAccess[] = { - LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2, - LOCAL_EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, LOCAL_EGL_TRUE, - LOCAL_EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT, + //LOCAL_EGL_CONTEXT_ROBUST_ACCESS_EXT, LOCAL_EGL_TRUE, + LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT, LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT, EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS }; @@ -507,29 +501,6 @@ GLContextEGL::DestroySurface(EGLSurface aSurface) } } -static EGLContext -CreateContextForShareContext(EGLDisplay display, EGLConfig config, - EGLContext shareContext) -{ - EGLContext context = nullptr; - - if (sEGLLibrary.HasRobustness()) { - context = sEGLLibrary.fCreateContext(EGL_DISPLAY(), config, shareContext, - kContextAttribsRobustAccess); - if (!context) { - context = sEGLLibrary.fCreateContext(EGL_DISPLAY(), config, shareContext, - kContextAttribsRobustness); - } - } - - if (!context) { - context = sEGLLibrary.fCreateContext(EGL_DISPLAY(), config, shareContext, - kContextAttribs); - } - - return context; -} - already_AddRefed GLContextEGL::CreateGLContext(const SurfaceCaps& caps, GLContextEGL *shareContext, @@ -542,24 +513,34 @@ GLContextEGL::CreateGLContext(const SurfaceCaps& caps, return nullptr; } - EGLContext context = nullptr; - if (shareContext) { - context = CreateContextForShareContext(EGL_DISPLAY(), config, - shareContext->mContext); - } + EGLContext eglShareContext = shareContext ? shareContext->mContext + : EGL_NO_CONTEXT; + EGLint* attribs = sEGLLibrary.HasRobustness() ? gContextAttribsRobustness + : gContextAttribs; - if (!context) { + EGLContext context = sEGLLibrary.fCreateContext(EGL_DISPLAY(), + config, + eglShareContext, + attribs); + if (!context && shareContext) { shareContext = nullptr; - context = CreateContextForShareContext(EGL_DISPLAY(), config, nullptr); + context = sEGLLibrary.fCreateContext(EGL_DISPLAY(), + config, + EGL_NO_CONTEXT, + attribs); } - if (!context) { NS_WARNING("Failed to create EGLContext!"); return nullptr; } - nsRefPtr glContext = new GLContextEGL(caps, shareContext, isOffscreen, - config, surface, context); + nsRefPtr glContext = new GLContextEGL(caps, + shareContext, + isOffscreen, + config, + surface, + context); + if (!glContext->Init()) return nullptr; @@ -587,8 +568,8 @@ TRY_AGAIN_POWER_OF_TWO: pbattrs.AppendElement(bindToTextureFormat); } - for (size_t i = 0; i < MOZ_ARRAY_LENGTH(kTerminationAttribs); i++) { - pbattrs.AppendElement(kTerminationAttribs[i]); + for (size_t i = 0; i < MOZ_ARRAY_LENGTH(gTerminationAttribs); i++) { + pbattrs.AppendElement(gTerminationAttribs[i]); } surface = sEGLLibrary.fCreatePbufferSurface(EGL_DISPLAY(), config, &pbattrs[0]); diff --git a/gfx/gl/GLDefs.h b/gfx/gl/GLDefs.h index 8b22d3e16985..18faa79416bd 100644 --- a/gfx/gl/GLDefs.h +++ b/gfx/gl/GLDefs.h @@ -52,6 +52,7 @@ // Others #define LOCAL_EGL_PRESERVED_RESOURCES 0x3030 +#define LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 // ANGLE_platform_angle_d3d #define LOCAL_EGL_PLATFORM_ANGLE_ANGLE 0x3201