1 // 2 // Copyright 2020 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 7 #ifndef COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITEUNADDRESSABLEREFERENCES_H_ 8 #define COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITEUNADDRESSABLEREFERENCES_H_ 9 10 #include "compiler/translator/Compiler.h" 11 #include "compiler/translator/TranslatorMetalDirect/ProgramPrelude.h" 12 #include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h" 13 14 namespace sh 15 { 16 17 // Given: 18 // void foo(out x); 19 // It is possible for the following to be legal in GLSL but not in Metal: 20 // foo(expression); 21 // This can happen in cases where `expression` is a vector swizzle or vector element access. 22 // This rewrite functionality introduces temporaries that serve as proxies to be passed to the 23 // out/inout parameters as needed. The corresponding expressions get populated with their 24 // proxies after the function call. 25 ANGLE_NO_DISCARD bool RewriteUnaddressableReferences(TCompiler &compiler, 26 TIntermBlock &root, 27 SymbolEnv &symbolEnv); 28 29 } // namespace sh 30 31 #endif // COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITEUNADDRESSABLEREFERENCES_H_ 32