Imagination PowerVR SDK Blog

Issue with PVRVFrame GL_OES_texture_half_float / GL_EXT_color_buffer_half_float

pvrvframe

#1

I have an issue using texture with unsized internal format GL_RGBA and GL_HALF_FLOAT_OES type in framebuffer color attachment in PVRFrame.

This creates a texture which works as expected:

  • glTexStorage2D(target = GL_TEXTURE_2D, levels = 1, internalformat = GL_RGBA16F, width = 64, height = 64)

This also creates a texture which works as expected:

  • glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_RGBA16F, width = 64, height = 64, border = 0, format = GL_RGBA, type = GL_HALF_FLOAT, pixels = 0)

This creates a texture which seems to be clamped (maybe to 1.0f?):

  • glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_RGBA, width = 64, height = 64, border = 0, format = GL_RGBA, type = GL_HALF_FLOAT_OES, pixels = 0)

I would expect GL_HALF_FLOAT_OES work similar to GL_HALF_FLOAT, but this does not appear to be the case with PVRFrame.

Tested wirth PVRVFrame 10.2 - None (Host : GeForce GTX 760/PCIe/SSE2) (SDK Build: 4.0@3835662).


#2

Hi Timo,
Do you mean you created two frame buffers with two texture GL_RGBA and GL_RGBA16F_EXT.For the GL_RGBA one you always get color value clamp to 1.0f?

I can not reproduce this locally.

Thanks,
Kevin


#3

Hi Timo,
I think I can reproduce this issue now by the following code:
glGenFramebuffers(1,&m_FP16FBO);
glBindFramebuffer(GL_FRAMEBUFFER,m_FP16FBO);
glGenTextures(1, &m_FP16ColourAttachment);
glBindTexture(GL_TEXTURE_2D, m_FP16ColourAttachment);
glTexImage2D(GL_TEXTURE_2D, 0, /*internalformat = */GL_RGBA, c_uiRenderTargetSize, c_uiRenderTargetSize, 0, GL_RGBA, GL_HALF_FLOAT_OES, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_FP16ColourAttachment, 0);
Then pixel channels will be clamped to [0, 1] for this render target.
But according to this EXT_color_buffer_half_float extension.
This type(GL_HALF_FLOAT_OES) texture should work with the following format:
RGBA16F_EXT 0x881A
RGB16F_EXT 0x881B
RG16F_EXT 0x822F
R16F_EXT 0x822D
So the internalformat should be RGBA16F_EXT, and the result will work as expected.

Thanks,
Kevin


#4

Thank you, this makes sense.

It is unfortunate that GL_EXT_color_buffer_half_float does not explicitly allow RGBA16F_EXT format with textures. Is there language anywhere which would say that renderbuffer formats can also be used with glTexImage2D() for example? If I strictly read GL_EXT_color_buffer_half_float, it only allows RGBA16F_EXT to be used with renderbuffers, not with textures.