1 // 2 // Copyright (c) 2019 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 // TranslatorMetal: 7 // A GLSL-based translator that outputs shaders that fit GL_KHR_vulkan_glsl. 8 // It takes into account some considerations for Metal backend also. 9 // The shaders are then fed into glslang to spit out SPIR-V (libANGLE-side). 10 // See: https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt 11 // 12 // The SPIR-V will then be translated to Metal Shading Language later in Metal backend. 13 // 14 15 #ifndef LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_ 16 #define LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_ 17 18 #include "compiler/translator/TranslatorVulkan.h" 19 20 namespace sh 21 { 22 23 class TranslatorMetal : public TranslatorVulkan 24 { 25 public: 26 TranslatorMetal(sh::GLenum type, ShShaderSpec spec); 27 28 protected: 29 ANGLE_NO_DISCARD bool translate(TIntermBlock *root, 30 ShCompileOptions compileOptions, 31 PerformanceDiagnostics *perfDiagnostics) override; 32 33 ANGLE_NO_DISCARD bool transformDepthBeforeCorrection(TIntermBlock *root, 34 const TVariable *driverUniforms) override; 35 }; 36 37 } // namespace sh 38 39 #endif /* LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_ */ 40