ATI: glTexImage2D with large texture doesn't work

Hi,

The following call to glTexImage2D creates an incorrect texture on my ATI Radeon HD 4350 with updated drivers:


glTexImage2D(
   GL_TEXTURE_2D,
   0,
   GL_RGB8,
   2731,     // width
   512,	     // height
   0,
   GL_BGR,
   GL_UNSIGNED_BYTE,
   pixels);

Anything larger than 2,730 in the x dimension causes problems. For some values, the texture is white, for others, it is distorted. I can provide images, if it will help. GL_MAX_TEXTURE_SIZE is 8K and the code works on my GeForce 8.

As a workaround, I found that you can glTexImage2D with null, then immediately glTexSubImage2D:


glTexImage2D(
   GL_TEXTURE_2D,
   0,
   GL_RGB8,
   2731,     // width
   512,	     // height
   0,
   GL_BGR,
   GL_UNSIGNED_BYTE,
   0);       // null pixels

glTexSubImage2D(
   GL_TEXTURE_2D, 
   0,
   0,        // x offset
   0,        // y offset
   2731,     // width
   512,	     // height
   GL_BGR,
   GL_UNSIGNED_BYTE,
   pixels);

Has anyone ran into this before? Do you suggest any other workarounds?

Also, the y dimension seems to have a higher limit than 2,730; somewhere between 4K and 8K.

Thanks,
Patrick

Sounds like a driver bug as usual with ATI… File a report.

Will do. Do you have a link to the bug submission form? I can’t find it anywhere on their website. Do I need to be a registered developer?

Thanks,
Patrick

Sending an email to devrel@amd.com should be enough.

I confirm this one.
Got it today with catalyst 9.1 on a radeon HD 48*.

BTW: I confirm that the fix is working too. Great catch.

Thanks for confirming. By fix, do you mean the workaround or an actual fix?

Thanks,
Patrick

Its a stop gap. You shouldn’t have to do that.