GLSL and MRT via FBO on ATI hardware

I’ve just notice that the new 5.9cat drivers from ATI now has the GL_ARB_draw_buffers extension present in its extension string.

Now, I hoped this ment that MRT would now work via GLSL, however its not looking hopefull, so I’m kinda asking for confirmation of this or for someone to point out what I might have done wrong when it comes to using this extension in GLSL.

Fragment shader code;

 
#version 110
#extension GL_ARB_draw_buffers : require
uniform sampler2D tex;
void main(void)
{
	vec4 color = texture2D(tex,gl_TexCoord[0].st);

	gl_FragData[0] = vec4(color.r, 0.0,0.0,1.0);
	gl_FragData[1] = vec4(color.g,0.0,0.0,1.0);
	gl_FragData[2] = vec4(color.b,0.0,0.0,1.0);
}
 

However, when I run I get the following compile log…

 Link failed. All shader objects have not been successfully compiled. Validation
 failed - link has not been called or link has failed.

ERROR: 0:2: '' :  extension 'GL_ARB_draw_buffers' is not supported
ERROR: 1 compilation errors.  No code generated.
 

Any ideas anyone?
or are we going to have to wait longer for MRT on ATI hardware via GLSL?

Link failed. All shader objects have not been successfully compiled.
I hate to be a parrot, but it looks like not all of the shader objects compiled successfully. You should check your shader’s compilation (not just the linking of the shader), or make sure that you’re using the right shader object id.

Thats just down to how my debugging output works, for whatever reason I only test when linking fails, then dump the program log (first two lines) and then the logs from each shader object (in this case the only output is from the fragment shader listed above, which shows why it failed to compile and thus why the link failed).

You need to check GL_MAX_DRAW_BUFFERS_ARB. I think we still only support 1 draw buffer for GLSL.

I added the lines;

int dbuffers = 0;
	glGetIntegerv(GL_MAX_DRAW_BUFFERS,&dbuffers);

to my test program and set a break on the line just after it, when inspected in a debugger dbuffers hold the value 4 (four).

(both with and without _ARB has the same value).

edit:

OK, so I remove the “#extension GL_ARB_draw_buffers : require” line from my shader, flipped the code to MRT mode and it does infact work, it outputs a different colour to each render target :smiley:
(i adjusted my ouput code to only route one texture to the red channel and compare two screen grabs, they are certainly different)

So, I looked to be an issue with enabling extensions (afaik the draw_buffers extension is the only GLSL extension which exists atm) and that MRT does indeed work now with GLSL :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.