From 4fe7340dc2824c3737febb96e2209daf489476ba Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Fri, 16 Dec 2016 16:17:29 -0800 Subject: [PATCH] Bug 1309643 - Only enable primitive restart index on OSX for DrawElements. - r=ethlin --- dom/canvas/WebGL2Context.cpp | 1 - dom/canvas/WebGLContextDraw.cpp | 9 +++++---- gfx/gl/GLContextFeatures.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/canvas/WebGL2Context.cpp b/dom/canvas/WebGL2Context.cpp index 2dae54e408d9..9c659ca7da5d 100644 --- a/dom/canvas/WebGL2Context.cpp +++ b/dom/canvas/WebGL2Context.cpp @@ -175,7 +175,6 @@ WebGLContext::InitWebGL2(FailureReason* const out_failReason) gl->fEnable(LOCAL_GL_PRIMITIVE_RESTART_FIXED_INDEX); } else { MOZ_ASSERT(gl->IsSupported(gl::GLFeature::prim_restart)); - gl->fEnable(LOCAL_GL_PRIMITIVE_RESTART); } ////// diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp index 38447699b62c..420f9ab32d9f 100644 --- a/dom/canvas/WebGLContextDraw.cpp +++ b/dom/canvas/WebGLContextDraw.cpp @@ -270,11 +270,11 @@ WebGLContext::DrawArrays_check(const char* funcName, GLenum mode, GLint first, if (IsWebGL2() && !gl->IsSupported(gl::GLFeature::prim_restart_fixed)) { MOZ_ASSERT(gl->IsSupported(gl::GLFeature::prim_restart)); - if (mPrimRestartTypeBytes != 4) { - mPrimRestartTypeBytes = 4; + if (mPrimRestartTypeBytes != 0) { + mPrimRestartTypeBytes = 0; - // OSX has issues leaving this as 0. - gl->fPrimitiveRestartIndex(UINT32_MAX); + // OSX appears to have severe perf issues with leaving this enabled. + gl->fDisable(LOCAL_GL_PRIMITIVE_RESTART); } } @@ -630,6 +630,7 @@ WebGLContext::DrawElements_check(const char* funcName, GLenum mode, GLsizei vert mPrimRestartTypeBytes = bytesPerElem; const uint32_t ones = UINT32_MAX >> (4 - mPrimRestartTypeBytes); + gl->fEnable(LOCAL_GL_PRIMITIVE_RESTART); gl->fPrimitiveRestartIndex(ones); } } diff --git a/gfx/gl/GLContextFeatures.cpp b/gfx/gl/GLContextFeatures.cpp index f3f35022929e..0714d964150d 100644 --- a/gfx/gl/GLContextFeatures.cpp +++ b/gfx/gl/GLContextFeatures.cpp @@ -445,7 +445,7 @@ static const FeatureInfo sFeatureInfoArr[] = { GLESVersion::NONE, GLContext::Extension_None, { - GLContext::NV_primitive_restart, + //GLContext::NV_primitive_restart, // Has different enum values. GLContext::Extensions_End } },