Forums - Adreno320: how to create color-renderable half-float texture

4 posts / 0 new
Last post
Adreno320: how to create color-renderable half-float texture
torstenrohlfing
Profile picture
Join Date: 11 Dec 14
Location: Mountain View
Posts: 4
Posted: Thu, 2014-12-11 09:40
I am trying to create a color-renderable texture (to attach to a framebuffer) on a Nexus4 with Adreno320 chipset using GLES 2.0. The driver reports both GL_EXT_color_buffer_half_float and GL_OES_texture_half_float extensions as supported. 
 
The following call (which succeeds on a range of other devices) fails with "GL_INVALID_OPERATION":
    GLES20.glTexImage2D(
          GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA16F_EXT, width, height, 0, GLES20.GL_RGBA, GL_HALF_FLOAT_OES, null);
 
Calling the following instead succeeds:
   GLES20.glTexImage2D(
          GLES20.GL_TEXTURE_2D, 0, GL_RGBA_EXT, width, height, 0, GLES20.GL_RGBA, GL_HALF_FLOAT_OES, null);
 
But then the subsequent call to bind the texture leaves the framebuffer "attachment incomplete":
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
        GLES20.GL_TEXTURE_2D, textureHandle, 0);
 
This behaviour is the same on devices running both Android JellyBean and KitKat.
 
What is the proper way to create a half-float, color-renderable, framebuffer-attachable texture on this hardware?
 
Thanks!
  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Mon, 2015-01-05 11:39

The glTexImage2D call should be ok:

GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GL_RGBA_EXT, width, height, 0, GLES20.GL_RGBA, GL_HALF_FLOAT_OES, null);

 

Can you review the following link for clues on why the incomplete framebuffer message might be generated?

https://www.opengl.org/wiki/Framebuffer_Object

  • Up0
  • Down0
torstenrohlfing
Profile picture
Join Date: 11 Dec 14
Location: Mountain View
Posts: 4
Posted: Wed, 2015-01-07 15:18

Thanks for the hint - I assume you are referring to the following list of completeness requirements:

 

* The source object for the image still exists and has the same type it was attached with.

 

The texture is created immediately before attaching it to the framebuffer, so it should still be there and have the same type.

 

* The image has a non-zero width and height (the height of a 1D image is assumed to be 1). The width/height must also be less than GL_MAX_FRAMEBUFFER_WIDTH​ and GL_MAX_FRAMEBUFFER_HEIGHT​ respectively (if GL 4.3/ARB_framebuffer_no_attachments).

 

Image is 1920x1080; driver won't let me query GL_MAX_FRAMEBUFFER_WIDTH and GL_MAX_FRAMEBUFFER_HEIGHT, but the device can handle this exact size with full float textures, so I am going to assume the size is fine for half-float as well.

 

* The layer for 3D or array textures attachments is less than the depth of the texture. It must also be less than GL_MAX_FRAMEBUFFER_LAYERS​ (if GL 4.3/ARB_framebuffer_no_attachments).

 

2D texture; does not apply.

 

* The number of samples must be less than GL_MAX_FRAMEBUFFER_SAMPLES​ (if GL 4.3/ARB_framebuffer_no_attachments).

 

Only one sample.

 

* The image's format must match the attachment point's requirements, as defined above. Color-renderable formats for color attachments, etc.

 

According to the driver, half-float is color-renderable ("GL_EXT_color_buffer_half_float").

 

Am I missing something?

  • Up0
  • Down0
torstenrohlfing
Profile picture
Join Date: 11 Dec 14
Location: Mountain View
Posts: 4
Posted: Wed, 2015-01-07 15:19

A bit of additional information I found today - on Nexus 5, the half-float framebuffer fails as described when the device runs Kitkat, but succeeds under Lollipop.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.