| #!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: Covers specific X86 ISel lowering and machine value type code paths |
| |
| # 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_1 _GLF_uniform_int_values[0] |
| # #define _int_0 _GLF_uniform_int_values[1] |
| # #define _uint_1 _GLF_uniform_uint_values[0] |
| # #define _uint_0 _GLF_uniform_uint_values[1] |
| # #define _float_0_0 _GLF_uniform_float_values[0] |
| # |
| # precision highp float; |
| # precision highp int; |
| # |
| # // Contents of _GLF_uniform_int_values: [1, 0] |
| # layout(set = 0, binding = 0) uniform buf0 |
| # { |
| # int _GLF_uniform_int_values[2]; |
| # }; |
| # |
| # // Contents of _GLF_uniform_uint_values: 1 |
| # layout(set = 0, binding = 1) uniform buf1 |
| # { |
| # uint _GLF_uniform_uint_values[2]; |
| # }; |
| # |
| # // Contents of _GLF_uniform_float_values: 0.0 |
| # layout(set = 0, binding = 2) uniform buf2 |
| # { |
| # float _GLF_uniform_float_values[1]; |
| # }; |
| # |
| # layout(location = 0) out vec4 _GLF_color; |
| # |
| # void main() |
| # { |
| # uint a = _uint_1 >> uint(_float_0_0); |
| # float b = uintBitsToFloat(a); |
| # uint c = floatBitsToUint(b); |
| # |
| # if (c == _uint_1) |
| # { |
| # _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1); |
| # } |
| # else |
| # { |
| # _GLF_color = vec4(b); |
| # } |
| # } |
| SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 |
| ; SPIR-V |
| ; Version: 1.0 |
| ; Generator: Khronos Glslang Reference Front End; 8 |
| ; Bound: 69 |
| ; Schema: 0 |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %4 "main" %46 |
| OpExecutionMode %4 OriginUpperLeft |
| OpSource ESSL 310 |
| OpName %4 "main" |
| OpName %8 "a" |
| OpName %11 "buf1" |
| OpMemberName %11 0 "_GLF_uniform_uint_values" |
| OpName %13 "" |
| OpName %22 "buf2" |
| OpMemberName %22 0 "_GLF_uniform_float_values" |
| OpName %24 "" |
| OpName %31 "b" |
| OpName %34 "c" |
| OpName %46 "_GLF_color" |
| OpName %48 "buf0" |
| OpMemberName %48 0 "_GLF_uniform_int_values" |
| OpName %50 "" |
| OpDecorate %10 ArrayStride 16 |
| OpMemberDecorate %11 0 Offset 0 |
| OpDecorate %11 Block |
| OpDecorate %13 DescriptorSet 0 |
| OpDecorate %13 Binding 1 |
| OpDecorate %21 ArrayStride 16 |
| OpMemberDecorate %22 0 Offset 0 |
| OpDecorate %22 Block |
| OpDecorate %24 DescriptorSet 0 |
| OpDecorate %24 Binding 2 |
| OpDecorate %46 Location 0 |
| OpDecorate %47 ArrayStride 16 |
| OpMemberDecorate %48 0 Offset 0 |
| OpDecorate %48 Block |
| OpDecorate %50 DescriptorSet 0 |
| OpDecorate %50 Binding 0 |
| %2 = OpTypeVoid |
| %3 = OpTypeFunction %2 |
| %6 = OpTypeInt 32 0 |
| %7 = OpTypePointer Function %6 |
| %9 = OpConstant %6 2 |
| %10 = OpTypeArray %6 %9 |
| %11 = OpTypeStruct %10 |
| %12 = OpTypePointer Uniform %11 |
| %13 = OpVariable %12 Uniform |
| %14 = OpTypeInt 32 1 |
| %15 = OpConstant %14 0 |
| %16 = OpTypePointer Uniform %6 |
| %19 = OpTypeFloat 32 |
| %20 = OpConstant %6 1 |
| %21 = OpTypeArray %19 %20 |
| %22 = OpTypeStruct %21 |
| %23 = OpTypePointer Uniform %22 |
| %24 = OpVariable %23 Uniform |
| %25 = OpTypePointer Uniform %19 |
| %30 = OpTypePointer Function %19 |
| %40 = OpTypeBool |
| %44 = OpTypeVector %19 4 |
| %45 = OpTypePointer Output %44 |
| %46 = OpVariable %45 Output |
| %47 = OpTypeArray %14 %9 |
| %48 = OpTypeStruct %47 |
| %49 = OpTypePointer Uniform %48 |
| %50 = OpVariable %49 Uniform |
| %51 = OpTypePointer Uniform %14 |
| %55 = OpConstant %14 1 |
| %4 = OpFunction %2 None %3 |
| %5 = OpLabel |
| %8 = OpVariable %7 Function |
| %31 = OpVariable %30 Function |
| %34 = OpVariable %7 Function |
| %17 = OpAccessChain %16 %13 %15 %15 |
| %18 = OpLoad %6 %17 |
| %26 = OpAccessChain %25 %24 %15 %15 |
| %27 = OpLoad %19 %26 |
| %28 = OpConvertFToU %6 %27 |
| %29 = OpShiftRightLogical %6 %18 %28 |
| OpStore %8 %29 |
| %32 = OpLoad %6 %8 |
| %33 = OpBitcast %19 %32 |
| OpStore %31 %33 |
| %35 = OpLoad %19 %31 |
| %36 = OpBitcast %6 %35 |
| OpStore %34 %36 |
| %37 = OpLoad %6 %34 |
| %38 = OpAccessChain %16 %13 %15 %15 |
| %39 = OpLoad %6 %38 |
| %41 = OpIEqual %40 %37 %39 |
| OpSelectionMerge %43 None |
| OpBranchConditional %41 %42 %66 |
| %42 = OpLabel |
| %52 = OpAccessChain %51 %50 %15 %15 |
| %53 = OpLoad %14 %52 |
| %54 = OpConvertSToF %19 %53 |
| %56 = OpAccessChain %51 %50 %15 %55 |
| %57 = OpLoad %14 %56 |
| %58 = OpConvertSToF %19 %57 |
| %59 = OpAccessChain %51 %50 %15 %55 |
| %60 = OpLoad %14 %59 |
| %61 = OpConvertSToF %19 %60 |
| %62 = OpAccessChain %51 %50 %15 %15 |
| %63 = OpLoad %14 %62 |
| %64 = OpConvertSToF %19 %63 |
| %65 = OpCompositeConstruct %44 %54 %58 %61 %64 |
| OpStore %46 %65 |
| OpBranch %43 |
| %66 = OpLabel |
| %67 = OpLoad %19 %31 |
| %68 = OpCompositeConstruct %44 %67 %67 %67 %67 |
| OpStore %46 %68 |
| OpBranch %43 |
| %43 = OpLabel |
| OpReturn |
| OpFunctionEnd |
| END |
| |
| # uniforms for variant |
| |
| # _GLF_uniform_float_values |
| BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA |
| 0.0 |
| END |
| # _GLF_uniform_uint_values |
| BUFFER variant__GLF_uniform_uint_values DATA_TYPE int32[] STD140 DATA |
| 1 0 |
| END |
| # _GLF_uniform_int_values |
| BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA |
| 1 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_float_values AS uniform DESCRIPTOR_SET 0 BINDING 2 |
| BIND BUFFER variant__GLF_uniform_uint_values AS uniform DESCRIPTOR_SET 0 BINDING 1 |
| BIND BUFFER variant__GLF_uniform_int_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 |