[Webkit-unassigned] [Bug 52190] New: getUniform does not support SAMPLER_2D or SAMPLER_CUBE

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 10 19:22:45 PST 2011


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

           Summary: getUniform does not support SAMPLER_2D or SAMPLER_CUBE
           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


The getUniform call will return 'null' and set INVALID_VALUE when any uniforms of type SAMPLER_2D or SAMPLER_CUBE are queried. Looking at the implementation in WebGLRenderContext.cpp line 2122, there is a '// FIXME: what to do about samplers?' and both type values get ignored.

SAMPLER_2D and SAMPLER_CUBE are both integer values set with glUniformi[v] and as such can be queried from GL with glGetUniformiv. Firefox currently implements this and as such in that browser getUniform works for these types.

I've tested Chromium on both OSX and Windows (with ANGLE) with the following simple change and it works in my tests:
@@ -2117,9 +2117,13 @@
                     baseType = GraphicsContext3D::FLOAT;
                     length = 16;
                     break;
+                case GraphicsContext3D::SAMPLER_2D:
+                case GraphicsContext3D::SAMPLER_CUBE:
+                    baseType = GraphicsContext3D::INT;
+                    length = 1;
+                    break;
                 default:
                     // Can't handle this type
-                    // FIXME: what to do about samplers?
                     m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
                     return WebGLGetInfo();
                 }


With these changes, you should actually be able to do things like this:
var samplerLoc = gl.getUniformLocation(program, "mySampler");
gl.uniform1i(samplerLoc, 1);
var value = gl.getUniform(program, samplerLoc);
assert(value == 1);

-- 
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