Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/src/compiler/translator/CodeGen.cpp
1693 views
1
//
2
// Copyright 2013 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
#ifdef ANGLE_ENABLE_ESSL
8
# include "compiler/translator/TranslatorESSL.h"
9
#endif // ANGLE_ENABLE_ESSL
10
11
#ifdef ANGLE_ENABLE_GLSL
12
# include "compiler/translator/TranslatorGLSL.h"
13
#endif // ANGLE_ENABLE_GLSL
14
15
#ifdef ANGLE_ENABLE_HLSL
16
# include "compiler/translator/TranslatorHLSL.h"
17
#endif // ANGLE_ENABLE_HLSL
18
19
#ifdef ANGLE_ENABLE_VULKAN
20
# include "compiler/translator/TranslatorVulkan.h"
21
#endif // ANGLE_ENABLE_VULKAN
22
23
#ifdef ANGLE_ENABLE_METAL
24
# include "compiler/translator/TranslatorMetalDirect.h"
25
#endif // ANGLE_ENABLE_METAL
26
27
#ifdef ANGLE_ENABLE_METAL_SPIRV
28
# include "compiler/translator/TranslatorMetal.h"
29
#endif // ANGLE_ENABLE_METAL_SPIRV
30
31
#include "compiler/translator/util.h"
32
33
namespace sh
34
{
35
36
//
37
// This function must be provided to create the actual
38
// compile object used by higher level code. It returns
39
// a subclass of TCompiler.
40
//
41
TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
42
{
43
#ifdef ANGLE_ENABLE_ESSL
44
if (IsOutputESSL(output))
45
{
46
return new TranslatorESSL(type, spec);
47
}
48
#endif // ANGLE_ENABLE_ESSL
49
50
#ifdef ANGLE_ENABLE_GLSL
51
if (IsOutputGLSL(output))
52
{
53
return new TranslatorGLSL(type, spec, output);
54
}
55
#endif // ANGLE_ENABLE_GLSL
56
57
#ifdef ANGLE_ENABLE_HLSL
58
if (IsOutputHLSL(output))
59
{
60
return new TranslatorHLSL(type, spec, output);
61
}
62
#endif // ANGLE_ENABLE_HLSL
63
64
#ifdef ANGLE_ENABLE_VULKAN
65
if (IsOutputVulkan(output))
66
{
67
return new TranslatorVulkan(type, spec);
68
}
69
#endif // ANGLE_ENABLE_VULKAN
70
71
#ifdef ANGLE_ENABLE_METAL_SPIRV
72
if (IsOutputMetal(output))
73
{
74
return new TranslatorMetal(type, spec);
75
}
76
#endif
77
#ifdef ANGLE_ENABLE_METAL
78
if (IsOutputMetalDirect(output))
79
{
80
return new TranslatorMetalDirect(type, spec, output);
81
}
82
#endif // ANGLE_ENABLE_METAL
83
84
// Unsupported compiler or unknown format. Return nullptr per the sh::ConstructCompiler API.
85
return nullptr;
86
}
87
88
//
89
// Delete the compiler made by ConstructCompiler
90
//
91
void DeleteCompiler(TCompiler *compiler)
92
{
93
SafeDelete(compiler);
94
}
95
96
} // namespace sh
97
98