[Webkit-unassigned] [Bug 31946] New: useProgram does not accept null

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 27 18:38:49 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31946

           Summary: useProgram does not accept null
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebGL
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ben.vanik at gmail.com


Per the GL spec, glUseProgram can take 0 as an argument just like glBindTexture
to indicate that the current program should be unbound. If you try this today
in WebKit (or Chromium), however, you'll get an exception. The issue is that
the check on useProgram and the code inside the Mac implementation of
useProgram do not check for this case like bindTexture does.

Spec: http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml

bindTexture is handled right in the two places that matter (the
WebGLRenderingContext and the GraphicsContext3D implementation):
WebGLRenderingContext::bindTexture:
    if (texture && texture->context() != this)
GraphicsContext3D::bindTexture:
    ::glBindTexture(target, texture ? (GLuint) texture->object() : 0);

useProgram is not handled right - the check at the top of it is copy pasted
from other program-related calls, which don't allow null.

WebGLRenderingContext::useProgram:
    if (!program || program->context() != this)
GraphicsContext3D::useProgram:
    ::glUseProgram((GLuint) program->object());

So, trivial fix:
WebGLRenderingContext::useProgram:
    if (program && program->context() != this)
GraphicsContext3D::useProgram:
    ::glUseProgram(program ? (GLuint) program->object() : 0);

Still figuring out how to attach patches and stuff, but it should be easy
enough without the 2 line diff :)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list