renderable texture formats in WebGL 2 ?

1,232 views
Skip to first unread message

Evgeny Demidov

unread,
Oct 22, 2014, 6:06:42 AM10/22/14
to webgl-d...@googlegroups.com
in short, what can (shall) I write e.g. in
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, n, n, 0, gl.RGBA32F,
gl.FLOAT, pix);
(or TexStorage2D :)

Can I render into Float textures in WebGL 2?
Or shall I use RGBA32UI and uintBitsToFloat (then how can I initialise
these textures in Java Script)?

Or shall I use WebGL 1 :)

Egeny

p.s.
I can bind AttribLocations in Aurora
gl.bindAttribLocation(prog, aPosLoc, "aPos");
gl.bindAttribLocation(prog, aTexLoc, "aTexCoord");
but renderable texture formats in WebGL is the next question for
simulations on GPU.
Sorry I disturb you.

Benoit Jacob

unread,
Oct 22, 2014, 11:55:16 AM10/22/14
to WebGL Dev List
In general, renderable formats in WebGL2 should be the same as renderable formats in ES3, so you should be able to look up the answer to such questions in the ES3 spec directly, and file bugs against WebGL2 implementations if they depart from that.

There might be exceptions, but I'm not aware of any.

Now looking at the specific RGBA32F format you're asking about, according to Table 3.13 in the ES 3.0.3 spec
https://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.3.pdf
(page 130)
it doesn't seem to be considered color-renderable.

On the other hand, RGBA32UI is color-renderable.

What I don't know is whether some WebGL2 extension to allow rendering to float texture is being considered. Maybe check mailing list archives or ask on public_webgl.

Benoit



--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-list+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeff Dash

unread,
Oct 22, 2014, 1:41:58 PM10/22/14
to webgl-d...@googlegroups.com
We would probably support color_buffer_[half_]float where available.

FWIW might be internalFormat/format/type RGBA32F/RGBA/FLOAT, but I could be wrong.

To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.

Mark Callow

unread,
Oct 23, 2014, 12:11:11 AM10/23/14
to webgl-d...@googlegroups.com

On 23/10/2014 02:41, Jeff Dash wrote:
We would probably support color_buffer_[half_]float where available.

FWIW might be internalFormat/format/type RGBA32F/RGBA/FLOAT, but I could be wrong.

On Wed, Oct 22, 2014 at 8:55 AM, Benoit Jacob <jacob.b...@gmail.com> wrote:
In general, renderable formats in WebGL2 should be the same as renderable formats in ES3, so you should be able to look up the answer to such questions in the ES3 spec directly, and file bugs against WebGL2 implementations if they depart from that.

There might be exceptions, but I'm not aware of any.

Now looking at the specific RGBA32F format you're asking about, according to Table 3.13 in the ES 3.0.3 spec
https://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.3.pdf
(page 130)
it doesn't seem to be considered color-renderable.

On the other hand, RGBA32UI is color-renderable.

What I don't know is whether some WebGL2 extension to allow rendering to float texture is being considered. Maybe check mailing list archives or ask on public_webgl.

There is an extension proposed for this: EXT_color_buffer_float. This wraps the OpenGL ES 3 extension of the same name with no changes. The extension says

When this extension is enabled:

The following floating-point internal formats become color-renderable: R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F and R11F_G11F_B10F.

The extension can easily be promoted to draft, if one of the WebGL 2 implementers is ready to implement it.

Use of unsized internal formats (e.g. RGB, RGBA) is not recommended. However there is a table in the OpenGL ES 3.0 spec giving the effective internal format for textures created using unsigned formats. If the effective internal format is one of those listed above, you can render to it.

@Jeff Dash Please do not implement [WEBGL,OES]_color_buffer_[half_]float, unless of course you intend to do so on a WebGL 1 implementation.

Regards

Ā Ā Ā Ā -Mark

