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

Re: [Public WebGL] IMPORTANT: Your WebGL floating point texture usage needs to be fixed!!!!

On Wed, Jun 5, 2013 at 7:24 PM, Jeff Gilbert <jgilbert@mozilla.com> wrote:
Benoit appears to be technically correct.

You're right. The case of an un-filterable texture is not mentioned in ES 2.0 at all I think. 

GLES2's 3.8.2 doesn't actually appear to apply to incomplete textures with LINEAR (or NEAREST), only to incomplete textures with MIPMAP_NEAREST/MIPMAP_LINEAR, and to 2d textures with NEAREST/LINEAR with one of its width or height being negative, and to NPOT cases with non-CLAMP_TO_EDGE wrapping.

Just to be clear, it doesn't say width or height being negative. It says width or height being "not positive". In other words <= 0 is black, not just < 0.

WebGL's spec doesn't seem to modify this.

GLES3, however, does fix this language in section 3.9.2:
  If a sampler is used in a fragment shader and the sampler’s associated texture
  is not complete, as defined in section 3.8.13, (0,0,0,1) will be returned for a non-
  shadow sampler and 0 for a shadow sampler.

We should probably adopt GLES3's language. (sans shadow sampler language, since we don't have that)

We'd probably have to add the this segment as well to the texture complete definition

The internalformat specified for the texture arrays is a sized internal color format that is not texture-filterable (see table 3.12), and either the magnification filter is not NEAREST or the minification filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
Though we'd have to get rid of the "sized internal color format" requirement since there are no such things in ES 2.0


PS: Initial values for MIN/MAG are in 3.7.12:
  In the initial state, the value assigned to TEXTURE_MIN_FILTER is NEAREST_-
  MIPMAP_LINEAR, and the value for TEXTURE_MAG_FILTER is LINEAR. s and t wrap
  modes are both set to REPEAT.

----- Original Message -----
From: "Benoit Jacob" <bjacob@mozilla.com>
To: "Gregg Tavares" <gman@google.com>
Cc: "public webgl" <public_webgl@khronos.org>
Sent: Wednesday, June 5, 2013 6:40:47 PM
Subject: Re: [Public WebGL] IMPORTANT: Your WebGL floating point texture usage needs to be fixed!!!!

Yup, I was misremembering. Thanks!

Side note: I couldn't find this information anywhere in the GL ES 2.0 spec or in the OpenGL ES or WebGL extension specs.

Side note 2: I also tried to find where in the GL ES 2.0 spec it is said which are the default values for TEXTURE_MIN_FILTER and TEXTURE_MAX_FILTER and couldn't find that information either. The State Tables at the end of the spec say "see 3.7" but I couldn't find that information there.


On 13-06-05 06:41 PM, Gregg Tavares wrote:

It's RGBA=(0,0,0,1)

See OpenGL ES 2.0 spec 2.0.25 section 3.8.2

On Wed, Jun 5, 2013 at 2:07 PM, Benoit Jacob < bjacob@mozilla.com > wrote:

So, we are about to implement this now in Mozilla. Just a question: in
the current specification, when linear filtering is used without
OES_texture_float_linear enabled, should the outcome be RGBA=(0,0,0,0)
texel values as in the case of an incomplete texture?


On 13-05-28 06:21 PM, Gregg Tavares wrote:
> There's was a bug in both Chrome and Firefox which is that the
> OES_texture_float extension should not have allowed linear filtering.
> That bug has been fixed in Chrome Canary.
> To use floating point textures with linear filtering you must get both
> the OES_texture_float and OES_texture_float_linear extensions.
> I suspect this will break the majority of WebGL apps that use floating
> point textures. Fortunately there are not 'that' many and the fix is easy.
> For most of the existing WebGL apps using floating point textures you
> need to do this to get the behavior you were getting previously.
> ext1 = gl.getExtension("OES_texture_float");
> ext2 = gl.getExtension("OES_texture_float_linear");
> Otherwise if OES_texture_float_linear does not exist you can set your
> filtering to NEAREST something like
> ext1 = gl.getExtension("OES_texture_float");
> if (!ext1) {
> alert("no support for floating point textures");
> return;
> }
> ext2 = gl.getExtension("OES_texture_float_linear");
> float_filtering = ext2 ? gl.LINEAR : gl.NEAREST;
> ... when using floating point textures
> gl.texImage2D(,....., gl.FLOAT, ..);
> gl.texParameter(...., gl.TEXTURE_MIN_FILTER, float_filtering);
> gl.texParameter(...., gl.TEXTURE_MAG_FILTER, float_filtering);
> Note: While it's sad this fix broke some apps the apps were already
> broken as many mobile GPUs support OES_texture_float but not
> OES_texture_float_linear. This fix makes it possible for an app to
> tell if a device supports OES_texture_float_linear and take
> appropriate steps.

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:
unsubscribe public_webgl