1 // 2 // Copyright 2021 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // MonomorphizeUnsupportedFunctions: Monomorphize functions that are called with 7 // parameters that are incompatible with both Vulkan GLSL and Metal: 8 // 9 // - Samplers in structs 10 // - Structs that have samplers 11 // - Partially subscripted array of array of samplers 12 // - Partially subscripted array of array of images 13 // - Atomic counters 14 // - samplerCube variables when emulating ES2's cube map sampling 15 // - image* variables with r32f formats (to emulate imageAtomicExchange) 16 // 17 // This transformation basically duplicates such functions, removes the 18 // sampler/image/atomic_counter parameters and uses the opaque uniforms used by the caller. 19 20 #ifndef COMPILER_TRANSLATOR_TREEOPS_MONOMORPHIZEUNSUPPORTEDFUNCTIONS_H_ 21 #define COMPILER_TRANSLATOR_TREEOPS_MONOMORPHIZEUNSUPPORTEDFUNCTIONS_H_ 22 23 #include "common/angleutils.h" 24 #include "compiler/translator/Compiler.h" 25 26 namespace sh 27 { 28 class TIntermBlock; 29 class TSymbolTable; 30 31 // Types of function prameters that should trigger monomorphization. 32 enum class UnsupportedFunctionArgs 33 { 34 StructContainingSamplers = 0, 35 ArrayOfArrayOfSamplerOrImage = 1, 36 AtomicCounter = 2, 37 Image = 3, 38 PixelLocalStorage = 4, 39 40 InvalidEnum = 6, 41 EnumCount = 6, 42 }; 43 44 using UnsupportedFunctionArgsBitSet = angle::PackedEnumBitSet<UnsupportedFunctionArgs>; 45 46 [[nodiscard]] bool MonomorphizeUnsupportedFunctions(TCompiler *compiler, 47 TIntermBlock *root, 48 TSymbolTable *symbolTable, 49 UnsupportedFunctionArgsBitSet); 50 } // namespace sh 51 52 #endif // COMPILER_TRANSLATOR_TREEOPS_MONOMORPHIZEUNSUPPORTEDFUNCTIONS_H_ 53