yum-mirror/glslang

git clone https://git.yummers.dev/yum-mirror/glslang

Diego NovilloFix erroneous parse errors in variable declarations using existing struct names (#4005)b4e66d7b

main
1.0 KiB48 linesraw
1#version 400
2
3struct Vertex {
4    vec3 position;
5    vec3 normal;
6};
7
8struct Light {
9    vec3 position;
10    vec3 color;
11    float intensity;
12};
13
14struct Camera {
15    mat4 viewMatrix;
16    mat4 projMatrix;
17};
18
19// Test various positions of struct parameters - these should be TYPE_NAME
20void render(Vertex v, Light l, Camera c) {
21    // Function with struct parameters at start
22}
23
24void process(int id, Vertex v, float time) {
25    // Function with struct parameter in middle
26}
27
28void compute(float delta, int count, Light l, Camera c, bool enabled) {
29    // Function with multiple struct parameters mixed with other types
30}
31
32void single(Vertex v) {
33    // Function with single struct parameter
34}
35
36void multiple(Vertex v1, Vertex v2, Light l1, Light l2) {
37    // Function with multiple parameters of same struct type
38}
39
40void main() {
41    Vertex v = Vertex(vec3(0.0), vec3(1.0, 0.0, 0.0));
42    Light l = Light(vec3(10.0), vec3(1.0), 1.0);
43    Camera c = Camera(mat4(1.0), mat4(1.0));
44    
45    render(v, l, c);
46    process(1, v, 0.5);
47    compute(0.016, 100, l, c, true);
48}