[Piglit] [PATCH v3 5/5] arb-enhanced-layouts: explicit-offset: add linker test
Emil Velikov
emil.l.velikov at gmail.com
Wed Nov 11 10:14:57 PST 2015
From: Emil Velikov <emil.velikov at collabora.com>
Check if the linker throws an error when the offset across two
identically named blocks' members are not the same.
v2:
- Rework into intra- and interstage tests (Tim).
- Tweak shader comment (wrong ...)
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
...sbo-different-offset-across-shaders.shader_test | 35 ++++++++++++++++++
...ubo-different-offset-across-shaders.shader_test | 32 +++++++++++++++++
...sbo-different-offset-across-shaders.shader_test | 41 ++++++++++++++++++++++
...ubo-different-offset-across-shaders.shader_test | 40 +++++++++++++++++++++
4 files changed, 148 insertions(+)
create mode 100644 tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ssbo-different-offset-across-shaders.shader_test
create mode 100644 tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ubo-different-offset-across-shaders.shader_test
create mode 100644 tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ssbo-different-offset-across-shaders.shader_test
create mode 100644 tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ubo-different-offset-across-shaders.shader_test
diff --git a/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ssbo-different-offset-across-shaders.shader_test b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ssbo-different-offset-across-shaders.shader_test
new file mode 100644
index 0000000..6d06ef5
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ssbo-different-offset-across-shaders.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 32) vec4 var2;
+};
+
+void main()
+{
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 64) vec4 var2; // Wrong: members and their respective offset across identically named blocks must be the same
+};
+
+void main()
+{
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ubo-different-offset-across-shaders.shader_test b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ubo-different-offset-across-shaders.shader_test
new file mode 100644
index 0000000..b391fd6
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/interstage-ubo-different-offset-across-shaders.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 32) vec4 var2;
+};
+
+void main()
+{
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 64) vec4 var2; // Wrong: members and their respective offset across identically named blocks must be the same
+};
+
+void main()
+{
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ssbo-different-offset-across-shaders.shader_test b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ssbo-different-offset-across-shaders.shader_test
new file mode 100644
index 0000000..dee2da0
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ssbo-different-offset-across-shaders.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 32) vec4 var2;
+};
+
+void f()
+{
+ var1 = vec4(1, 0, 0, 1);
+}
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 64) vec4 var2; // Wrong: members and their respective offset across identically named blocks must be the same
+};
+
+void f();
+
+void main()
+{
+ f();
+
+ gl_Position = gl_Vertex;
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ubo-different-offset-across-shaders.shader_test b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ubo-different-offset-across-shaders.shader_test
new file mode 100644
index 0000000..ac22303
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/explicit-offsets/intrastage-ubo-different-offset-across-shaders.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 32) vec4 var2;
+};
+
+varying vec4 v;
+
+void f()
+{
+ v = var1;
+}
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 64) vec4 var2; // Wrong: members and their respective offset across identically named blocks must be the same
+};
+
+void f();
+
+void main()
+{
+ f();
+
+ gl_Position = gl_Vertex;
+}
+
+[test]
+link error
--
2.6.2
More information about the Piglit
mailing list