--
ę³Øę„ļ¼šć“ć®é›»å­ćƒ”ćƒ¼ćƒ«ć«ćÆć€ę Ŗå¼ä¼šē¤¾ć‚Øć‚¤ćƒć‚¢ć‚¤ć®ę©ŸåÆ†ęƒ…å ±ćŒå«ć¾ć‚Œć¦ć„ć‚‹å “åˆćŒęœ‰ć‚Šć¾ć™ć€‚ę­£å¼ćŖćƒ”ćƒ¼ćƒ«å—äæ”č€…ć§ćÆē„”ć„å “åˆćÆćƒ”ćƒ¼ćƒ«č¤‡č£½ć€ å†é…äæ”ć¾ćŸćÆęƒ…å ±ć®ä½æē”Øć‚’å›ŗćē¦ć˜ć¦ćŠć‚Šć¾ć™ć€‚ć‚Øćƒ©ćƒ¼ć€ę‰‹é•ć„ć§ć“ć®ćƒ”ćƒ¼ćƒ«ć‚’å—ć‘å–ć‚‰ć‚Œć¾ć—ćŸć‚‰å‰Šé™¤ć‚’č”Œć„é…äæ”č€…ć«ć”é€£ēµ”ć‚’ćŠé”˜ć„ć„ćŸć— ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.

Mark Callow

unread,
Oct 23, 2014, 12:12:59 AM10/23/14
to webgl-d...@googlegroups.com

On 23/10/2014 00:55, Benoit Jacob wrote:
What I don't know is whether some WebGL2 extension to allow rendering to float texture is being considered. Maybe check mailing list archives or ask on public_webgl.

Or simply check the WebGL extension registry. Doh!

Jeff Dash

unread,
Oct 23, 2014, 12:25:14 AM10/23/14
to webgl-d...@googlegroups.com
The color_buffer_* extensions are already at Draft status, and Firefox implements them for WebGL1 behind our draft extensions flag.

