The default bug view has changed. See this FAQ.

X3DOM demo causes bad glBindTexture call in fake-black-texture code

RESOLVED FIXED

Status

()

Core
Canvas: WebGL
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: bjacob, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Discussed on public_webgl.

This demo:

http://www.x3dom.org/x3dom/example/x3dom_composedShader.xhtml)

When run in with MOZ_GL_DEBUG_ABORT_ON_ERROR from the opengl debug mode (bug 597881) in a 32bit Windows build/ Win 7 / NVIDIA gives this stack trace leading to a GL error (calling glBindTexture again with a different target):

 	mozalloc.dll!mozalloc_abort(const char * const msg)  Line 77	C++
 	xul.dll!Abort(const char * aMsg)  Line 379 + 0xa bytes	C++
 	xul.dll!NS_DebugBreak_P(unsigned int aSeverity, const char * aStr, const char * aExpr, const char * aFile, int aLine)  Line 337 + 0xc bytes	C++
 	xul.dll!mozilla::gl::GLContext::AfterGLCall(const char * glFunction)  Line 1046 + 0x15 bytes	C++
 	xul.dll!mozilla::gl::GLContext::fBindTexture(unsigned int target, unsigned int texture)  Line 1100	C++
>	xul.dll!mozilla::WebGLContext::UnbindFakeBlackTextures()  Line 1011	C++
 	xul.dll!mozilla::WebGLContext::DrawElements(unsigned int mode, int count, unsigned int type, int byteOffset)  Line 1133	C++
 	xul.dll!nsICanvasRenderingContextWebGL_DrawElements(JSContext * cx, unsigned int argc, jsval_layout * vp)  Line 28301 + 0x21 bytes	C++
 	xul.dll!CallCompiler::generateNativeStub()  Line 455 + 0x23 bytes	C++
 	xul.dll!js::mjit::ic::NativeCall(js::VMFrame & f, unsigned long index)  Line 709 + 0x8 bytes	C++
 	15624d99()	
 	nspr4.dll!_MD_CURRENT_THREAD()  Line 308 + 0xc bytes	C
 	003ece68()	
 	nspr4.dll!_MD_CURRENT_THREAD()  Line 308 + 0xc bytes	C
 	nspr4.dll!PR_Sleep(unsigned int timeout)  Line 152	C
 	nspr4.dll!PR_GetThreadPrivate(unsigned int index)  Line 232 + 0x5 bytes	C


This means that when we unbind our fake black textures, in this code,

    for (PRInt32 i = 0; i < mGLMaxTextureImageUnits; ++i) {
        if (mBound2DTextures[i] && mBound2DTextures[i]->NeedFakeBlack()) {
            gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
            gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mBound2DTextures[i]->GLName());
        }
        if (mBoundCubeMapTextures[i] && mBoundCubeMapTextures[i]->NeedFakeBlack()) {
            gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
            gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBoundCubeMapTextures[i]->GLName());
        }
    }

we are making glBindTexture calls that we shouldn't.
(Reporter)

Comment 1

7 years ago
On the same machine, I can't reproduce in linux x86-64.

Comment 2

7 years ago
Build : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7pre) Gecko/20100929 Firefox/4.0b7pre

With Intel GMA 4500MHD, there are 2 errors in error console :

Error: not well-formed
Source File: 
Line: 1, Column: 58
Source Code:
<p xmlns="http://www.w3.org/1999/xhtml">ERROR: No errors.

Error: uncaught exception: [Exception... "An invalid or illegal string was specified"  code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)"  location: "http://www.x3dom.org/x3dom/example/x3dom.js Line: 86"]
This needs more detail from the stack trace (a stack trace is generally not very useful by itself; if you have something in the debugger, it's worth getting as much information around the location where the error occurred):

  - which texture ID was being bound
  - was it a 2D or cubemap target
  - what are the values of the mBound2DTextures[i] or mBoundCubeMapTextures[i] struct?
Does this still happen?
Note that it might well be related to bug 629149
(Reporter)

Comment 6

6 years ago
Good point! Will check ASAP.
(Reporter)

Comment 7

6 years ago
This got fixed a while ago, we were mis-querying the number of texture units so we were iterating over an array of the wrong size here.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.