Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

floating point textures are pixel slurry on iOS #45

Closed
Mwni opened this issue Jul 22, 2021 · 7 comments
Closed

floating point textures are pixel slurry on iOS #45

Mwni opened this issue Jul 22, 2021 · 7 comments

Comments

@Mwni
Copy link

Mwni commented Jul 22, 2021

When trying to sample from a floating point texture (RGBA32F/FLOAT), you get random pixels. See attached screenshot below

The texture has been cleared with color (0, 0, 0, 0), so unfortunately, as shown above, this is not just a matter of floats being interpreted as ints. Sadly I cannot confirm that the texture is actually filled with (0, 0, 0, 0), since gl.readPixels() does not write anything.

Is there some maybe flag missing that tells the backend "this is a float texture"?

@triniwiz
Copy link
Member

Thanks for trying this those numbers should be passed to gl as floats {N} - > ios as for readPixels I followed a web impl a bit so I feel this may be causing an issue with what is returned . Feel free to share the code you used to test

@Mwni
Copy link
Author

Mwni commented Jul 22, 2021

I did pass floats and it seems the issue is not with the texture itself, but rather its sampling in a fragment shader (using texture(tex, uv))
Are float textures expected to actually work on iOS? I will post my isolated code if they SHOULD work.

@triniwiz
Copy link
Member

If possible try running this on a real device an lmk

@Mwni
Copy link
Author

Mwni commented Jul 22, 2021

Okay, on device the texture is just blank instead of messy, regardless what color value i write to it using clear.Works with uint8 textures.

@Mwni
Copy link
Author

Mwni commented Jul 22, 2021

I noticed the call to getExtention('WEBGL_color_buffer_float') returns some constants, notably "RGBA32F_EXT": 34836. Should this one maybe be used instead of gl.RGBA32F?

@triniwiz
Copy link
Member

triniwiz commented Sep 6, 2021

Can you try this again an lmk

@Mwni
Copy link
Author

Mwni commented Sep 9, 2021

Yes, this is working perfectly now. Thank you!

@Mwni Mwni closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants