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

specify texture format as TEX_FORMAT_R16_SINT #62

Closed
wants to merge 1 commit into from

Conversation

mgood7123
Copy link
Contributor

@mgood7123 mgood7123 commented Jun 28, 2021

specify texture format as TEX_FORMAT_R16_SINT

the texture may be loaded as TEX_FORMAT_R16_UNORM which is not supported everywhere, causing a crash on unsupported devices

specify texture format as TEX_FORMAT_R16_SINT

the texture may be loaded as TEX_FORMAT_R16_UNORM which is not supported everywhere
@TheMostDiligent
Copy link
Contributor

This tutorial requires 16-bit UNORM textures. If they are not supported, the sample can't run. Loading R16UNORM as R16SINT will not work

@mgood7123
Copy link
Contributor Author

This tutorial requires 16-bit UNORM textures. If they are not supported, the sample can't run. Loading R16UNORM as R16SINT will not work

why wont it work? it seems to render perfectly fine on my device

@TheMostDiligent
Copy link
Contributor

Because R16SINT is a signed integer format that can't be filtered. The sample uses filterable texture an it is an error to bind R16SINT texture to such variable.

it seems to render perfectly fine on my device

I would expect the terrain to be at least flat. Otherwise your device may doing its own thing, which is not uncommon for GLES.

@mgood7123
Copy link
Contributor Author

Because R16SINT is a signed integer format that can't be filtered. The sample uses filterable texture an it is an error to bind R16SINT texture to such variable.

it seems to render perfectly fine on my device

I would expect the terrain to be at least flat. Otherwise your device may doing its own thing, which is not uncommon for GLES.

hmmm ok

@mgood7123
Copy link
Contributor Author

mgood7123 commented Jun 30, 2021

This tutorial requires 16-bit UNORM textures. If they are not supported, the sample can't run. Loading R16UNORM as R16SINT will not work

in https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf#subsection.3.8.3

section 3.8.3.2 Encoding of Special Internal Formats

the table below specifies what texture formats meet the "texture filterable" requirements

and TEX_FORMAT_R16_UNORM has a GL counterpart of GL_R16

however in GLES GL_R16 itself does not exist, only

GL_R16I  (not filterable) - TEX_FORMAT_R16_SINT
GL_R16UI (not filterable) - TEX_FORMAT_R16_UINT
GL_R16F  (filterable)     - TEX_FORMAT_R16_FLOAT
GL_R32F  (not filterable) - TEX_FORMAT_R32_FLOAT
    (NOTE: as stated by the table in the pdf GLES 3.0 specification)

could the texture be converted to TEX_FORMAT_R16_FLOAT if GL_EXT_texture_norm16 is not available?

@TheMostDiligent
Copy link
Contributor

Yes, it may be possible, but 16-bit floats are a bit tricky.

@mgood7123
Copy link
Contributor Author

Yes, it may be possible, but 16-bit floats are a bit tricky.

because of stuff like 3.4646 instead of 3?

@TheMostDiligent
Copy link
Contributor

Mostly because there is no native support in CPUs and programming languages, so the conversion from float32 to float16 has to be done manually.
This tutorial is just an example, originally intended for desktop GPUs. It is not impossible to make it run on Androids that don't support 16-bit UNORMs, but just not important at the moment.

@mgood7123
Copy link
Contributor Author

Mostly because there is no native support in CPUs and programming languages, so the conversion from float32 to float16 has to be done manually.
This tutorial is just an example, originally intended for desktop GPUs. It is not impossible to make it run on Androids that don't support 16-bit UNORMs, but just not important at the moment.

fair enough :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants