-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gs: Verify consistency checking of geometry shader input layouts.
These tests verify that the implementation properly detects mismatches between geometry shader input layout declarations, whether they occur within the same compilation unit or within multiple compilation units. Mismatches that occur within the same compilation unit should produce a compile error. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
- Loading branch information
1 parent
4bbc756
commit 61122ec
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-consistent-with-prev-layout.geom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec | ||
// includes the following examples of compile-time errors: | ||
// | ||
// // code sequence within one shader... | ||
// in vec4 Color1[]; // size unknown | ||
// ...Color1.length()...// illegal, length() unknown | ||
// in vec4 Color2[2]; // size is 2 | ||
// ...Color1.length()...// illegal, Color1 still has no size | ||
// in vec4 Color3[3]; // illegal, input sizes are inconsistent | ||
// layout(lines) in; // legal, input size is 2, matching | ||
// in vec4 Color4[3]; // illegal, contradicts layout | ||
// ...Color1.length()...// legal, length() is 2, Color1 sized by layout() | ||
// layout(lines) in; // legal, matches other layout() declaration (*) | ||
// layout(triangles) in;// illegal, does not match earlier layout() declaration | ||
// | ||
// This test verifies the case marked with (*), namely that no error | ||
// results from declaring a geometry shader input layout that is | ||
// consistent with a previously declared geometry shader input layout. | ||
// | ||
// [config] | ||
// expect_result: pass | ||
// glsl_version: 1.50 | ||
// check_link: false | ||
// [end config] | ||
|
||
#version 150 | ||
|
||
layout(lines) in; | ||
layout(lines) in; |
30 changes: 30 additions & 0 deletions
30
tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-layout.geom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec | ||
// includes the following examples of compile-time errors: | ||
// | ||
// // code sequence within one shader... | ||
// in vec4 Color1[]; // size unknown | ||
// ...Color1.length()...// illegal, length() unknown | ||
// in vec4 Color2[2]; // size is 2 | ||
// ...Color1.length()...// illegal, Color1 still has no size | ||
// in vec4 Color3[3]; // illegal, input sizes are inconsistent | ||
// layout(lines) in; // legal, input size is 2, matching | ||
// in vec4 Color4[3]; // illegal, contradicts layout | ||
// ...Color1.length()...// legal, length() is 2, Color1 sized by layout() | ||
// layout(lines) in; // legal, matches other layout() declaration | ||
// layout(triangles) in;// illegal, does not match earlier layout() declaration (*) | ||
// | ||
// This test verifies the case marked with (*), namely that an error | ||
// results from declaring a geometry shader input layout that is | ||
// inconsistent with a previously declared geometry shader input | ||
// layout. | ||
// | ||
// [config] | ||
// expect_result: fail | ||
// glsl_version: 1.50 | ||
// check_link: false | ||
// [end config] | ||
|
||
#version 150 | ||
|
||
layout(lines) in; | ||
layout(triangles) in; |
64 changes: 64 additions & 0 deletions
64
tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says: | ||
# | ||
# At least one geometry shader (compilation unit) in a program must | ||
# declare an input layout, and all geometry shader input layout | ||
# declarations in a program must declare the same layout. It is not | ||
# required that all geometry shaders in a program declare an input | ||
# layout. | ||
# | ||
# This test verifies that a link error occurs if two compilation units | ||
# declare conflicting layouts. | ||
|
||
[require] | ||
GLSL >= 1.50 | ||
|
||
[vertex shader] | ||
#version 150 | ||
|
||
in vec4 vertex; | ||
out vec4 vertex_to_gs; | ||
|
||
void main() | ||
{ | ||
vertex_to_gs = vertex; | ||
} | ||
|
||
[geometry shader] | ||
#version 150 | ||
|
||
layout(lines) in; | ||
layout(triangle_strip, max_vertices = 3) out; | ||
|
||
void do_vertex(int i); | ||
|
||
void main() | ||
{ | ||
for (int i = 0; i < 2; i++) | ||
do_vertex(i); | ||
} | ||
|
||
[geometry shader] | ||
#version 150 | ||
|
||
layout(triangles) in; | ||
|
||
in vec4 vertex_to_gs[3]; | ||
|
||
void do_vertex(int i) | ||
{ | ||
gl_Position = vertex_to_gs[i]; | ||
EmitVertex(); | ||
} | ||
|
||
[fragment shader] | ||
#version 150 | ||
|
||
out vec4 color; | ||
|
||
void main() | ||
{ | ||
color = vec4(0.0, 1.0, 0.0, 1.0); | ||
} | ||
|
||
[test] | ||
link error |