Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Slow app due to glCopyTexSubImage2D()

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2005
    Location
    Livermore, CA
    Posts
    4

    Slow app due to glCopyTexSubImage2D()

    Hello All,

    I've recently implemented a simple wavelet transform in OpenGL/Cg. It works, but it's nowhere near as fast as I need it to be and I'm attempting to optimize it. I can see where the slowdowns are, but I lack the knowledge of how to fix them.

    Here is how the system works: An input image and a lookup table (LUT) are loaded into two textures. Two pbuffers (TEMP and FINAL) are created. A result texture (to hold the resulting wavelet coefficients) is created.

    During the transform process, the input image is bound as the source texture (texture unit 0) and the LUT is bound to texture unit 1. The X-pass of the transform renders to the TEMP pbuffer, which is bound as a texture and used as the input to the Y-pass. The Y-pass renders to the FINAL pbuffer, the result texture is bound, and the contents of the FINAL pbuffer are copied into the result texture using glCopyTexSubImage2D().

    My MAJOR slowdown is the call to glCopyTexSubImage2D(). The copy is much slower than the rendering passes, and the time taken is directly proportional to the size of data being copied.

    All textures (and pbuffers) are formatted GL_RGBA, type GL_UNSIGNED_INT_8_8_8_8. The LUT texture is GL_TEXTURE_2D, all others are GL_TEXTURE_RECTANGLE_EXT. Pbuffers are GL_TEXTURE_RECTANGLE_EXT as well. As far as I can tell, all textures are resident. A check using the standard OpenGL calls reports GL_FALSE the first time each texture is bound, and GL_TRUE after that.

    The pixel format used to create the CGL context is apparently being hardware accelerated (kCGLPFAAccelerated = GL_TRUE, kCGLPFARendererID = 0x00021802).

    My current system is a 1.3 GHz 17" PowerBook G4 with a Radeon 9600 XT chipset.

    Any ideas as to the cause of the slowdown? What can I do to make this faster?

    Thanks!

    -Josh Senecal

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: Slow app due to glCopyTexSubImage2D()

    First steps: profile your application with Shark. What % CPU time is your application using? In your app, what is the top bottleneck or two?

    Also, how are you measuring the time taken by the copy? And what are the actual internal formats of the pbuffer and texture you're copying between (remember, the GL is free to choose an internal format "close" to the one you ask for.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •