yes
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
#!amber
|
||||
|
||||
# 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.
|
||||
|
||||
DEVICE_EXTENSION VK_KHR_shader_terminate_invocation
|
||||
|
||||
# A test for a bug found by GraphicsFuzz.
|
||||
|
||||
# Short description: An array-manipulating fragment shader with a discard
|
||||
|
||||
# The test passes because the discard is not dynamically reachable, and
|
||||
# data[0] ends up with the value 1.0 after the loop so that red is
|
||||
# rendered
|
||||
|
||||
SHADER vertex variant_vertex_shader PASSTHROUGH
|
||||
|
||||
# variant_fragment_shader is derived from the following GLSL:
|
||||
# #version 310 es
|
||||
#
|
||||
# precision highp float;
|
||||
#
|
||||
# layout(location = 0) out vec4 _GLF_color;
|
||||
#
|
||||
# void main()
|
||||
# {
|
||||
# float data[10] = float[](0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0);
|
||||
# for(int i = 0; i < 10; i++) {
|
||||
# if(gl_FragCoord.x < 0.0) {
|
||||
# discard;
|
||||
# }
|
||||
# data[0] = data[i];
|
||||
# }
|
||||
# _GLF_color = vec4(data[0], 0.0, 0.0, 1.0);
|
||||
# }
|
||||
SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 7
|
||||
; Bound: 61
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_terminate_invocation"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %38 %57
|
||||
OpExecutionMode %4 OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %4 "main"
|
||||
OpName %11 "data"
|
||||
OpName %25 "i"
|
||||
OpName %38 "gl_FragCoord"
|
||||
OpName %57 "_GLF_color"
|
||||
OpDecorate %25 RelaxedPrecision
|
||||
OpDecorate %32 RelaxedPrecision
|
||||
OpDecorate %38 BuiltIn FragCoord
|
||||
OpDecorate %48 RelaxedPrecision
|
||||
OpDecorate %53 RelaxedPrecision
|
||||
OpDecorate %55 RelaxedPrecision
|
||||
OpDecorate %57 Location 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeInt 32 0
|
||||
%8 = OpConstant %7 10
|
||||
%9 = OpTypeArray %6 %8
|
||||
%10 = OpTypePointer Function %9
|
||||
%12 = OpConstant %6 0.100000001
|
||||
%13 = OpConstant %6 0.200000003
|
||||
%14 = OpConstant %6 0.300000012
|
||||
%15 = OpConstant %6 0.400000006
|
||||
%16 = OpConstant %6 0.5
|
||||
%17 = OpConstant %6 0.600000024
|
||||
%18 = OpConstant %6 0.699999988
|
||||
%19 = OpConstant %6 0.800000012
|
||||
%20 = OpConstant %6 0.899999976
|
||||
%21 = OpConstant %6 1
|
||||
%22 = OpConstantComposite %9 %12 %13 %14 %15 %16 %17 %18 %19 %20 %21
|
||||
%23 = OpTypeInt 32 1
|
||||
%24 = OpTypePointer Function %23
|
||||
%26 = OpConstant %23 0
|
||||
%33 = OpConstant %23 10
|
||||
%34 = OpTypeBool
|
||||
%36 = OpTypeVector %6 4
|
||||
%37 = OpTypePointer Input %36
|
||||
%38 = OpVariable %37 Input
|
||||
%39 = OpConstant %7 0
|
||||
%40 = OpTypePointer Input %6
|
||||
%43 = OpConstant %6 0
|
||||
%49 = OpTypePointer Function %6
|
||||
%54 = OpConstant %23 1
|
||||
%56 = OpTypePointer Output %36
|
||||
%57 = OpVariable %56 Output
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%11 = OpVariable %10 Function
|
||||
%25 = OpVariable %24 Function
|
||||
OpStore %11 %22
|
||||
OpStore %25 %26
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
OpLoopMerge %29 %30 None
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%32 = OpLoad %23 %25
|
||||
%35 = OpSLessThan %34 %32 %33
|
||||
OpBranchConditional %35 %28 %29
|
||||
%28 = OpLabel
|
||||
%41 = OpAccessChain %40 %38 %39
|
||||
%42 = OpLoad %6 %41
|
||||
%44 = OpFOrdLessThan %34 %42 %43
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %44 %45 %46
|
||||
%45 = OpLabel
|
||||
OpTerminateInvocation
|
||||
%46 = OpLabel
|
||||
%48 = OpLoad %23 %25
|
||||
%50 = OpAccessChain %49 %11 %48
|
||||
%51 = OpLoad %6 %50
|
||||
%52 = OpAccessChain %49 %11 %26
|
||||
OpStore %52 %51
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
%53 = OpLoad %23 %25
|
||||
%55 = OpIAdd %23 %53 %54
|
||||
OpStore %25 %55
|
||||
OpBranch %27
|
||||
%29 = OpLabel
|
||||
%58 = OpAccessChain %49 %11 %26
|
||||
%59 = OpLoad %6 %58
|
||||
%60 = OpCompositeConstruct %36 %59 %43 %43 %21
|
||||
OpStore %57 %60
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
END
|
||||
|
||||
# uniforms for variant
|
||||
|
||||
|
||||
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
|
||||
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