These tests verify the following linkage rules, from GLSL 4.10: 1. If multiple shaders using members of a built-in block belonging to the same interface are linked together in the same program, they must all redeclare the built-in block in the same way, as described in section 4.3.7 "Interface Blocks" for interface block matching, or a link error will result.
2. It will also be a link error if some shaders in a program redeclare a specific built-in interface block while another shader in that program does not redeclare that interface block yet still uses a member of that interface block. --- ...ge-pervertex-redeclaration-mismatch.shader_test | 65 ++++++++++++++++++ ...tage-pervertex-redeclaration-needed.shader_test | 64 ++++++++++++++++++ ...ge-pervertex-redeclaration-unneeded.shader_test | 63 +++++++++++++++++ ...pervertex-in-redeclaration-mismatch.shader_test | 71 ++++++++++++++++++++ ...e-pervertex-in-redeclaration-needed.shader_test | 78 ++++++++++++++++++++++ ...pervertex-in-redeclaration-unneeded.shader_test | 75 +++++++++++++++++++++ ...ervertex-out-redeclaration-mismatch.shader_test | 62 +++++++++++++++++ ...-pervertex-out-redeclaration-needed.shader_test | 61 +++++++++++++++++ ...ervertex-out-redeclaration-unneeded.shader_test | 60 +++++++++++++++++ 9 files changed, 599 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-unneeded.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-unneeded.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-unneeded.shader_test diff --git a/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test new file mode 100644 index 0000000..ab5e3c4 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test @@ -0,0 +1,65 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise interstage linking of the gl_PerVertex +# interface block using the vertex and geometry shader stages, and we +# use shaders that refer to an overlapping set of built-in variables. + +[require] +GLSL >= 1.50 + +[vertex shader] +out gl_PerVertex { + vec4 gl_Position; +}; +in vec4 pos; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; + float gl_PointSize; +} gl_in[]; +out vec4 v; + +void main() +{ + v = vec4(gl_in[0].gl_Position.xyz, gl_in[0].gl_PointSize); + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test new file mode 100644 index 0000000..0b58b92 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test @@ -0,0 +1,64 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. It will also be a +# link error if some shaders in a program redeclare a specific +# built-in interface block while another shader in that program +# does not redeclare that interface block yet still uses a member +# of that interface block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise interstage linking of the gl_PerVertex +# interface block between the vertex and geometry shader stages, and +# we verify the link error that is supposed to occur if some shaders +# redeclare gl_PerVertex and others do not. + +[require] +GLSL >= 1.50 + +[vertex shader] +in vec4 pos; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-unneeded.shader_test b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-unneeded.shader_test new file mode 100644 index 0000000..5dee009 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-unneeded.shader_test @@ -0,0 +1,63 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# The phrase "using members of a built-in block" implies that if two +# shaders are linked together and one of them *does not use* any +# members of the built-in block, then that shader does not need to +# have a matching redeclaration of the built-in block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise interstage linking of the gl_PerVertex +# interface block between the vertex and geometry shader stages. + +[require] +GLSL >= 1.50 + +[vertex shader] +in vec4 pos; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +void main() +{ + gl_Position = vec4(0.0); + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link success diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-mismatch.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-mismatch.shader_test new file mode 100644 index 0000000..9567059 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-mismatch.shader_test @@ -0,0 +1,71 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex +# "in" interface block, and we use two compilation units that refer +# to an overlapping set of built-in variables. + +[require] +GLSL >= 1.50 + +[vertex shader] +void main() +{ +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[]; +out vec4 v; + +vec4 foo(); + +void main() +{ + v = gl_in[0].gl_Position + foo(); + EmitVertex(); +} + +[geometry shader] +in gl_PerVertex { + vec4 gl_Position; + float gl_PointSize; +} gl_in[]; + +vec4 foo() +{ + return vec4(gl_in[0].gl_Position.xyz, gl_in[0].gl_PointSize); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-needed.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-needed.shader_test new file mode 100644 index 0000000..97008cb --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-needed.shader_test @@ -0,0 +1,78 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. It will also be a +# link error if some shaders in a program redeclare a specific +# built-in interface block while another shader in that program +# does not redeclare that interface block yet still uses a member +# of that interface block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex "in" +# interface block, and we verify the link error that is supposed to +# occur if some shaders redeclare gl_PerVertex and others do not. + +[require] +GLSL >= 1.50 + +[vertex shader] +in vec4 pos; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[]; + +vec4 foo(); + +void main() +{ + gl_Position = gl_in[0].gl_Position + foo(); + EmitVertex(); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +vec4 foo() +{ + return gl_in[0].gl_Position; +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-unneeded.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-unneeded.shader_test new file mode 100644 index 0000000..92e79bc --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-unneeded.shader_test @@ -0,0 +1,75 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# The phrase "using members of a built-in block" implies that if two +# shaders are linked together and one of them *does not use* any +# members of the built-in block, then that shader does not need to +# have a matching redeclaration of the built-in block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex +# "in" interface block. + +[require] +GLSL >= 1.50 + +[vertex shader] +in vec4 pos; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[]; + +vec4 foo(); + +void main() +{ + gl_Position = gl_in[0].gl_Position + foo(); + EmitVertex(); +} + +[geometry shader] +vec4 foo() +{ + return vec4(1.0); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link success diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-mismatch.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-mismatch.shader_test new file mode 100644 index 0000000..40f1a98 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-mismatch.shader_test @@ -0,0 +1,62 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex +# "out" interface block, and we use two compilation units that refer +# to a non-overlapping set of built-in variables. + +[require] +GLSL >= 1.50 + +[vertex shader] +in vec4 pos; +out gl_PerVertex { + vec4 gl_Position; +}; + +void foo(); + +void main() +{ + gl_Position = pos; + foo(); +} + +[vertex shader] +out gl_PerVertex { + float gl_PointSize; +}; + +void foo() +{ + gl_PointSize = 1.0; +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-needed.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-needed.shader_test new file mode 100644 index 0000000..7d3b641 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-needed.shader_test @@ -0,0 +1,61 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. It will also be a +# link error if some shaders in a program redeclare a specific +# built-in interface block while another shader in that program +# does not redeclare that interface block yet still uses a member +# of that interface block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex +# "out" interface block, and we verify the link error that is supposed +# to occur if some shaders redeclare gl_PerVertex and others do not. + +[require] +GLSL >= 1.50 + +[vertex shader] +out gl_PerVertex { + vec4 gl_Position; +}; + +void foo(); + +void main() +{ + foo(); + gl_Position = vec4(1.0); +} + +[vertex shader] +void foo() +{ + gl_PointSize = 1.0; +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-unneeded.shader_test b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-unneeded.shader_test new file mode 100644 index 0000000..60a00e7 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-unneeded.shader_test @@ -0,0 +1,60 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 "Interface Blocks" for interface +# block matching, or a link error will result. +# +# The phrase "using members of a built-in block" implies that if two +# shaders are linked together and one of them *does not use* any +# members of the built-in block, then that shader does not need to +# have a matching redeclaration of the built-in block. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of "interface" in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise intrastage linking of the gl_PerVertex +# "out" interface block. + +[require] +GLSL >= 1.50 + +[vertex shader] +out gl_PerVertex { + vec4 gl_Position; +}; + +vec4 foo(); + +void main() +{ + gl_Position = foo(); +} + +[vertex shader] +vec4 foo() +{ + return vec4(1.0); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link success -- 1.8.4 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit