How to use floating point texture on Android NDK r8d with PowerVR SGX 544MP

This topic contains 5 replies, has 3 voices, and was last updated by  Joe Davis 4 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #31294

    imaizumi
    Member

    I would like to use GPU as GPGPU.
    Typical sequence is following.
    1. Specify memory floating point data to texture by glTexImage2D
    2. Process texture data by shader program
    3. Pull processed data as floating point data by glReadPixels
    As a first step, I would like to get simple code sample (only step 1 and 3).

    SGX 544MP supports GL_OES_texture_float.
    But I don’t know how to use it.

    For Tegra3, following program is working

    // Create Texture Object
    glGenTextures(1, texture);
    glBindTexture(GL_TEXTURE_2D, texture[0]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 10, 5, 0, GL_RGBA, GL_HALF_FLOAT_OES, float_data);

    // Create Frame Buffer Object
    glGenFramebuffers(1, framebuffers);

    // Bind FBO to Frame Buffer
    glBindFramebuffer(GL_FRAMEBUFFER, framebuffers[0]);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);

    // Check FBO setting
    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (status != GL_FRAMEBUFFER_COMPLETE) {
    LOGE("framebuffer creation failed: %x", status);
    }

    // Get data from texture
    GLfloat fOutData[100] = {0.0f};
    glReadPixels(0, 0, 10, 5, GL_RGBA, GL_HALF_FLOAT_OES, fOutData);

    My developing environment is following.
    Device : Galaxy S4 (GT-I9500), GPU is PowerVR SGX 544MP
    OS : Android NDK r8d

    Thank you in advance for your help!

    #37373

    Joe Davis
    Member

    Hi Imaizumi,

    Sorry for the delayed response. GL_OES_texture_float allows an application to use floating point textures. You would need an additional extension to render to a floating point target (e.g. EXT_color_buffer_half_float). Unfortunately, this extension is not exposed on the PowerVR Galaxy S 4.

    However – the S4 does support OpenCL. You can use this API for your GPGPU work instead 🙂

    Regards,
    Joe

    #37374

    imaizumi
    Member

    Hi Joe,

    Thanks so much for your reply.
    I understood that we can not floating point texture on PowerVR Galaxy S4.

    For OpenCL, I found libPVROCL.so in /system/vendor/lib on Galaxy S4(GT-I9500).
    I will try to use OpenCL by loading this library.
    But Android doesn’t support OpenCL officially.
    Is this hacking technique?

    Regards,
    Imaizumi

    #37375

    Joe Davis
    Member

    Hi,

    We cannot make any official statements about the intentions of our customers. We believe these libraries are currently intended for internal use only. They are unlikely to be supported until Samsung publicly announce OpenCL support on their Android platforms (which may or may not happen).

    Regards,
    Joe

    #37376

    airion
    Member

    Hello,
    I have the same problem with an PowerVR SGX 544MP on a OMAP5. Is rendering to float textures on this system also not possible, or is it just not implemented in the driver?
    Kind regards,
    Alexander

    #37377

    Joe Davis
    Member

    Hi Alexander,

    Rendering to float textures is not a core feature of the OpenGL ES 2.0 API. As mentioned above, the presence of the EXT_color_buffer_half_float extension would allow you to render to half-float targets. You should discuss this with your platform provider to see if it’s possible to expose the extension (if it’s not already there).

    Regards,
    Joe

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.