OpenGL ES 3.0 half float (R16F) textures

2.6k Views Asked by At

Can someone answer me how come this line:

GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0,  GLES30.GL_R16F, width, height, 0,  GLES30.GL_RED, GLES30.GL_HALF_FLOAT, myBuffer);

works on tegra4 but doesn't work on ARM Mali-T628 MP6?

I am not attaching this to a framebuffer by the way, I am using this as a read only texture. The code returned on ARM is 1280 where Tegra 'doesn't complain' at all.

Also, I know that Tegra4 got extension for half float textures, and that specific Mali doesn't have that extension, but since it's OpenGL ES 3.0, shouldn't it support such textures?

1

There are 1 best solutions below

2
On

That call looks completely valid to me. Error 1280 is GL_INVALID_ENUM, which suggests that one of the 3 enum type arguments is invalid. But each one by itself, as well as the combination of them, is spec compliant.

The most likely explanation is a driver bug. I found that several ES 3.0 drivers have numerous issues, so it's not a big surprise to discover problems.


The section below was written under the assumption that the texture would be used as a render target (FBO attachment). Please ignore if you are looking for a direct answer to the question.


GL_R16F is not color-renderable in standard ES 3.0.

If you pull up the spec document, which can be found on www.khronos.org (direct link), table 3.13 on pages 130-132 lists all texture formats and their properties. R16F does not have the checkmark in the "Color-renderable" column, which means that it can not be used as a render target.

Correspondingly, R16F is also listed under "Texture-only color formats" in section "Required Texture Formats" on pages 129-130.

This means that the device needs the EXT_color_buffer_half_float extension to support rendering to R16F. This is still the case in ES 3.1 as well.