• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 the GraphicsFuzz project.
19
20# Short description: A fragment shader that covers a specific selection DAG code path
21
22# The test passes because the shader always writes red.
23
24SHADER vertex variant_vertex_shader PASSTHROUGH
25
26# variant_fragment_shader is derived from the following GLSL:
27# #version 310 es
28# #define _int_1 _GLF_uniform_int_values[0]
29# #define _int_0 _GLF_uniform_int_values[1]
30#
31# precision highp float;
32# precision highp int;
33#
34# // Contents of _GLF_uniform_int_values: [1, 0]
35# layout(set = 0, binding = 0) uniform buf0
36# {
37#     int _GLF_uniform_int_values[2];
38# };
39#
40# layout(location = 0) out vec4 _GLF_color;
41#
42# void main()
43# {
44#     _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
45#     vec4 v = _GLF_color;
46#     _GLF_color = vec4(0);
47#     _GLF_color = v;
48# }
49SHADER 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" %9
59               OpExecutionMode %4 OriginUpperLeft
60               OpSource ESSL 310
61               OpName %4 "main"
62               OpName %9 "_GLF_color"
63               OpName %14 "buf0"
64               OpMemberName %14 0 "_GLF_uniform_int_values"
65               OpName %16 ""
66               OpName %34 "v"
67               OpDecorate %9 Location 0
68               OpDecorate %13 ArrayStride 16
69               OpMemberDecorate %14 0 Offset 0
70               OpDecorate %14 Block
71               OpDecorate %16 DescriptorSet 0
72               OpDecorate %16 Binding 0
73          %2 = OpTypeVoid
74          %3 = OpTypeFunction %2
75          %6 = OpTypeFloat 32
76          %7 = OpTypeVector %6 4
77          %8 = OpTypePointer Output %7
78          %9 = OpVariable %8 Output
79         %10 = OpTypeInt 32 1
80         %11 = OpTypeInt 32 0
81         %12 = OpConstant %11 2
82         %13 = OpTypeArray %10 %12
83         %14 = OpTypeStruct %13
84         %15 = OpTypePointer Uniform %14
85         %16 = OpVariable %15 Uniform
86         %17 = OpConstant %10 0
87         %18 = OpTypePointer Uniform %10
88         %22 = OpConstant %10 1
89         %33 = OpTypePointer Function %7
90         %36 = OpConstant %6 0
91         %37 = OpConstantComposite %7 %36 %36 %36 %36
92          %4 = OpFunction %2 None %3
93          %5 = OpLabel
94         %34 = OpVariable %33 Function
95         %19 = OpAccessChain %18 %16 %17 %17
96         %20 = OpLoad %10 %19
97         %21 = OpConvertSToF %6 %20
98         %23 = OpAccessChain %18 %16 %17 %22
99         %24 = OpLoad %10 %23
100         %25 = OpConvertSToF %6 %24
101         %26 = OpAccessChain %18 %16 %17 %22
102         %27 = OpLoad %10 %26
103         %28 = OpConvertSToF %6 %27
104         %29 = OpAccessChain %18 %16 %17 %17
105         %30 = OpLoad %10 %29
106         %31 = OpConvertSToF %6 %30
107         %32 = OpCompositeConstruct %7 %21 %25 %28 %31
108               OpStore %9 %32
109         %35 = OpLoad %7 %9
110               OpStore %34 %35
111               OpStore %9 %37
112         %38 = OpLoad %7 %34
113               OpStore %9 %38
114               OpReturn
115               OpFunctionEnd
116END
117
118# uniforms for variant
119
120# _GLF_uniform_int_values
121BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
122 1 0
123END
124
125BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
126
127PIPELINE graphics variant_pipeline
128  ATTACH variant_vertex_shader
129  ATTACH variant_fragment_shader
130  FRAMEBUFFER_SIZE 256 256
131  BIND BUFFER variant_framebuffer AS color LOCATION 0
132  BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0
133END
134CLEAR_COLOR variant_pipeline 0 0 0 255
135
136CLEAR variant_pipeline
137RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
138
139EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
140