yes
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
#!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 instruction combine compare 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_1 _GLF_uniform_int_values[0]
|
||||
# #define _int_0 _GLF_uniform_int_values[1]
|
||||
# #define _float_0_0 _GLF_uniform_float_values[0]
|
||||
# #define _float_1_0 _GLF_uniform_float_values[1]
|
||||
# #define _float_2_0 _GLF_uniform_float_values[2]
|
||||
# #define _float_3_0 _GLF_uniform_float_values[3]
|
||||
#
|
||||
# precision highp float;
|
||||
# precision highp int;
|
||||
#
|
||||
# // Contents of _GLF_uniform_float_values: [0.0, 1.0, 2.0, 3.0]
|
||||
# layout(set = 0, binding = 0) uniform buf0
|
||||
# {
|
||||
# float _GLF_uniform_float_values[4];
|
||||
# };
|
||||
#
|
||||
# // Contents of _GLF_uniform_int_values: [1, 0]
|
||||
# layout(set = 0, binding = 1) uniform buf1
|
||||
# {
|
||||
# int _GLF_uniform_int_values[2];
|
||||
# };
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# // a becomes 0.
|
||||
# int a = (gl_FragCoord.y >= _float_0_0) ? 0 : 2;
|
||||
#
|
||||
# float b = vec3(_float_1_0, _float_2_0, _float_3_0)[a];
|
||||
#
|
||||
# if (b == _float_1_0)
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1, _int_0, _int_0, _int_1);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# _GLF_color = vec4(_int_1);
|
||||
# }
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 8
|
||||
; Bound: 77
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %12 %52
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %8 "a"
|
||||
OpName %12 "gl_FragCoord"
|
||||
OpName %20 "buf0"
|
||||
OpMemberName %20 0 "_GLF_uniform_float_values"
|
||||
OpName %22 ""
|
||||
OpName %32 "b"
|
||||
OpName %52 "_GLF_color"
|
||||
OpName %55 "buf1"
|
||||
OpMemberName %55 0 "_GLF_uniform_int_values"
|
||||
OpName %57 ""
|
||||
OpDecorate %12 BuiltIn FragCoord
|
||||
OpDecorate %19 ArrayStride 16
|
||||
OpMemberDecorate %20 0 Offset 0
|
||||
OpDecorate %20 Block
|
||||
OpDecorate %22 DescriptorSet 0
|
||||
OpDecorate %22 Binding 0
|
||||
OpDecorate %52 Location 0
|
||||
OpDecorate %54 ArrayStride 16
|
||||
OpMemberDecorate %55 0 Offset 0
|
||||
OpDecorate %55 Block
|
||||
OpDecorate %57 DescriptorSet 0
|
||||
OpDecorate %57 Binding 1
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeInt 32 1
|
||||
%7 = OpTypePointer Function %6
|
||||
%9 = OpTypeFloat 32
|
||||
%10 = OpTypeVector %9 4
|
||||
%11 = OpTypePointer Input %10
|
||||
%12 = OpVariable %11 Input
|
||||
%13 = OpTypeInt 32 0
|
||||
%14 = OpConstant %13 1
|
||||
%15 = OpTypePointer Input %9
|
||||
%18 = OpConstant %13 4
|
||||
%19 = OpTypeArray %9 %18
|
||||
%20 = OpTypeStruct %19
|
||||
%21 = OpTypePointer Uniform %20
|
||||
%22 = OpVariable %21 Uniform
|
||||
%23 = OpConstant %6 0
|
||||
%24 = OpTypePointer Uniform %9
|
||||
%27 = OpTypeBool
|
||||
%29 = OpConstant %6 2
|
||||
%31 = OpTypePointer Function %9
|
||||
%33 = OpConstant %6 1
|
||||
%38 = OpConstant %6 3
|
||||
%41 = OpTypeVector %9 3
|
||||
%51 = OpTypePointer Output %10
|
||||
%52 = OpVariable %51 Output
|
||||
%53 = OpConstant %13 2
|
||||
%54 = OpTypeArray %6 %53
|
||||
%55 = OpTypeStruct %54
|
||||
%56 = OpTypePointer Uniform %55
|
||||
%57 = OpVariable %56 Uniform
|
||||
%58 = OpTypePointer Uniform %6
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%8 = OpVariable %7 Function
|
||||
%32 = OpVariable %31 Function
|
||||
%16 = OpAccessChain %15 %12 %14
|
||||
%17 = OpLoad %9 %16
|
||||
%25 = OpAccessChain %24 %22 %23 %23
|
||||
%26 = OpLoad %9 %25
|
||||
%28 = OpFOrdGreaterThanEqual %27 %17 %26
|
||||
%30 = OpSelect %6 %28 %23 %29
|
||||
OpStore %8 %30
|
||||
%34 = OpAccessChain %24 %22 %23 %33
|
||||
%35 = OpLoad %9 %34
|
||||
%36 = OpAccessChain %24 %22 %23 %29
|
||||
%37 = OpLoad %9 %36
|
||||
%39 = OpAccessChain %24 %22 %23 %38
|
||||
%40 = OpLoad %9 %39
|
||||
%42 = OpCompositeConstruct %41 %35 %37 %40
|
||||
%43 = OpLoad %6 %8
|
||||
%44 = OpVectorExtractDynamic %9 %42 %43
|
||||
OpStore %32 %44
|
||||
%45 = OpLoad %9 %32
|
||||
%46 = OpAccessChain %24 %22 %23 %33
|
||||
%47 = OpLoad %9 %46
|
||||
%48 = OpFOrdEqual %27 %45 %47
|
||||
OpSelectionMerge %50 None
|
||||
OpBranchConditional %48 %49 %72
|
||||
%49 = OpLabel
|
||||
%59 = OpAccessChain %58 %57 %23 %23
|
||||
%60 = OpLoad %6 %59
|
||||
%61 = OpConvertSToF %9 %60
|
||||
%62 = OpAccessChain %58 %57 %23 %33
|
||||
%63 = OpLoad %6 %62
|
||||
%64 = OpConvertSToF %9 %63
|
||||
%65 = OpAccessChain %58 %57 %23 %33
|
||||
%66 = OpLoad %6 %65
|
||||
%67 = OpConvertSToF %9 %66
|
||||
%68 = OpAccessChain %58 %57 %23 %23
|
||||
%69 = OpLoad %6 %68
|
||||
%70 = OpConvertSToF %9 %69
|
||||
%71 = OpCompositeConstruct %10 %61 %64 %67 %70
|
||||
OpStore %52 %71
|
||||
OpBranch %50
|
||||
%72 = OpLabel
|
||||
%73 = OpAccessChain %58 %57 %23 %23
|
||||
%74 = OpLoad %6 %73
|
||||
%75 = OpConvertSToF %9 %74
|
||||
%76 = OpCompositeConstruct %10 %75 %75 %75 %75
|
||||
OpStore %52 %76
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
# _GLF_uniform_int_values
|
||||
BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA
|
||||
1 0
|
||||
END
|
||||
# _GLF_uniform_float_values
|
||||
BUFFER variant__GLF_uniform_float_values DATA_TYPE float[] STD140 DATA
|
||||
0.0 1.0 2.0 3.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
|
||||
Reference in New Issue
Block a user