Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PBO/textures on ATI

  1. #1
    Junior Member Regular Contributor pjcozzi's Avatar
    Join Date
    Jun 2004
    Location
    Philadelphia, PA
    Posts
    196

    PBO/textures on ATI

    Hi,

    I have some PBO/texture code that works on NVIDIA but not ATI. On NVIDIA, the scene looks like:



    On ATI, it looks like the alignment is off:



    This is using a 5400x2700 RGB texture. If I resize the texture to 2700x1350 or add an alpha component, it works on ATI. Perhaps this is related to a bug we discussed a while back: ATI: glTexImage2D with large texture doesn't work.

    Here is the code for each texture:

    5400x2700 RGB (works on NVIDIA, artifacts on ATI)
    Code :
    glGenBuffers(1,&buffer);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB,43740000,0,GL_STREAM_DRAW);
    glBufferSubData(GL_PIXEL_UNPACK_BUFFER_ARB,0,43740000,data);
     
    glGenTextures(1,&texture);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,0);
    glBindTexture(GL_TEXTURE_2D,texture);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,5400,2700,0,GL_RGB,GL_UNSIGNED_BYTE,0);
     
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glPixelStorei(GL_UNPACK_ALIGNMENT,4);
    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,5400,2700,GL_BGR,GL_UNSIGNED_BYTE,0);
    glDeleteBuffers(1,&buffer);
    2700x1350 RGB (works on both NVIDIA and ATI)
    Code :
    glGenBuffers(1,&buffer);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB,10935000,0,GL_STREAM_DRAW);
    glBufferSubData(GL_PIXEL_UNPACK_BUFFER_ARB,0,10935000,data);
     
    glGenTextures(1,&texture);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,0);
    glBindTexture(GL_TEXTURE_2D,texture);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,2700,1350,0,GL_RGB,GL_UNSIGNED_BYTE,0);
     
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glPixelStorei(GL_UNPACK_ALIGNMENT,4);
    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,2700,1350,GL_BGR,GL_UNSIGNED_BYTE,0);
    glDeleteBuffers(1,&buffer);
    5400x2700 RGBA (works on both NVIDIA and ATI)
    Code :
    glGenBuffers(1,&buffer);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB,58320000,0,GL_STREAM_DRAW);
    glBufferSubData(GL_PIXEL_UNPACK_BUFFER_ARB,0,58320000,data);
     
    glGenTextures(1,&texture);
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,0);
    glBindTexture(GL_TEXTURE_2D,texture);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,5400,2700,0,GL_RGB,GL_UNSIGNED_BYTE,0);
     
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,buffer);
    glPixelStorei(GL_UNPACK_ALIGNMENT,4);
    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,5400,2700,GL_BGRA,GL_UNSIGNED_BYTE,0);
    glDeleteBuffers(1,&buffer);
    Here are the textures:

    I thought this could have something to do with my call to glPixelStorei, but I verified the data is indeed 4 byte aligned.

    I tested using a Radeon HD 5870 with Catalyst 10.11 on Vista 64.

    Thanks,
    Patrick

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    Posts
    669

    Re: PBO/textures on ATI

    I experience the same problem on ATI FireGL V5200 (8.593 Drivers, quite old). Uploading an RGB texture as 1024x1024 works, going above results in garbage (as if the unpack alignment is not right, but I DO set the alignment correctly to 1 before uploading te image). I do not use PBOs, though.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Nov 2009
    Location
    France
    Posts
    114

    Re: PBO/textures on ATI

    we just fixed an issue with texture uploads when size>2^23, this is not available in a public driver yet, but should address the issue for recent hardware.
    this will not do anything for ATI FireGL V5200 though. have you tried using a more recent driver ?
    Pierre B.
    AMD Fellow

  4. #4
    Junior Member Regular Contributor pjcozzi's Avatar
    Join Date
    Jun 2004
    Location
    Philadelphia, PA
    Posts
    196

    Re: PBO/textures on ATI

    Quote Originally Posted by Pierre Boudier
    we just fixed an issue with texture uploads when size>2^23, this is not available in a public driver yet, but should address the issue for recent hardware.
    I will retest when this driver is available. Thanks.

    I assume you mean 2^23 bytes. It looks like it is not a problem with all textures greater than this size because all my textures are larger than 2^23, and two out of three of them work.

    Regards,
    Patrick

  5. #5
    Junior Member Regular Contributor
    Join Date
    Nov 2009
    Location
    France
    Posts
    114

    Re: PBO/textures on ATI

    yes, the issue is not for all texture formats

    Pierre B.
    Pierre B.
    AMD Fellow

  6. #6
    Junior Member Regular Contributor pjcozzi's Avatar
    Join Date
    Jun 2004
    Location
    Philadelphia, PA
    Posts
    196

    Re: PBO/textures on ATI

    Quote Originally Posted by Pierre Boudier
    we just fixed an issue with texture uploads when size>2^23, this is not available in a public driver yet, but should address the issue for recent hardware.
    this will not do anything for ATI FireGL V5200 though. have you tried using a more recent driver ?
    I just tried Catalyst 10.12 and still experience the issue.

    Thanks,
    Patrick

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    989

    Re: PBO/textures on ATI

    I would suggest you to use multiple TexSubImage calls so that you could stay under the implementation limitation on the amount of bytes possible to be transferred. I know it is just a workaround but it should be good until the issue is not solved.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: PBO/textures on ATI

    What happens if you try GL_BGRA?

  9. #9
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    989

    Re: PBO/textures on ATI

    mhagain is in fact right. As I've seen BGRA worked on both cards, and is the best choice performance-wise, even though it could consume more memory and bandwidth, it is a native format and TexSubImage would perform better with that (no need for internal repack otherwise needed as 8-bit three-component formats are always promoted to BGRX anyway).
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  10. #10
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,478

    Re: PBO/textures on ATI

    Quote Originally Posted by aqnuep
    mhagain is in fact right. As I've seen BGRA worked on both cards, and is the best choice performance-wise, even though it could consume more memory and bandwidth, it is a native format and TexSubImage would perform better with that (no need for internal repack otherwise needed as 8-bit three-component formats are always promoted to BGRX anyway).
    In terms of "best choice performance-wise", consider DXT1. Unless the driver is buggy, this is a [B]much, much better choice for performance and memory consumption:
    Code :
    BGRA8/RGBA8 - 32 bits/texel
    BGR8/RGB8   - 24 bits/texel
    DXT1        -  4 bits/texel
    For many apps, DXT1 quality is fine, and it is a lot better than the avg number of bits/texel suggests!

    Though if you do need better brightness/color quality but still don't want to eat the huge mem/bandwidth consumption of RGB8/BGR8, consider YCoCg encoded into DXT5 textures (8 bits/texel).

Posting Permissions

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