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

Re: [Public WebGL] Proposal: Generate INVALID_VALUE if value >= MAX_TEXTURE_IMAGE_UNITS on uniform1f(v) for samplers

On Wed, May 2, 2012 at 12:13 AM, Gregg Tavares (勤) <gman@google.com> wrote:
gl.uniform1f(someSamplerLocation, 0);
Happens a lot, I've had that a couple times too from typos.
You could say this is their fault for writing bad code but the thing is there are no errors for this condition defined by OpenGL ES or WebGL AFAIK.
The glValidateProgram call verifies validity of the configuration of samplers with the current state.
Given that uniforms are program specific and given that at runtime we know whether or not a particular location is a sampler, should we generate an INVALID_VALUE
if the value set for a sampler uniform is greater than or MAX_TEXTURE_IMAGE_UNITS?
It'd be an obvious solution, although that would deviate from the OpenGL ES specification (not that I think it would matter). The texture unit indirection is a bit of an inelegant solution (and that's where such mixups come from in the end). DSA would've been much nicer to implement, as in setSampler(program, location, texture), alas that would break completely with the current specification and would probably be deemed a nogo (regardless, it'd also be somewhat hard to implement for platforms that don't have proprietary DSA extensions).

I'm in favor of generating INVALID_VALUE