1e5c31af7Sopenharmony_ci#!amber 2e5c31af7Sopenharmony_ci 3e5c31af7Sopenharmony_ci# Copyright 2018 Google LLC 4e5c31af7Sopenharmony_ci# 5e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 6e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License. 7e5c31af7Sopenharmony_ci# You may obtain a copy of the License at 8e5c31af7Sopenharmony_ci# 9e5c31af7Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 10e5c31af7Sopenharmony_ci# 11e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 12e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 13e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and 15e5c31af7Sopenharmony_ci# limitations under the License. 16e5c31af7Sopenharmony_ci 17e5c31af7Sopenharmony_ci# A test for a bug found by GraphicsFuzz. 18e5c31af7Sopenharmony_ci 19e5c31af7Sopenharmony_ci# A fragment shader that uses pow. 20e5c31af7Sopenharmony_ci# Derived from the following GLSL fragment shader. 21e5c31af7Sopenharmony_ci# We check that all pixels are red. The test passes because main does 22e5c31af7Sopenharmony_ci# some computation and then writes red to _GLF_color. 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ci# #version 310 es 25e5c31af7Sopenharmony_ci# 26e5c31af7Sopenharmony_ci# precision highp float; 27e5c31af7Sopenharmony_ci# precision highp int; 28e5c31af7Sopenharmony_ci# 29e5c31af7Sopenharmony_ci# layout(location = 0) out vec4 _GLF_color; 30e5c31af7Sopenharmony_ci# 31e5c31af7Sopenharmony_ci# void main() 32e5c31af7Sopenharmony_ci# { 33e5c31af7Sopenharmony_ci# vec2 a = vec2(1.0); 34e5c31af7Sopenharmony_ci# vec4 b = vec4(1.0); 35e5c31af7Sopenharmony_ci# pow(vec4(a, vec2(1.0)), b); 36e5c31af7Sopenharmony_ci# _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); 37e5c31af7Sopenharmony_ci# } 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_ciSHADER vertex variant_vertex_shader PASSTHROUGH 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_ciSHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 42e5c31af7Sopenharmony_ci; SPIR-V 43e5c31af7Sopenharmony_ci; Version: 1.0 44e5c31af7Sopenharmony_ci; Generator: Khronos SPIR-V Tools Assembler; 0 45e5c31af7Sopenharmony_ci; Bound: 28 46e5c31af7Sopenharmony_ci; Schema: 0 47e5c31af7Sopenharmony_ci OpCapability Shader 48e5c31af7Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 49e5c31af7Sopenharmony_ci OpMemoryModel Logical GLSL450 50e5c31af7Sopenharmony_ci OpEntryPoint Fragment %2 "main" %3 51e5c31af7Sopenharmony_ci OpExecutionMode %2 OriginUpperLeft 52e5c31af7Sopenharmony_ci OpSource ESSL 310 53e5c31af7Sopenharmony_ci OpName %2 "main" 54e5c31af7Sopenharmony_ci OpName %4 "a" 55e5c31af7Sopenharmony_ci OpName %5 "b" 56e5c31af7Sopenharmony_ci OpName %3 "_GLF_color" 57e5c31af7Sopenharmony_ci OpDecorate %3 Location 0 58e5c31af7Sopenharmony_ci %6 = OpTypeVoid 59e5c31af7Sopenharmony_ci %7 = OpTypeFunction %6 60e5c31af7Sopenharmony_ci %8 = OpTypeFloat 32 61e5c31af7Sopenharmony_ci %9 = OpTypeVector %8 2 62e5c31af7Sopenharmony_ci %10 = OpTypePointer Function %9 63e5c31af7Sopenharmony_ci %11 = OpConstant %8 1 64e5c31af7Sopenharmony_ci %12 = OpConstantComposite %9 %11 %11 65e5c31af7Sopenharmony_ci %13 = OpTypeVector %8 4 66e5c31af7Sopenharmony_ci %14 = OpTypePointer Function %13 67e5c31af7Sopenharmony_ci %15 = OpConstantComposite %13 %11 %11 %11 %11 68e5c31af7Sopenharmony_ci %16 = OpTypePointer Output %13 69e5c31af7Sopenharmony_ci %3 = OpVariable %16 Output 70e5c31af7Sopenharmony_ci %17 = OpConstant %8 0 71e5c31af7Sopenharmony_ci %18 = OpConstantComposite %13 %11 %17 %17 %11 72e5c31af7Sopenharmony_ci %2 = OpFunction %6 None %7 73e5c31af7Sopenharmony_ci %19 = OpLabel 74e5c31af7Sopenharmony_ci %4 = OpVariable %10 Function 75e5c31af7Sopenharmony_ci %5 = OpVariable %14 Function 76e5c31af7Sopenharmony_ci OpStore %4 %12 77e5c31af7Sopenharmony_ci OpStore %5 %15 78e5c31af7Sopenharmony_ci %20 = OpLoad %9 %4 79e5c31af7Sopenharmony_ci %21 = OpCompositeExtract %8 %20 0 80e5c31af7Sopenharmony_ci %22 = OpCompositeExtract %8 %20 1 81e5c31af7Sopenharmony_ci %23 = OpCompositeExtract %8 %12 0 82e5c31af7Sopenharmony_ci %24 = OpCompositeExtract %8 %12 1 83e5c31af7Sopenharmony_ci %25 = OpCompositeConstruct %13 %21 %22 %23 %24 84e5c31af7Sopenharmony_ci %26 = OpLoad %13 %5 85e5c31af7Sopenharmony_ci %27 = OpExtInst %13 %1 Pow %25 %26 86e5c31af7Sopenharmony_ci OpStore %3 %18 87e5c31af7Sopenharmony_ci OpReturn 88e5c31af7Sopenharmony_ci OpFunctionEnd 89e5c31af7Sopenharmony_ciEND 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ciBUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM 92e5c31af7Sopenharmony_ci 93e5c31af7Sopenharmony_ciPIPELINE graphics variant_pipeline 94e5c31af7Sopenharmony_ci ATTACH variant_vertex_shader 95e5c31af7Sopenharmony_ci ATTACH variant_fragment_shader 96e5c31af7Sopenharmony_ci FRAMEBUFFER_SIZE 256 256 97e5c31af7Sopenharmony_ci BIND BUFFER variant_framebuffer AS color LOCATION 0 98e5c31af7Sopenharmony_ciEND 99e5c31af7Sopenharmony_ciCLEAR_COLOR variant_pipeline 0 0 0 255 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_ciCLEAR variant_pipeline 102e5c31af7Sopenharmony_ciRUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 103e5c31af7Sopenharmony_ci 104e5c31af7Sopenharmony_ciEXPECT variant_framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255 105