Closed Bug 580345 Opened 14 years ago Closed 14 years ago

fix up some GLESv2 vs. desktop GL differences

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: vlad, Assigned: vlad)

Details

Attachments

(1 file)

There are a few annoying differences between GLESv2 and desktop GL that we end up having to #ifdef around a lot; instead, just add a helper function in GLContext that'll do the right thing.  This also removes a bunch of unused entry points from GLConext that were desktop GL-only.

The runtime IsGLES2 checks are there because on Windows, we might have either a desktop GL context or a GLESv2 context via ANGLE (or a future native EGL/GLESv2 impl if one shows up).
Attachment #458745 - Flags: review?(joe)
Comment on attachment 458745 [details] [diff] [review]
fix up gl vs glesv2 usage


>diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp
>--- a/content/canvas/src/WebGLContextValidate.cpp
>+++ b/content/canvas/src/WebGLContextValidate.cpp
>@@ -398,30 +400,41 @@ WebGLContext::InitAndValidateGL()

>-#ifdef USE_GLES2
>-    gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors);
>-    gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors);
>-    gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors);
>+    printf_stderr("four: 0x%04x\n", gl->fGetError());

leftover printf?


>+
>+    if (gl->IsGLES2()) {
>+        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors);
>+        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors);
>+        gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors);
>+    } else {
>+        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors);
>+        mGLMaxFragmentUniformVectors /= 4;
>+        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors);
>+        mGLMaxVertexUniformVectors /= 4;
>+        gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors);
>+        mGLMaxVaryingVectors /= 4;
>+    }
>+
>+    printf_stderr("five: 0x%04x\n", gl->fGetError());

And here

>+
>+#if 0
>+    gl->fGetIntegerv(LOCAL_GL_MAX_COLOR_ATTACHMENTS, (GLint*) &val);
> #else

Why's this #if 0'd out?

>-    gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors);
>-    mGLMaxFragmentUniformVectors /= 4;
>-    gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors);
>-    mGLMaxVertexUniformVectors /= 4;
>-    gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors);
>-    mGLMaxVaryingVectors /= 4;
>+    // Always 1 for GLES2
>+    val = 1;
> #endif
>+    mFramebufferColorAttachments.SetLength(val);
> 
>-    gl->fGetIntegerv(LOCAL_GL_MAX_COLOR_ATTACHMENTS, (GLint*) &val);
>-    mFramebufferColorAttachments.SetLength(val);
>+    printf_stderr("six: 0x%04x\n", gl->fGetError());

another leftover printf
Attachment #458745 - Flags: review?(joe) → review+
Indeed, forgot to qrefresh to get rid of the printfs.  The #if 0'd chunk is something that was there earlier, but was incorrect -- GLES2 only supports 1 color attachment, and there is no GL_MAX_COLOR_ATTACHMENTS enum.  So WebGL should never query it, but I left the code in there for some future where we might support multiple color attachments.
OK, for the #if 0 bits just add a comment to that effect?
blocking2.0: --- → betaN+
Who owns this?  Need an owner ASAP.
Oooh, me me!

http://hg.mozilla.org/mozilla-central/rev/e6843fbf3073
Assignee: nobody → vladimir
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: