1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci
3e5c31af7Sopenharmony_ci# Copyright 2019 Google LLC
4e5c31af7Sopenharmony_ci#
5e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
6e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
7e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
8e5c31af7Sopenharmony_ci#
9e5c31af7Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
10e5c31af7Sopenharmony_ci#
11e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
12e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
13e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
15e5c31af7Sopenharmony_ci# limitations under the License.
16e5c31af7Sopenharmony_ci
17e5c31af7Sopenharmony_ci# A test for a bug found by GraphicsFuzz; reduced by spirv-fuzz and by hand.
18e5c31af7Sopenharmony_ci# A fragment shader with two nested loops. All loop conditions are false.
19e5c31af7Sopenharmony_ci# We check that all pixels are red. The test passes because the final statement
20e5c31af7Sopenharmony_ci# writes red to _GLF_color.
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_ciSHADER vertex variant_vertex_shader PASSTHROUGH
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciSHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
25e5c31af7Sopenharmony_ci; SPIR-V
26e5c31af7Sopenharmony_ci; Version: 1.0
27e5c31af7Sopenharmony_ci; Generator: Khronos SPIR-V Tools Assembler; 0
28e5c31af7Sopenharmony_ci; Bound: 22
29e5c31af7Sopenharmony_ci; Schema: 0
30e5c31af7Sopenharmony_ci               OpCapability Shader
31e5c31af7Sopenharmony_ci          %1 = OpExtInstImport "GLSL.std.450"
32e5c31af7Sopenharmony_ci               OpMemoryModel Logical GLSL450
33e5c31af7Sopenharmony_ci               OpEntryPoint Fragment %2 "main" %3
34e5c31af7Sopenharmony_ci               OpExecutionMode %2 OriginUpperLeft
35e5c31af7Sopenharmony_ci               OpSource ESSL 310
36e5c31af7Sopenharmony_ci               OpName %2 "main"
37e5c31af7Sopenharmony_ci               OpName %3 "_GLF_color"
38e5c31af7Sopenharmony_ci               OpDecorate %3 Location 0
39e5c31af7Sopenharmony_ci          %4 = OpTypeVoid
40e5c31af7Sopenharmony_ci          %5 = OpTypeFunction %4
41e5c31af7Sopenharmony_ci          %6 = OpTypeFloat 32
42e5c31af7Sopenharmony_ci          %7 = OpConstant %6 1
43e5c31af7Sopenharmony_ci          %8 = OpConstant %6 0
44e5c31af7Sopenharmony_ci          %9 = OpTypeVector %6 4
45e5c31af7Sopenharmony_ci         %10 = OpConstantComposite %9 %7 %8 %8 %7
46e5c31af7Sopenharmony_ci         %11 = OpTypePointer Output %9
47e5c31af7Sopenharmony_ci          %3 = OpVariable %11 Output
48e5c31af7Sopenharmony_ci         %12 = OpTypeBool
49e5c31af7Sopenharmony_ci         %13 = OpConstantTrue %12
50e5c31af7Sopenharmony_ci         %14 = OpConstantFalse %12
51e5c31af7Sopenharmony_ci          %2 = OpFunction %4 None %5
52e5c31af7Sopenharmony_ci         %15 = OpLabel
53e5c31af7Sopenharmony_ci               OpBranch %16
54e5c31af7Sopenharmony_ci         %16 = OpLabel
55e5c31af7Sopenharmony_ci               OpLoopMerge %17 %18 None
56e5c31af7Sopenharmony_ci               OpBranchConditional %14 %19 %17
57e5c31af7Sopenharmony_ci         %19 = OpLabel
58e5c31af7Sopenharmony_ci               OpLoopMerge %20 %21 None
59e5c31af7Sopenharmony_ci               OpBranchConditional %14 %20 %20
60e5c31af7Sopenharmony_ci         %21 = OpLabel
61e5c31af7Sopenharmony_ci               OpBranch %19
62e5c31af7Sopenharmony_ci         %20 = OpLabel
63e5c31af7Sopenharmony_ci               OpBranch %18
64e5c31af7Sopenharmony_ci         %18 = OpLabel
65e5c31af7Sopenharmony_ci               OpBranch %16
66e5c31af7Sopenharmony_ci         %17 = OpLabel
67e5c31af7Sopenharmony_ci               OpStore %3 %10
68e5c31af7Sopenharmony_ci               OpReturn
69e5c31af7Sopenharmony_ci               OpFunctionEnd
70e5c31af7Sopenharmony_ciEND
71e5c31af7Sopenharmony_ci
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_ciBUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
74e5c31af7Sopenharmony_ci
75e5c31af7Sopenharmony_ciPIPELINE graphics variant_pipeline
76e5c31af7Sopenharmony_ci  ATTACH variant_vertex_shader
77e5c31af7Sopenharmony_ci  ATTACH variant_fragment_shader
78e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE 256 256
79e5c31af7Sopenharmony_ci  BIND BUFFER variant_framebuffer AS color LOCATION 0
80e5c31af7Sopenharmony_ciEND
81e5c31af7Sopenharmony_ciCLEAR_COLOR variant_pipeline 0 0 0 255
82e5c31af7Sopenharmony_ci
83e5c31af7Sopenharmony_ciCLEAR variant_pipeline
84e5c31af7Sopenharmony_ciRUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
85e5c31af7Sopenharmony_ci
86e5c31af7Sopenharmony_ciEXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
87