cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

cameni
Journeyman III

GLSL: out interface block in fragment shader

Hi,

I have the following shader that outputs to multiple render targets, and the glsl compiler tells me that

ERROR: 0:7: error(#328) interface block should not apply in 'FS out'.
ERROR: error(#273) 1 compilation errors.  No code generated

What's the problem? AFAIK the specification does not forbid putting the output variables in an interface block, or am I mistaken?


#version 150

precision highp float;
precision highp int;

in vec2 coord;
out stx {
    out ivec4 a;
    out vec4 b;
} OUT;

uniform isampler2D elev;
uniform sampler2D frcc;
void main()
{
    OUT.a = texture(elev, coord);
    OUT.b = texture(frcc, coord);
}

0 Likes
6 Replies
bpurnomo
Staff

Hi,

   The problem is GPU ShaderAnalyzer doesn't have a full support for GLSL 1.50.  We are working on adding the support.

 

0 Likes

Thanks for the reply.

But it's not only a problem of the shader analyzer, I've originally encountered it in our application during GLSL compile. With the latest, 10.1 driver.

0 Likes

I overlooked the part in GLSL specification stating that it's illegal to have an output block from a fragment shader, for some (weird) reason. So the error is correct - sorry.

0 Likes

Where exactly in the GLSL spec does it say that?  I couldn't find it, and have quite a few shaders that use in and out interface blocks already.  I've looked at section 4.3.7 several times in the 1.50.09 version and can't find it. I see where layout qualifiers are restricted but not interface blocks.

For example doesn't compile in a vertex shader (example taken from the spec.):

in ColoredTexture {

vec4 Color;

vec2 TexCoord;

} Material; // instance name

 

Ironically if I use this syntax (which shouldn't work) it compiles fine (only on AIT drivers):

struct ColoredTexture {

in vec4 color;

in vec2 TexCoord;

} Material; 



 

 

0 Likes

It's right in the starting paragraph of 4.3.7:

It is illegal to have an input block in a vertex shader or an output block in a fragment shader; these uses are reserved for future use.

 

0 Likes

Thanks, I don't know how I missed that with 3 read.  Too bad though they make the code cleaner.

 

 

0 Likes