[30/63] arb_gl_spirv: adding basic vertex attrib 64-bit tests

Submitted by apinheiro on Feb. 23, 2019, 11:45 p.m.

Details

Message ID 20190223234551.21111-31-apinheiro@igalia.com
State New
Headers show
Series "ARB_gl_spirv full series" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

apinheiro Feb. 23, 2019, 11:45 p.m.
For now just:
  * Simple
  * Simple with array.

In general ARB_gl_spirv implementation didn't need to add too many
specifics. Those two were enough to catch the minor things, and enough
to cover the barebone testing. For a more detailed testing it is more
practical to borrow the extensive testing done on the
arb_vertex_attrib_64bit generated tests.
---
 .../execution/va64/array.shader_test          | 202 ++++++++++++++++++
 .../execution/va64/simple.shader_test         | 175 +++++++++++++++
 2 files changed, 377 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/execution/va64/array.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/va64/simple.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gl_spirv/execution/va64/array.shader_test b/tests/spec/arb_gl_spirv/execution/va64/array.shader_test
new file mode 100644
index 000000000..9a165ef18
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/va64/array.shader_test
@@ -0,0 +1,202 @@ 
+# 64-bit vertex attrib test using an array. Assumes that 64-bit
+# uniform support is working
+
+[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; 6
+; Bound: 56
+; Schema: 0
+               OpCapability Shader
+               OpCapability Float64
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %main "main" %_ %piglit_vertex %fs_color %array_value %gl_VertexID %gl_InstanceID
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %gl_PerVertex "gl_PerVertex"
+               OpMemberName %gl_PerVertex 0 "gl_Position"
+               OpMemberName %gl_PerVertex 1 "gl_PointSize"
+               OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
+               OpMemberName %gl_PerVertex 3 "gl_CullDistance"
+               OpName %_ ""
+               OpName %piglit_vertex "piglit_vertex"
+               OpName %fs_color "fs_color"
+               OpName %array_value "array_value"
+               OpName %expected0 "expected0"
+               OpName %expected1 "expected1"
+               OpName %gl_VertexID "gl_VertexID"
+               OpName %gl_InstanceID "gl_InstanceID"
+               OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+               OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+               OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+               OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+               OpDecorate %gl_PerVertex Block
+               OpDecorate %piglit_vertex Location 2
+               OpDecorate %fs_color Location 0
+               OpDecorate %array_value Location 0
+               OpDecorate %expected0 Location 0
+               OpDecorate %expected0 DescriptorSet 0
+               OpDecorate %expected1 Location 1
+               OpDecorate %expected1 DescriptorSet 0
+               OpDecorate %gl_VertexID BuiltIn VertexId
+               OpDecorate %gl_InstanceID BuiltIn InstanceId
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
+          %_ = OpVariable %_ptr_Output_gl_PerVertex Output
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%piglit_vertex = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %fs_color = OpVariable %_ptr_Output_v4float Output
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+         %24 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+     %double = OpTypeFloat 64
+   %v2double = OpTypeVector %double 2
+     %uint_2 = OpConstant %uint 2
+%_arr_v2double_uint_2 = OpTypeArray %v2double %uint_2
+%_ptr_Input__arr_v2double_uint_2 = OpTypePointer Input %_arr_v2double_uint_2
+%array_value = OpVariable %_ptr_Input__arr_v2double_uint_2 Input
+%_ptr_Input_v2double = OpTypePointer Input %v2double
+%_ptr_UniformConstant_v2double = OpTypePointer UniformConstant %v2double
+  %expected0 = OpVariable %_ptr_UniformConstant_v2double UniformConstant
+       %bool = OpTypeBool
+     %v2bool = OpTypeVector %bool 2
+         %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
+      %int_1 = OpConstant %int 1
+  %expected1 = OpVariable %_ptr_UniformConstant_v2double UniformConstant
+%_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
+         %18 = OpLoad %v4float %piglit_vertex
+         %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0
+               OpStore %20 %18
+               OpStore %fs_color %24
+         %32 = OpAccessChain %_ptr_Input_v2double %array_value %int_0
+         %33 = OpLoad %v2double %32
+         %36 = OpLoad %v2double %expected0
+         %39 = OpFOrdNotEqual %v2bool %33 %36
+         %40 = OpAny %bool %39
+               OpSelectionMerge %42 None
+               OpBranchConditional %40 %41 %42
+         %41 = OpLabel
+               OpStore %fs_color %43
+               OpBranch %42
+         %42 = OpLabel
+         %45 = OpAccessChain %_ptr_Input_v2double %array_value %int_1
+         %46 = OpLoad %v2double %45
+         %48 = OpLoad %v2double %expected1
+         %49 = OpFOrdNotEqual %v2bool %46 %48
+         %50 = OpAny %bool %49
+               OpSelectionMerge %52 None
+               OpBranchConditional %50 %51 %52
+         %51 = OpLabel
+               OpStore %fs_color %43
+               OpBranch %52
+         %52 = OpLabel
+               OpReturn
+               OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+layout(location = 0) uniform dvec2 expected0;
+layout(location = 1) uniform dvec2 expected1;
+
+layout(location = 0) in dvec2 array_value[2];
+layout(location = 2) in vec4 piglit_vertex;
+
+layout(location = 0) out vec4 fs_color;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+
+    fs_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+    if (array_value[0] != expected0)
+       fs_color = vec4(1.0, 0.0, 0.0, 1.0);
+
+    if (array_value[1] != expected1)
+       fs_color = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+
+[fragment 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; 6
+; Bound: 13
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %color %fs_color
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %color "color"
+               OpName %fs_color "fs_color"
+               OpDecorate %color Location 0
+               OpDecorate %fs_color Location 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+      %color = OpVariable %_ptr_Output_v4float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+   %fs_color = OpVariable %_ptr_Input_v4float Input
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %12 = OpLoad %v4float %fs_color
+               OpStore %color %12
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout(location = 0) in vec4 fs_color;
+layout(location = 0) out vec4 color;
+
+void main()
+{
+  color = fs_color;
+}
+
+[vertex data]
+    0/double/dvec2 1/double/dvec2  2/float/vec4
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                -1.0 -1.0 0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                 1.0 -1.0  0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                 1.0  1.0  0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                -1.0  1.0  0.0 1.0
+
+
+[test]
+uniform dvec2 0 0xffefffffffffffff 0xcb1e35ed24eb6496
+uniform dvec2 1 0xc8b1381a93a87849 0xc7efffffefffffff
+
+clear color 1.0 1.0 1.0 1.0
+clear
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gl_spirv/execution/va64/simple.shader_test b/tests/spec/arb_gl_spirv/execution/va64/simple.shader_test
new file mode 100644
index 000000000..1fc9d316c
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/va64/simple.shader_test
@@ -0,0 +1,175 @@ 
+# Basic test using a 64-bit vertex attrib. Assumes that 64-bit uniform
+# support is working
+
+[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; 6
+; Bound: 43
+; Schema: 0
+               OpCapability Shader
+               OpCapability Float64
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %main "main" %_ %piglit_vertex %fs_color %value %gl_VertexID %gl_InstanceID
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %gl_PerVertex "gl_PerVertex"
+               OpMemberName %gl_PerVertex 0 "gl_Position"
+               OpMemberName %gl_PerVertex 1 "gl_PointSize"
+               OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
+               OpMemberName %gl_PerVertex 3 "gl_CullDistance"
+               OpName %_ ""
+               OpName %piglit_vertex "piglit_vertex"
+               OpName %fs_color "fs_color"
+               OpName %value "value"
+               OpName %expected "expected"
+               OpName %gl_VertexID "gl_VertexID"
+               OpName %gl_InstanceID "gl_InstanceID"
+               OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+               OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+               OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+               OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+               OpDecorate %gl_PerVertex Block
+               OpDecorate %piglit_vertex Location 1
+               OpDecorate %fs_color Location 0
+               OpDecorate %value Location 0
+               OpDecorate %expected Location 0
+               OpDecorate %expected DescriptorSet 0
+               OpDecorate %gl_VertexID BuiltIn VertexId
+               OpDecorate %gl_InstanceID BuiltIn InstanceId
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
+          %_ = OpVariable %_ptr_Output_gl_PerVertex Output
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%piglit_vertex = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %fs_color = OpVariable %_ptr_Output_v4float Output
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+         %24 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+     %double = OpTypeFloat 64
+   %v4double = OpTypeVector %double 4
+%_ptr_Input_v4double = OpTypePointer Input %v4double
+      %value = OpVariable %_ptr_Input_v4double Input
+%_ptr_UniformConstant_v4double = OpTypePointer UniformConstant %v4double
+   %expected = OpVariable %_ptr_UniformConstant_v4double UniformConstant
+       %bool = OpTypeBool
+     %v4bool = OpTypeVector %bool 4
+         %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_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
+         %18 = OpLoad %v4float %piglit_vertex
+         %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0
+               OpStore %20 %18
+               OpStore %fs_color %24
+         %29 = OpLoad %v4double %value
+         %32 = OpLoad %v4double %expected
+         %35 = OpFOrdNotEqual %v4bool %29 %32
+         %36 = OpAny %bool %35
+               OpSelectionMerge %38 None
+               OpBranchConditional %36 %37 %38
+         %37 = OpLabel
+               OpStore %fs_color %39
+               OpBranch %38
+         %38 = OpLabel
+               OpReturn
+               OpFunctionEnd
+
+[vertex shader]
+#version 450
+
+layout(location = 0) uniform dvec4 expected;
+
+layout(location = 0) in dvec4 value;
+layout(location = 1) in vec4 piglit_vertex;
+
+layout(location = 0) out vec4 fs_color;
+
+void main()
+{
+    gl_Position = piglit_vertex;
+
+    fs_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+    if (value != expected)
+       fs_color = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment 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; 6
+; Bound: 13
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %color %fs_color
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %color "color"
+               OpName %fs_color "fs_color"
+               OpDecorate %color Location 0
+               OpDecorate %fs_color Location 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+      %color = OpVariable %_ptr_Output_v4float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+   %fs_color = OpVariable %_ptr_Input_v4float Input
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %12 = OpLoad %v4float %fs_color
+               OpStore %color %12
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout(location = 0) in vec4 fs_color;
+layout(location = 0) out vec4 color;
+
+void main()
+{
+  color = fs_color;
+}
+
+[vertex data]
+    0/double/dvec4   1/float/vec4
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                -1.0 -1.0 0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                 1.0 -1.0  0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                 1.0  1.0  0.0 1.0
+    0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff                -1.0  1.0  0.0 1.0
+
+
+[test]
+uniform dvec4 0 0xffefffffffffffff 0xcb1e35ed24eb6496 0xc8b1381a93a87849 0xc7efffffefffffff
+clear color 1.0 1.0 1.0 1.0
+clear
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0