summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArcady Goldmints-Orlov <agoldmints@igalia.com>2019-11-05 11:42:20 -0600
committerArcady Goldmints-Orlov <agoldmints@igalia.com>2019-11-05 18:27:46 -0600
commitbad99280d96e61a540b23211c1dddfd88bc3a5e4 (patch)
tree622a678c78a65e74a46b08176b37c477d1a2020a
parent2264683178491103b330b7a98a0de48cadc1717a (diff)
arb_gl_spirv: add xfb tests for lines and triangles
This adds some simple tests for primitives other than points. Acked-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
-rw-r--r--tests/spec/arb_gl_spirv/execution/xfb/vs_lines.shader_test86
-rw-r--r--tests/spec/arb_gl_spirv/execution/xfb/vs_triangles.shader_test87
2 files changed, 173 insertions, 0 deletions
diff --git a/tests/spec/arb_gl_spirv/execution/xfb/vs_lines.shader_test b/tests/spec/arb_gl_spirv/execution/xfb/vs_lines.shader_test
new file mode 100644
index 000000000..c2fb01be3
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/xfb/vs_lines.shader_test
@@ -0,0 +1,86 @@
+# Really simple XFB test
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+GL_ARB_gl_spirv
+
+[vertex shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpCapability TransformFeedback
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %color %xfb_out %gl_VertexID %gl_InstanceID
+ OpExecutionMode %main Xfb
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %color "color"
+ OpName %xfb_out "xfb_out"
+ OpName %gl_VertexID "gl_VertexID"
+ OpName %gl_InstanceID "gl_InstanceID"
+ OpDecorate %color Location 0
+ OpDecorate %color XfbBuffer 0
+ OpDecorate %color XfbStride 4
+ OpDecorate %xfb_out Location 1
+ OpDecorate %xfb_out XfbBuffer 0
+ OpDecorate %xfb_out XfbStride 4
+ OpDecorate %xfb_out Offset 0
+ OpDecorate %gl_VertexID BuiltIn VertexId
+ OpDecorate %gl_InstanceID BuiltIn InstanceId
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %color = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %float_1 = OpConstant %float 1
+ %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+%_ptr_Output_float = OpTypePointer Output %float
+ %xfb_out = OpVariable %_ptr_Output_float Output
+%float_1_23099995 = OpConstant %float 1.23099995
+ %int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexID = OpVariable %_ptr_Input_int Input
+%gl_InstanceID = OpVariable %_ptr_Input_int Input
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %color %12
+ %19 = OpLoad %int %gl_VertexID
+ %20 = OpConvertSToF %float %19
+ %21 = OpFAdd %float %float_1_23099995 %20
+ OpStore %xfb_out %21
+ OpReturn
+ OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+layout(location = 0) out vec4 color;
+layout(location = 1, xfb_buffer=0, xfb_offset = 0) out float xfb_out;
+
+void main() {
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+ xfb_out = 1.231 + gl_VertexID;
+}
+
+[test]
+
+xfb buffer object 0 8
+
+xfb draw arrays GL_LINES 0 2
+
+verify query_object GL_PRIMITIVES_GENERATED 1
+verify query_object GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 1
+
+probe xfb buffer float 0 0 1.231
+probe xfb buffer float 0 1 2.231
+
+verify program_query GL_TRANSFORM_FEEDBACK_VARYINGS 1
diff --git a/tests/spec/arb_gl_spirv/execution/xfb/vs_triangles.shader_test b/tests/spec/arb_gl_spirv/execution/xfb/vs_triangles.shader_test
new file mode 100644
index 000000000..e8e884e5a
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/xfb/vs_triangles.shader_test
@@ -0,0 +1,87 @@
+# Really simple XFB test
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+GL_ARB_gl_spirv
+
+[vertex shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpCapability TransformFeedback
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %color %xfb_out %gl_VertexID %gl_InstanceID
+ OpExecutionMode %main Xfb
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %color "color"
+ OpName %xfb_out "xfb_out"
+ OpName %gl_VertexID "gl_VertexID"
+ OpName %gl_InstanceID "gl_InstanceID"
+ OpDecorate %color Location 0
+ OpDecorate %color XfbBuffer 0
+ OpDecorate %color XfbStride 4
+ OpDecorate %xfb_out Location 1
+ OpDecorate %xfb_out XfbBuffer 0
+ OpDecorate %xfb_out XfbStride 4
+ OpDecorate %xfb_out Offset 0
+ OpDecorate %gl_VertexID BuiltIn VertexId
+ OpDecorate %gl_InstanceID BuiltIn InstanceId
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %color = OpVariable %_ptr_Output_v4float Output
+ %float_0 = OpConstant %float 0
+ %float_1 = OpConstant %float 1
+ %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+%_ptr_Output_float = OpTypePointer Output %float
+ %xfb_out = OpVariable %_ptr_Output_float Output
+%float_1_23099995 = OpConstant %float 1.23099995
+ %int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexID = OpVariable %_ptr_Input_int Input
+%gl_InstanceID = OpVariable %_ptr_Input_int Input
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ OpStore %color %12
+ %19 = OpLoad %int %gl_VertexID
+ %20 = OpConvertSToF %float %19
+ %21 = OpFAdd %float %float_1_23099995 %20
+ OpStore %xfb_out %21
+ OpReturn
+ OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+layout(location = 0) out vec4 color;
+layout(location = 1, xfb_buffer=0, xfb_offset = 0) out float xfb_out;
+
+void main() {
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+ xfb_out = 1.231 + gl_VertexID;
+}
+
+[test]
+
+xfb buffer object 0 12
+
+xfb draw arrays GL_TRIANGLES 0 3
+
+verify query_object GL_PRIMITIVES_GENERATED 1
+verify query_object GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 1
+
+probe xfb buffer float 0 0 1.231
+probe xfb buffer float 0 1 2.231
+probe xfb buffer float 0 2 3.231
+
+verify program_query GL_TRANSFORM_FEEDBACK_VARYINGS 1