| #!amber |
| |
| # Copyright 2020 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 coverage-gap found by the GraphicsFuzz project. |
| |
| # Short description: A fragment shader that covers a specific floating point code path |
| |
| # The test passes because the shader always writes red. |
| |
| SHADER vertex variant_vertex_shader PASSTHROUGH |
| |
| # variant_fragment_shader is derived from the following GLSL: |
| # #version 310 es |
| # #define _int_0 _GLF_uniform_int_values[0] |
| # #define _int_1 _GLF_uniform_int_values[1] |
| # #define _float_0_0 _GLF_uniform_float_values[0] |
| # |
| # precision highp float; |
| # precision highp int; |
| # |
| # // Contents of _GLF_uniform_float_values: 0.0 |
| # layout(set = 0, binding = 0) uniform buf0 |
| # { |
| # float _GLF_uniform_float_values[1]; |
| # }; |
| # |
| # // Contents of _GLF_uniform_int_values: [0, 1] |
| # layout(set = 0, binding = 1) uniform buf1 |
| # { |
| # int _GLF_uniform_int_values[2]; |
| # }; |
| # |
| # layout(location = 0) out vec4 _GLF_color; |
| # |
| # void main() |
| # { |
| # float f0 = mod(10.0, 0.000001); |
| # |
| # float s1 = 0.00000000000000000000000000000000000001; |
| # |
| # if (s1 == 0.0) { |
| # s1 = 1.0; |
| # } |
| # |
| # float f1 = mod(10.0, s1); |
| # |
| # // Always true. The first and the second disjunctions hold if the subnormal |
| # // value was flushed to zero, otherwise the third or the fourth disjunction holds. |
| # if (isinf(f1) |
| # || s1 == 1.0 |
| # || (f0 == f1 || (f0 > 0.99 && f0 < 0.01) || (f1 > 0.99 && f1 < 0.01)) |
| # || f1 == 10.0) |
| # { |
| # _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); |
| # } |
| # else |
| # { |
| # _GLF_color = vec4(_int_0); |
| # } |
| # } |
| SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 |
| ; SPIR-V |
| ; Version: 1.0 |
| ; Generator: Khronos Glslang Reference Front End; 8 |
| ; Bound: 97 |
| ; Schema: 0 |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %4 "main" %63 |
| OpExecutionMode %4 OriginUpperLeft |
| OpSource ESSL 310 |
| OpName %4 "main" |
| OpName %8 "f0" |
| OpName %12 "s1" |
| OpName %21 "f1" |
| OpName %63 "_GLF_color" |
| OpName %68 "buf1" |
| OpMemberName %68 0 "_GLF_uniform_int_values" |
| OpName %70 "" |
| OpName %94 "buf0" |
| OpMemberName %94 0 "_GLF_uniform_float_values" |
| OpName %96 "" |
| OpDecorate %63 Location 0 |
| OpDecorate %67 ArrayStride 16 |
| OpMemberDecorate %68 0 Offset 0 |
| OpDecorate %68 Block |
| OpDecorate %70 DescriptorSet 0 |
| OpDecorate %70 Binding 1 |
| OpDecorate %93 ArrayStride 16 |
| OpMemberDecorate %94 0 Offset 0 |
| OpDecorate %94 Block |
| OpDecorate %96 DescriptorSet 0 |
| OpDecorate %96 Binding 0 |
| %2 = OpTypeVoid |
| %3 = OpTypeFunction %2 |
| %6 = OpTypeFloat 32 |
| %7 = OpTypePointer Function %6 |
| %9 = OpConstant %6 10 |
| %10 = OpConstant %6 9.99999997e-07 |
| %13 = OpConstant %6 0x1.b38fb8p-127 |
| %15 = OpConstant %6 0 |
| %16 = OpTypeBool |
| %20 = OpConstant %6 1 |
| %39 = OpConstant %6 0.99000001 |
| %42 = OpConstant %6 0.00999999978 |
| %61 = OpTypeVector %6 4 |
| %62 = OpTypePointer Output %61 |
| %63 = OpVariable %62 Output |
| %64 = OpTypeInt 32 1 |
| %65 = OpTypeInt 32 0 |
| %66 = OpConstant %65 2 |
| %67 = OpTypeArray %64 %66 |
| %68 = OpTypeStruct %67 |
| %69 = OpTypePointer Uniform %68 |
| %70 = OpVariable %69 Uniform |
| %71 = OpConstant %64 0 |
| %72 = OpConstant %64 1 |
| %73 = OpTypePointer Uniform %64 |
| %92 = OpConstant %65 1 |
| %93 = OpTypeArray %6 %92 |
| %94 = OpTypeStruct %93 |
| %95 = OpTypePointer Uniform %94 |
| %96 = OpVariable %95 Uniform |
| %4 = OpFunction %2 None %3 |
| %5 = OpLabel |
| %8 = OpVariable %7 Function |
| %12 = OpVariable %7 Function |
| %21 = OpVariable %7 Function |
| %11 = OpFMod %6 %9 %10 |
| OpStore %8 %11 |
| OpStore %12 %13 |
| %14 = OpLoad %6 %12 |
| %17 = OpFOrdEqual %16 %14 %15 |
| OpSelectionMerge %19 None |
| OpBranchConditional %17 %18 %19 |
| %18 = OpLabel |
| OpStore %12 %20 |
| OpBranch %19 |
| %19 = OpLabel |
| %22 = OpLoad %6 %12 |
| %23 = OpFMod %6 %9 %22 |
| OpStore %21 %23 |
| %24 = OpLoad %6 %21 |
| %25 = OpIsInf %16 %24 |
| %26 = OpLoad %6 %12 |
| %27 = OpFOrdEqual %16 %26 %20 |
| %28 = OpLogicalOr %16 %25 %27 |
| %29 = OpLogicalNot %16 %28 |
| OpSelectionMerge %31 None |
| OpBranchConditional %29 %30 %31 |
| %30 = OpLabel |
| %32 = OpLoad %6 %8 |
| %33 = OpLoad %6 %21 |
| %34 = OpFOrdEqual %16 %32 %33 |
| %35 = OpLogicalNot %16 %34 |
| OpSelectionMerge %37 None |
| OpBranchConditional %35 %36 %37 |
| %36 = OpLabel |
| %38 = OpLoad %6 %8 |
| %40 = OpFOrdGreaterThan %16 %38 %39 |
| %41 = OpLoad %6 %8 |
| %43 = OpFOrdLessThan %16 %41 %42 |
| %44 = OpLogicalAnd %16 %40 %43 |
| OpBranch %37 |
| %37 = OpLabel |
| %45 = OpPhi %16 %34 %30 %44 %36 |
| %46 = OpLogicalNot %16 %45 |
| OpSelectionMerge %48 None |
| OpBranchConditional %46 %47 %48 |
| %47 = OpLabel |
| %49 = OpLoad %6 %21 |
| %50 = OpFOrdGreaterThan %16 %49 %39 |
| %51 = OpLoad %6 %21 |
| %52 = OpFOrdLessThan %16 %51 %42 |
| %53 = OpLogicalAnd %16 %50 %52 |
| OpBranch %48 |
| %48 = OpLabel |
| %54 = OpPhi %16 %45 %37 %53 %47 |
| OpBranch %31 |
| %31 = OpLabel |
| %55 = OpPhi %16 %28 %19 %54 %48 |
| %56 = OpLoad %6 %21 |
| %57 = OpFOrdEqual %16 %56 %9 |
| %58 = OpLogicalOr %16 %55 %57 |
| OpSelectionMerge %60 None |
| OpBranchConditional %58 %59 %87 |
| %59 = OpLabel |
| %74 = OpAccessChain %73 %70 %71 %72 |
| %75 = OpLoad %64 %74 |
| %76 = OpConvertSToF %6 %75 |
| %77 = OpAccessChain %73 %70 %71 %71 |
| %78 = OpLoad %64 %77 |
| %79 = OpConvertSToF %6 %78 |
| %80 = OpAccessChain %73 %70 %71 %71 |
| %81 = OpLoad %64 %80 |
| %82 = OpConvertSToF %6 %81 |
| %83 = OpAccessChain %73 %70 %71 %72 |
| %84 = OpLoad %64 %83 |
| %85 = OpConvertSToF %6 %84 |
| %86 = OpCompositeConstruct %61 %76 %79 %82 %85 |
| OpStore %63 %86 |
| OpBranch %60 |
| %87 = OpLabel |
| %88 = OpAccessChain %73 %70 %71 %71 |
| %89 = OpLoad %64 %88 |
| %90 = OpConvertSToF %6 %89 |
| %91 = OpCompositeConstruct %61 %90 %90 %90 %90 |
| OpStore %63 %91 |
| OpBranch %60 |
| %60 = OpLabel |
| OpReturn |
| OpFunctionEnd |
| END |
| |
| # uniforms for variant |
| |
| # _GLF_uniform_int_values |
| BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA |
| 0 1 |
| END |
| # _GLF_uniform_float_values |
| BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA |
| 0.0 |
| END |
| |
| BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM |
| |
| PIPELINE graphics variant_pipeline |
| ATTACH variant_vertex_shader |
| ATTACH variant_fragment_shader |
| FRAMEBUFFER_SIZE 256 256 |
| BIND BUFFER variant_framebuffer AS color LOCATION 0 |
| BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 1 |
| BIND BUFFER variant__GLF_uniform_float_values AS uniform DESCRIPTOR_SET 0 BINDING 0 |
| END |
| CLEAR_COLOR variant_pipeline 0 0 0 255 |
| |
| CLEAR variant_pipeline |
| RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 |
| |
| EXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 |