[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Minefield brings system to halt




----- Original Message -----
> ----- Original Message -----
> > Hi,
> >
> > we've got problems with some of our X3DOM examples with Firefox
> > Beta/
> > Minefield for a while right now. For example, shadows stopped
> > working
> > (see http://x3dom.org/x3dom/example/x3dom_shadows.xhtml) without any
> > error message,
> 
> Do you have the preference webgl.verbose enabled? WebGL error messages
> are now hidden by default.
> 
> ---> Vlad: see? That's why I wanted to print 1 message saying that
> there are errors.
> 
> Here, this demo appears to be working, however I do get lots of error
> messages:
> 
> VBO too small for bound attrib index 0

Oooh, the dreaded vertex attrib index 0... Since we have to special-case it on desktop OpenGL, I can only suspect a bug in my code there... in other bug reports we've gotten too, index 0 was involved. Let me paste the relevant part of my code here just in case some guru sees an obvious bug....

PRBool
WebGLContext::NeedFakeVertexAttrib0()
{
    return !gl->IsGLES2() &&
           !mAttribBuffers[0].enabled;
}

void
WebGLContext::DoFakeVertexAttrib0(WebGLuint vertexCount)
{
    if (!NeedFakeVertexAttrib0())
        return;

    mFakeVertexAttrib0Array = new WebGLfloat[4 * vertexCount];

    for(size_t i = 0; i < vertexCount; ++i) {
        mFakeVertexAttrib0Array[4 * i + 0] = mVertexAttrib0Vector[0];
        mFakeVertexAttrib0Array[4 * i + 1] = mVertexAttrib0Vector[1];
        mFakeVertexAttrib0Array[4 * i + 2] = mVertexAttrib0Vector[2];
        mFakeVertexAttrib0Array[4 * i + 3] = mVertexAttrib0Vector[3];
    }

    gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
    gl->fVertexAttribPointer(0, 4, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, mFakeVertexAttrib0Array);
}

void
WebGLContext::UndoFakeVertexAttrib0()
{
    if (!NeedFakeVertexAttrib0())
        return;

    mFakeVertexAttrib0Array = nsnull;

    // first set the bound buffer as needed for subsequent gl->fVertexAttribPointer call.
    // since in DoFakeVertexAttrib0() we called bindBuffer on buffer zero, we only need to do that if
    // we have a nonzero buffer binding for this attrib.
    if (mAttribBuffers[0].buf)
        gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mAttribBuffers[0].buf->GLName());

    gl->fVertexAttribPointer(0,
                             mAttribBuffers[0].size,
                             mAttribBuffers[0].type,
                             mAttribBuffers[0].normalized,
                             mAttribBuffers[0].stride,
                             (const GLvoid *) mAttribBuffers[0].byteOffset);

    // now restore the bound buffer to its state before we did this whole draw call business
    gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mBoundArrayBuffer ? mBoundArrayBuffer->GLName() : 0);
}


NS_IMETHODIMP
WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, WebGLint byteOffset)
{
    // lots of validation code there

    // more stuff

    DoFakeVertexAttrib0(checked_neededCount.value());

    gl->fDrawElements(mode, count, type, (GLvoid*) (byteOffset));

    UndoFakeVertexAttrib0();

    // more stuff
}
>: need at least 12 bytes, but
> have only 0
> DrawElements: bound vertex attribute buffers do not have sufficient
> size for given indices from the bound element array
> 
> This suggests that some vertex buffers are not properly loaded (?).
> Also it's strange that a DrawElements call would want to consume only
> 12 bytes: that means 1 vertex.
> 
> > as well as cube maps/ multi-textures, which in Firefox
> > Beta only leads to a "been bound to a different target" (compare
> > http://www.x3dom.org/x3dom/example/x3dom_composedShader.xhtml).
> 
> I'm getting this error too, as well as the same errors as in the
> previous demo.
> 
> > However, in Chrome Beta and Chromium everything works as expected.
> >
> > But besides this, I've just updated to the latest Minefield to check
> > if
> > these issues still exist, but there almost none of the X3DOM
> > examples
> > worked. Instead I got some strange error messages about VBOs called
> > with
> > wrong sizes etc. And suddenly, while I was wondering what's going
> > on,
> > my
> > computer stopped working and I had to boot it again. I suspect the
> > problem has something to do with this new Direct3D stuff which
> > according
> > to the error console seems to be used now instead of native OpenGL.
> 
> Oops, that sounds serious!
> 
> Direct3D doesn't get used instead of OpenGL, what happens is that
> OpenGL gets used for WebGL calls and Direct3D for compositing
> (eventually we'll probably end up using Direct3D everywhere on
> Windows).
> 
> You can determine if Direct3D is what's causing issues by disabling
> it: set layers.accelerate-none=true and layers.accelerate-all=false.
> 
> But in this bug we have the Blobs demo freezing display even without
> any Direct3D compositing:
> https://bugzilla.mozilla.org/show_bug.cgi?id=598166
> 
> Another thing that's worth trying is setting webgl.shader_validator to
> false, to see if it's an issue with our ANGLE copy or the way that
> we're using it.
> 
> Cheers,
> Benoit
> 
> > For information: my machine runs Windows 7 32-bit with a GeForce
> > 8800
> > GTX (and the same graphics driver etc. for months now).
> >
> > Any help or fix appreciated
> > Yvonne
> >
> >
> >
> > --
> > Yvonne Jung
> > Fraunhofer-IGD | Tel.: ++49-6151-155-290
> > Fraunhoferstr. 5 | Fax.: ++49-6151-155-196
> > 64283 Darmstadt | email: yvonne.jung@igd.fraunhofer.de
> > Germany | http://www.igd.fhg.de/igd-a4
> > -----------------------------------------------------------
> > You are currently subscribed to public_webgl@khronos.org.
> > To unsubscribe, send an email to majordomo@khronos.org with
> > the following command in the body of your email:
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: