Add anonymous members as a new symbol table type, so the infrastructure can handle blocks with no names.

Also, add more safety to the types involved regarding copy constructors, operator=, etc.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21106 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-04-10 20:15:16 +00:00
parent ed3197921e
commit ba04210097
11 changed files with 170 additions and 73 deletions

View File

@@ -5,7 +5,8 @@ layout(LocatioN = 3) in vec4 p;
out vec4 pos;
out vec3 color;
layout(shared, column_major, row_major) uniform mat4 m4; // default is now shared and row_major
layout(shared, column_major, row_major) uniform mat4 badm4; // ERROR
layout(shared, column_major, row_major) uniform; // default is now shared and row_major
layout(std140) uniform Transform { // layout of this block is std140
mat4 M1; // row_major
@@ -13,18 +14,20 @@ layout(std140) uniform Transform { // layout of this block is std140
mat3 N1; // row_major
} tblock;
//uniform T2 { // layout of this block is shared
//...
//};
//
uniform T2 { // layout of this block is shared
bool b;
mat4 t2m;
};
layout(column_major) uniform T3 { // shared and column_major
mat4 M3; // column_major
layout(row_major) mat4 m4; // row major
layout(row_major) mat4 M4; // row major
mat3 N2; // column_major
int b; // ERROR, redefinition (needs to be last member of block for testing, following members are skipped)
};
void main()
{
pos = p * (m4 + tblock.M1 + tblock.M2);
pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
color = c * tblock.N1;
}

View File

@@ -68,16 +68,16 @@ layout(std140) uniform Transform2 { // layout of this block is std140
};
layout(column_major) uniform T3 { // shared and column_major
mat4 M3; // column_major
layout(row_major) mat4 m4; // row major
mat3 N2; // column_major
mat4 M13; // column_major
layout(row_major) mat4 m14; // row major
mat3 N12; // column_major
};
// in one compilation unit...
layout(binding=3) uniform sampler2D s; // s bound to unit 3
layout(binding=3) uniform sampler2D s17; // s bound to unit 3
// in another compilation unit...
uniform sampler2D s; // okay, s still bound at 3
uniform sampler2D s17; // okay, s still bound at 3
// in another compilation unit...
//layout(binding=4) uniform sampler2D s; // ERROR: contradictory bindings