GLSL: Fix #1358: Support "struct name", where name could be a user type

This commit is contained in:
John Kessenich
2018-06-11 19:25:24 -06:00
parent 1ea8f595f9
commit 2c8265bb62
4 changed files with 56 additions and 5 deletions

13
Test/110scope.vert Normal file → Executable file
View File

@@ -71,4 +71,17 @@ void main()
int degrees;
degrees(3.2);
{
S s;
s.x = 3;
struct S { // okay, hides S
bool b;
};
S t;
t.b = true;
struct S { // ERROR, redefinition of struct S
float f;
};
}
}

View File

@@ -2,7 +2,8 @@
ERROR: 0:5: 'a' : redefinition
ERROR: 0:57: 'z' : undeclared identifier
ERROR: 0:57: 'z' : redefinition
ERROR: 3 compilation errors. No code generated.
ERROR: 0:83: 'S' : redefinition struct
ERROR: 4 compilation errors. No code generated.
Shader version: 110
@@ -120,6 +121,21 @@ ERROR: node is still EOpNull!
0:69 0 (const int)
0:73 Constant:
0:73 183.346494
0:? Sequence
0:77 move second child to first child ( temp int)
0:77 x: direct index for structure ( temp int)
0:77 's' ( temp structure{ temp int x})
0:77 Constant:
0:77 0 (const int)
0:77 Constant:
0:77 3 (const int)
0:82 move second child to first child ( temp bool)
0:82 b: direct index for structure ( temp bool)
0:82 't' ( temp structure{ temp bool b})
0:82 Constant:
0:82 0 (const int)
0:82 Constant:
0:82 true (const bool)
0:? Linker Objects
0:? 'b' ( global bool)
0:? 'c' ( global bool)
@@ -236,6 +252,21 @@ ERROR: node is still EOpNull!
0:69 0 (const int)
0:73 Constant:
0:73 183.346494
0:? Sequence
0:77 move second child to first child ( temp int)
0:77 x: direct index for structure ( temp int)
0:77 's' ( temp structure{ temp int x})
0:77 Constant:
0:77 0 (const int)
0:77 Constant:
0:77 3 (const int)
0:82 move second child to first child ( temp bool)
0:82 b: direct index for structure ( temp bool)
0:82 't' ( temp structure{ temp bool b})
0:82 Constant:
0:82 0 (const int)
0:82 Constant:
0:82 true (const bool)
0:? Linker Objects
0:? 'b' ( global bool)
0:? 'c' ( global bool)