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

Jeff Gilbert [email protected]
Wed Jun 5 19:24:50 PDT 2013


Benoit appears to be technically correct.

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.

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)

-Jeff

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" <[email protected]>
To: "Gregg Tavares" <[email protected]>
Cc: "public webgl" <[email protected]>
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. 

Benoit 

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 < [email protected] > 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? 

Benoit 



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 [email protected] . 
To unsubscribe, send an email to [email protected] with 
the following command in the body of your email: 
unsubscribe public_webgl 
----------------------------------------------------------- 




-----------------------------------------------------------
You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------





More information about the public_webgl mailing list