Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/src/libANGLE/Compiler.h
1693 views
1
//
2
// Copyright 2014 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
// Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler
8
// that a GL context holds.
9
10
#ifndef LIBANGLE_COMPILER_H_
11
#define LIBANGLE_COMPILER_H_
12
13
#include <vector>
14
15
#include "GLSLANG/ShaderLang.h"
16
#include "common/PackedEnums.h"
17
#include "libANGLE/Error.h"
18
#include "libANGLE/RefCountObject.h"
19
20
namespace rx
21
{
22
class CompilerImpl;
23
class GLImplFactory;
24
} // namespace rx
25
26
namespace gl
27
{
28
class ShCompilerInstance;
29
class State;
30
31
class Compiler final : public RefCountObjectNoID
32
{
33
public:
34
Compiler(rx::GLImplFactory *implFactory, const State &data, egl::Display *display);
35
36
void onDestroy(const Context *context) override;
37
38
ShCompilerInstance getInstance(ShaderType shaderType);
39
void putInstance(ShCompilerInstance &&instance);
40
ShShaderOutput getShaderOutputType() const { return mOutputType; }
41
42
private:
43
~Compiler() override;
44
std::unique_ptr<rx::CompilerImpl> mImplementation;
45
ShShaderSpec mSpec;
46
ShShaderOutput mOutputType;
47
ShBuiltInResources mResources;
48
ShaderMap<std::vector<ShCompilerInstance>> mPools;
49
};
50
51
class ShCompilerInstance final : public angle::NonCopyable
52
{
53
public:
54
ShCompilerInstance();
55
ShCompilerInstance(ShHandle handle, ShShaderOutput outputType, ShaderType shaderType);
56
~ShCompilerInstance();
57
void destroy();
58
59
ShCompilerInstance(ShCompilerInstance &&other);
60
ShCompilerInstance &operator=(ShCompilerInstance &&other);
61
62
ShHandle getHandle();
63
ShaderType getShaderType() const;
64
const std::string &getBuiltinResourcesString();
65
ShShaderOutput getShaderOutputType() const;
66
67
private:
68
ShHandle mHandle;
69
ShShaderOutput mOutputType;
70
ShaderType mShaderType;
71
};
72
73
} // namespace gl
74
75
#endif // LIBANGLE_COMPILER_H_
76
77