cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
45 stars 16 forks source link

RGBA 16-bit FrameBuffer Incomplete crashes in Firefox #746

Open sebastianpetrovski opened 6 months ago

sebastianpetrovski commented 6 months ago

Link to simple, reproducible example patch https://cables.gl/p/NO0Frb

Describe the bug

Firefox doesn't seem to like RGBA 16-bit although MDN says they support it: https://developer.mozilla.org/en-US/docs/Web/API/EXT_color_buffer_half_float

How To Reproduce

If both RenderToTexture and ImageCompose set to RGBA 16-bit it crashes in Firefox with the following error and console messages. image

image

If RenderToTexture is disconnected from mainloop and an empty image compose is connected to mainloop you get the following message. image

If RenderToTexture is connected to mainloop and set to RGBA32bit with texture into RGBA 16-bit image compose it works but throws the following in the console. image

If you change the RenderToTexture from RGBA 32-bit to RGBA 16-bit while the patch is active it just keeps running without any error or additional messages in the console. If you save and reload the patch, then you get the errors as at the top of this post.

Platform Firefox on Windows 11 Desktop PC

pandrr commented 6 months ago

please set the patch to unlisted with editor, so we can have a look

sebastianpetrovski commented 6 months ago

Hey pandrr, sorry I thought I had done that, it is unlisted and editor allowed now: https://cables.gl/p/NO0Frb

pandrr commented 6 months ago

thanks, i could reproduce it easily. this is really strange.

on dev.cables.gl it will fallback to 32bit floats texture,if the half_float extension is not available. which i could swear was always available

pandrr commented 6 months ago

also hotfixed on cables.gl ... let me know if you find any more problems

sebastianpetrovski commented 6 months ago

Hey,

Awesome, this is working for me too. Thank you!

May I ask you, what set-up do you recommend for max quality and compatibility?

I've been using 16bit because it seems like a good middle ground; there's little to no banding and I assumed half float is less heavy to process than full float, but I'm realising I may have been wrong about this.

Since this bug I tried to research compability for 8, 16 and 32 RGBA and found mixed information. Some websites seem to suggest 32bit is more broadly supported than 16bit and your comment on a fallback to 32bit also suggests this.

Was just looking at this old article on reddit which seems to suggest 32bit is generally native at the hardware level and computing/rendering 16bit is actually more complex: https://www.reddit.com/r/gamedev/comments/73kbvu/why_isnt_16bit_precision_half_precision_used_in/

So now I'm thinking is it better to string multiple 32bit imagecompose together and have the last one be 8bit? Does that even make a difference or may as well do all at 32bit?

pandrr commented 6 months ago

i try to use 16bit, because on ios 32bit is a problem somehow (cables downgrades to 16bit in that case)

if you don't have too many big textures 32bit should be totally fine

sebastianpetrovski commented 6 months ago

Ok, thank you that is really good to know!