Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / cov-irbuilder-matrix-cell-uniform.amber
1 #!amber
2
3 # Copyright 2020 Google LLC
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17
18 # A test for a coverage-gap found by GraphicsFuzz.
19
20 # Short description: A fragment shader that covers a specific IR builder path.
21
22 # The test passes because shader always writes red.
23
24 SHADER vertex variant_vertex_shader PASSTHROUGH
25
26 # variant_fragment_shader is derived from the following GLSL:
27 # #version 310 es
28 # precision highp float;
29 #
30 # layout(location = 0) out vec4 _GLF_color;
31 #
32 # layout(set = 0, binding = 0) uniform buf0
33 # {
34 #     float one;
35 # };
36 #
37 # void main()
38 # {
39 #     mat4 m = mat4(1.0, 1.0, 0.0, 1.0,
40 #                   0.0, 0.0, 1.0, 1.0,
41 #                   0.0, 0.0, one, 0.0,
42 #                   0.0, 0.0, 0.0, 0.0);
43 #
44 #     if(abs(determinant(m)) < 0.01)
45 #         _GLF_color = vec4(1, 0, 0, 1);
46 #     else
47 #         _GLF_color = vec4(0);
48 # }
49 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
50 ; SPIR-V
51 ; Version: 1.0
52 ; Generator: Khronos Glslang Reference Front End; 8
53 ; Bound: 39
54 ; Schema: 0
55                OpCapability Shader
56           %1 = OpExtInstImport "GLSL.std.450"
57                OpMemoryModel Logical GLSL450
58                OpEntryPoint Fragment %4 "main" %35
59                OpExecutionMode %4 OriginUpperLeft
60                OpSource ESSL 310
61                OpName %4 "main"
62                OpName %10 "m"
63                OpName %13 "buf0"
64                OpMemberName %13 0 "one"
65                OpName %15 ""
66                OpName %35 "_GLF_color"
67                OpMemberDecorate %13 0 Offset 0
68                OpDecorate %13 Block
69                OpDecorate %15 DescriptorSet 0
70                OpDecorate %15 Binding 0
71                OpDecorate %35 Location 0
72           %2 = OpTypeVoid
73           %3 = OpTypeFunction %2
74           %6 = OpTypeFloat 32
75           %7 = OpTypeVector %6 4
76           %8 = OpTypeMatrix %7 4
77           %9 = OpTypePointer Function %8
78          %11 = OpConstant %6 1
79          %12 = OpConstant %6 0
80          %13 = OpTypeStruct %6
81          %14 = OpTypePointer Uniform %13
82          %15 = OpVariable %14 Uniform
83          %16 = OpTypeInt 32 1
84          %17 = OpConstant %16 0
85          %18 = OpTypePointer Uniform %6
86          %29 = OpConstant %6 0.00999999978
87          %30 = OpTypeBool
88          %34 = OpTypePointer Output %7
89          %35 = OpVariable %34 Output
90          %36 = OpConstantComposite %7 %11 %12 %12 %11
91          %38 = OpConstantComposite %7 %12 %12 %12 %12
92           %4 = OpFunction %2 None %3
93           %5 = OpLabel
94          %10 = OpVariable %9 Function
95          %19 = OpAccessChain %18 %15 %17
96          %20 = OpLoad %6 %19
97          %21 = OpCompositeConstruct %7 %11 %11 %12 %11
98          %22 = OpCompositeConstruct %7 %12 %12 %11 %11
99          %23 = OpCompositeConstruct %7 %12 %12 %20 %12
100          %24 = OpCompositeConstruct %7 %12 %12 %12 %12
101          %25 = OpCompositeConstruct %8 %21 %22 %23 %24
102                OpStore %10 %25
103          %26 = OpLoad %8 %10
104          %27 = OpExtInst %6 %1 Determinant %26
105          %28 = OpExtInst %6 %1 FAbs %27
106          %31 = OpFOrdLessThan %30 %28 %29
107                OpSelectionMerge %33 None
108                OpBranchConditional %31 %32 %37
109          %32 = OpLabel
110                OpStore %35 %36
111                OpBranch %33
112          %37 = OpLabel
113                OpStore %35 %38
114                OpBranch %33
115          %33 = OpLabel
116                OpReturn
117                OpFunctionEnd
118 END
119
120 # uniforms for variant
121
122 # one
123 BUFFER variant_one DATA_TYPE float DATA
124  1.0
125 END
126
127 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
128
129 PIPELINE graphics variant_pipeline
130   ATTACH variant_vertex_shader
131   ATTACH variant_fragment_shader
132   FRAMEBUFFER_SIZE 256 256
133   BIND BUFFER variant_framebuffer AS color LOCATION 0
134   BIND BUFFER variant_one AS uniform DESCRIPTOR_SET 0 BINDING 0
135 END
136 CLEAR_COLOR variant_pipeline 0 0 0 255
137
138 CLEAR variant_pipeline
139 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
140
141 EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255