PDA

View Full Version : uniform block arrays, linking error



peterv
08-16-2010, 08:41 AM
Hi,

I'm trying to use an array of uniform buffer blocks. Although the shader compiles fine but linking fails.
Please have the error output I get with the example taken from: http://www.opengl.org/wiki/Uniform_Buffer_Object

Example:

Vertex shader:


#version 330

in vec4 position;

void main(void)
{
gl_Position = position;
}


Fragment shader:


#version 330

uniform BlockName
{
vec3 blockMember1, blockMember2;
float blockMember3;
} multiBlocks[3];

out vec4 fragColor;

void main(void)
{
fragColor = vec4(multiBlocks[0].blockMember1, multiBlocks[0].blockMember3);
}


Error message:


Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset 895:
-- error message --
line 20, column 15: error: expected '='
line 23, column 22: error: expected ';'
line 24, column 37: error: expected ';'
-- internal assembly text --
!!NVfp4.0
OPTION NV_parameter_buffer_object2;
# cgc version 3.0.0001, build date Jul 29 2010
# command line args:
#vendor NVIDIA Corporation
#version 3.0.0.1
#profile gp4fp
#program main
#semantic BlockName.multiBlocks
#var float3 multiBlocks[0].blockMember1 : : buffer[0][0] : -1 : 1
#var float3 multiBlocks[0].blockMember2 : : buffer[0][16] : -1 : 0
#var float multiBlocks[0].blockMember3 : : buffer[0][28] : -1 : 1
#var float3 multiBlocks[1].blockMember1 : : buffer[1][0] : -1 : 0
#var float3 multiBlocks[1].blockMember2 : : buffer[1][16] : -1 : 0
#var float multiBlocks[1].blockMember3 : : buffer[1][28] : -1 : 0
#var float3 multiBlocks[2].blockMember1 : : buffer[2][0] : -1 : 0
#var float3 multiBlocks[2].blockMember2 : : buffer[2][16] : -1 : 0
#var float multiBlocks[2].blockMember3 : : buffer[2][28] : -1 : 0
#var float4 fragColor : $vout.COL00 : COL0[0] : -1 : 1
CBUFFER buf0[][] = { program.buffer[0..2] };
TEMP R0;
OUTPUT result_color0 = result.color;
LDC.F32 R0.x, buf0[0][28];
LDC.F32X4 result_color0.xyz, buf0[0][0];
MOV.F result_color0.w, R0.x;
END
# 3 instructions, 1 R-regs


I use OpenGL version 3.3.0 and the NVIDIA driver 256.44 on Linux.

Any ideas what the problem is?