PDA

View Full Version : ATI rendering to TBO and integer textures



DmitryM
02-22-2011, 10:31 AM
Hi,

I'd like to render into a buffer object, containing a sequence of integers, under GL-3 pure context. I've tried 2 different ways - both failed for unknown (for me) reason.

First approach - TBO.
I'm linking a texture of type R32i with this buffer as TBO. Then I create an FBO and attach the texture into it. It gives me FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT error. Digging up the spec, I found no reason why TBO can't be attached as a render target.

Second approach - PBO.
I'm creating a 2D texture (could be 1D, but doesn't matter here) in order to render into it and then read the values into my buffer bound as PBO. Surprisingly, TexImage2D fails with INVALID_OPERATION if the internal format is one of the R32i,R32ui or supposedly any other integer format. It's 2011, haven't ATI got integer texture support yet?

Platform:
WinXP, Catalyst 11.2, Radeon 2400HD

skynet
02-22-2011, 11:09 AM
For a) GL_TEXTURE_BUFFER is not a valid texture target for glFramebufferTexture.

For b) You may have specified an invalid combination of 'format' and 'type'. For integer texture internal formats, special new source format and type specifiers were introduced.

DmitryM
02-22-2011, 11:47 AM
Thanks for the answer, skynet!

a) Can you point me to the exact specification page mentioning this?

b) You are correct. I tried to use RedInteger instead of Red and it passed. I wonder how I missed that... :)

skynet
02-22-2011, 11:52 AM
If you look through the paragraphs of FramebufferTextureXYZ(), you won't find TEXTURE_BUFFER mentioned anywhere. So I concluded, it is probably not a valid texture target there.

DmitryM
02-22-2011, 12:09 PM
For all other values of textarget, level must be greater than or equal to zero and no larger than log2 of the value of MAX_TEXTURE_SIZE. Otherwise, an INVALID_VALUE error is generated.
The spec doesn't specify TextureBuffer as an exclusion, so it implicitly falls under "all other values of textarget".

skynet
02-22-2011, 03:11 PM
GL 3.2 core specs, p. 227



FramebufferTexture( enum target, enum attachment,
uint texture, int level );
...
An INVALID_OPERATION error is generated if texture is the name
of a buffer texture.

DmitryM
02-22-2011, 03:47 PM
Thanks again. Perfect answer!