| # Copyright 2019 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # A test for a bug found by GraphicsFuzz; reduced by spirv-fuzz and by hand. |
| # A fragment shader with two nested loops. All loop conditions are false. |
| # Block %45 is both a continue block and a merge block. |
| # We check that all pixels are red. The test passes because the final statement |
| # writes red to _GLF_color. |
| |
| [vertex shader passthrough] |
| |
| [fragment shader spirv] |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %main "main" %_GLF_color |
| OpExecutionMode %main OriginUpperLeft |
| OpSource ESSL 310 |
| OpName %main "main" |
| OpName %_GLF_color "_GLF_color" |
| OpDecorate %_GLF_color Location 0 |
| %void = OpTypeVoid |
| %6 = OpTypeFunction %void |
| %float = OpTypeFloat 32 |
| %float_1 = OpConstant %float 1 |
| %float_0 = OpConstant %float 0 |
| %v4float = OpTypeVector %float 4 |
| %red = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 |
| %_ptr_Output_v4float = OpTypePointer Output %v4float |
| %_GLF_color = OpVariable %_ptr_Output_v4float Output |
| %bool = OpTypeBool |
| %true = OpConstantTrue %bool |
| %false = OpConstantFalse %bool |
| |
| %main = OpFunction %void None %6 |
| %23 = OpLabel |
| OpBranch %42 |
| %42 = OpLabel |
| OpLoopMerge %47 %45 None |
| OpBranchConditional %false %49 %47 |
| %49 = OpLabel |
| OpLoopMerge %50 %52 None |
| OpBranchConditional %false %50 %50 |
| %52 = OpLabel |
| OpBranch %49 |
| %50 = OpLabel |
| OpBranch %45 |
| %45 = OpLabel |
| OpBranch %42 |
| %47 = OpLabel |
| OpStore %_GLF_color %red |
| OpReturn |
| OpFunctionEnd |
| |
| |
| [test] |
| draw rect -1 -1 2 2 |
| probe all rgba 1 0 0 1 |