For portability, I would recommend doing high-precision RTT with fixed-point math and RGBA32UI. (or 16-bit, if that's enough)

Using RGBA32F isn't supported for `format`, I believe. It looks to me like an (internalFormat, format, type) tuple is valid if:
* `internalFormat` is a sized type, and it matches the effective internal format of (format, type).
* `internalFormat` matches `format`, but (format, type) specify a valid effective internal format.

Thus an RGBA32F upload would have an (internalFormat, format, type) of (RGBA32F, RGBA, FLOAT). If I'm misreading the spec here, let me know!

-Jeff

--

Olli Etuaho

unread,
Oct 23, 2014, 4:12:13 AM10/23/14
to webgl-d...@googlegroups.com
Do note that the WebGL 2 extension is most likely going to be different from the WebGL 1 extensions. For WebGL 1, there's two extensions, WEBGL_color_buffer_float and EXT_color_buffer_half_float, and in addition rendering to float textures can be implicitly enabled when only OES_texture_float is requested. In WebGL 2 I'd expect this to be cleaned up and the replacement extension EXT_color_buffer_float (currently in proposed) would expose rendering to the GLES3 float texture formats.

Mark Callow

unread,
Oct 23, 2014, 6:27:19 AM10/23/14
to webgl-d...@googlegroups.com

On 23/10/2014 13:25, Jeff Dash wrote:
The color_buffer_* extensions are already at Draft status, and Firefox implements them for WebGL1 behind our draft extensions flag.

I'm glad to hear somebody has finally implemented WEBGL_color_buffer_float.

Note that these extensions are not suitable for WebGL 2.0.



For portability, I would recommend doing high-precision RTT with fixed-point math and RGBA32UI. (or 16-bit, if that's enough)

Before going to this hassle, I would first find out how widespread support for EXT_color_buffer_float is on ES 3.0. As far as I know, all ES 3.x hardware is capable of supporting it. Availability, or not, is a commercial not technical issue.



Using RGBA32F isn't supported for `format`, I believe. It looks to me like an (internalFormat, format, type) tuple is valid if:
* `internalFormat` is a sized type, and it matches the effective internal format of (format, type).
* `internalFormat` matches `format`, but (format, type) specify a valid effective internal format.

Thus an RGBA32F upload would have an (internalFormat, format, type) of (RGBA32F, RGBA, FLOAT). If I'm misreading the spec here, let me know!

Which spec. are you talking about? RGBA32F textures can be uploaded in ES 3.0 core using the above tuple. They are not filterable though.

ES 2.0 does not support setting of internal format to a sized type.

Kenneth Russell

unread,
Oct 28, 2014, 5:38:29 PM10/28/14
to webgl-d...@googlegroups.com
On Wed, Oct 22, 2014 at 9:11 PM, Mark Callow <callo...@artspark.co.jp> wrote:

On 23/10/2014 02:41, Jeff Dash wrote:
We would probably support color_buffer_[half_]float where available.

FWIW might be internalFormat/format/type RGBA32F/RGBA/FLOAT, but I could be wrong.

On Wed, Oct 22, 2014 at 8:55 AM, Benoit Jacob <jacob.b...@gmail.com> wrote:
In general, renderable formats in WebGL2 should be the same as renderable formats in ES3, so you should be able to look up the answer to such questions in the ES3 spec directly, and file bugs against WebGL2 implementations if they depart from that.

There might be exceptions, but I'm not aware of any.

Now looking at the specific RGBA32F format you're asking about, according to Table 3.13 in the ES 3.0.3 spec
https://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.3.pdf
(page 130)
it doesn't seem to be considered color-renderable.

On the other hand, RGBA32UI is color-renderable.

What I don't know is whether some WebGL2 extension to allow rendering to float texture is being considered. Maybe check mailing list archives or ask on public_webgl.

There is an extension proposed for this: EXT_color_buffer_float. This wraps the OpenGL ES 3 extension of the same name with no changes. The extension says

When this extension is enabled:

The following floating-point internal formats become color-renderable: R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F and R11F_G11F_B10F.

The extension can easily be promoted to draft, if one of the WebGL 2 implementers is ready to implement it.

Let's promote the EXT_color_buffer_float extension to draft status now. It's required for WebGL 2.0 to have feature parity with WebGL 1.0, and the earlier it's available, the better for developers. Comments / objections?

-Ken


Use of unsized internal formats (e.g. RGB, RGBA) is not recommended. However there is a table in the OpenGL ES 3.0 spec giving the effective internal format for textures created using unsigned formats. If the effective internal format is one of those listed above, you can render to it.

@Jeff Dash Please do not implement [WEBGL,OES]_color_buffer_[half_]float, unless of course you intend to do so on a WebGL 1 implementation.

Regards

Ā Ā Ā Ā -Mark

--
ę³Øę„ļ¼šć“ć®é›»å­ćƒ”ćƒ¼ćƒ«ć«ćÆć€ę Ŗå¼ä¼šē¤¾ć‚Øć‚¤ćƒć‚¢ć‚¤ć®ę©ŸåÆ†ęƒ…å ±ćŒå«ć¾ć‚Œć¦ć„ć‚‹å “åˆćŒęœ‰ć‚Šć¾ć™ć€‚ę­£å¼ćŖćƒ”ćƒ¼ćƒ«å—äæ”č€…ć§ćÆē„”ć„å “åˆćÆćƒ”ćƒ¼ćƒ«č¤‡č£½ć€ å†é…äæ”ć¾ćŸćÆęƒ…å ±ć®ä½æē”Øć‚’å›ŗćē¦ć˜ć¦ćŠć‚Šć¾ć™ć€‚ć‚Øćƒ©ćƒ¼ć€ę‰‹é•ć„ć§ć“ć®ćƒ”ćƒ¼ćƒ«ć‚’å—ć‘å–ć‚‰ć‚Œć¾ć—ćŸć‚‰å‰Šé™¤ć‚’č”Œć„é…äæ”č€…ć«ć”é€£ēµ”ć‚’ćŠé”˜ć„ć„ćŸć— ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.

--

Mark Callow

unread,
Oct 29, 2014, 2:19:37 AM10/29/14
to webgl-d...@googlegroups.com

On 29/10/2014 06:38, Kenneth Russell wrote:

Let's promote the EXT_color_buffer_float extension to draft status now. It's required for WebGL 2.0 to have feature parity with WebGL 1.0, and the earlier it's available, the better for developers. Comments / objections?

I submitted a pull request to move it to draft.

Olli Etuaho

unread,
Oct 29, 2014, 11:32:30 AM10/29/14
to webgl-d...@googlegroups.com

I am very much in favor of moving EXT_color_buffer_float to draft. The cleanup done in the pull request looks good.


From: webgl-d...@googlegroups.com <webgl-d...@googlegroups.com> on behalf of Mark Callow <callo...@artspark.co.jp>
Sent: Wednesday, October 29, 2014 8:19 AM
To: webgl-d...@googlegroups.com
Subject: Re: [webgl-dev-list] renderable texture formats in WebGL 2 ?
Ā 
--
You received this message because you are subscribed to a topic in the Google Groups "WebGL Dev List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/webgl-dev-list/g4w_5JmrM3M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webgl-dev-lis...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

This email message is for the sole use of the intended recipient(s) and may contain confidential information.Ā  Any unauthorized review, use, disclosure or distribution is prohibited.Ā  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

Kenneth Russell

unread,
Oct 29, 2014, 1:00:18 PM10/29/14
to webgl-d...@googlegroups.com
Merged. Thanks for the contribution and cleanups.


--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages