Path: blob/main_old/src/compiler/translator/CodeGen.cpp
1693 views
//1// Copyright 2013 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#ifdef ANGLE_ENABLE_ESSL7# include "compiler/translator/TranslatorESSL.h"8#endif // ANGLE_ENABLE_ESSL910#ifdef ANGLE_ENABLE_GLSL11# include "compiler/translator/TranslatorGLSL.h"12#endif // ANGLE_ENABLE_GLSL1314#ifdef ANGLE_ENABLE_HLSL15# include "compiler/translator/TranslatorHLSL.h"16#endif // ANGLE_ENABLE_HLSL1718#ifdef ANGLE_ENABLE_VULKAN19# include "compiler/translator/TranslatorVulkan.h"20#endif // ANGLE_ENABLE_VULKAN2122#ifdef ANGLE_ENABLE_METAL23# include "compiler/translator/TranslatorMetalDirect.h"24#endif // ANGLE_ENABLE_METAL2526#ifdef ANGLE_ENABLE_METAL_SPIRV27# include "compiler/translator/TranslatorMetal.h"28#endif // ANGLE_ENABLE_METAL_SPIRV2930#include "compiler/translator/util.h"3132namespace sh33{3435//36// This function must be provided to create the actual37// compile object used by higher level code. It returns38// a subclass of TCompiler.39//40TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)41{42#ifdef ANGLE_ENABLE_ESSL43if (IsOutputESSL(output))44{45return new TranslatorESSL(type, spec);46}47#endif // ANGLE_ENABLE_ESSL4849#ifdef ANGLE_ENABLE_GLSL50if (IsOutputGLSL(output))51{52return new TranslatorGLSL(type, spec, output);53}54#endif // ANGLE_ENABLE_GLSL5556#ifdef ANGLE_ENABLE_HLSL57if (IsOutputHLSL(output))58{59return new TranslatorHLSL(type, spec, output);60}61#endif // ANGLE_ENABLE_HLSL6263#ifdef ANGLE_ENABLE_VULKAN64if (IsOutputVulkan(output))65{66return new TranslatorVulkan(type, spec);67}68#endif // ANGLE_ENABLE_VULKAN6970#ifdef ANGLE_ENABLE_METAL_SPIRV71if (IsOutputMetal(output))72{73return new TranslatorMetal(type, spec);74}75#endif76#ifdef ANGLE_ENABLE_METAL77if (IsOutputMetalDirect(output))78{79return new TranslatorMetalDirect(type, spec, output);80}81#endif // ANGLE_ENABLE_METAL8283// Unsupported compiler or unknown format. Return nullptr per the sh::ConstructCompiler API.84return nullptr;85}8687//88// Delete the compiler made by ConstructCompiler89//90void DeleteCompiler(TCompiler *compiler)91{92SafeDelete(compiler);93}9495} // namespace sh969798