DDNet documentation
Loading...
Searching...
No Matches
glsl_shader_compiler.h
Go to the documentation of this file.
1#ifndef ENGINE_CLIENT_BACKEND_GLSL_SHADER_COMPILER_H
2#define ENGINE_CLIENT_BACKEND_GLSL_SHADER_COMPILER_H
3
4#include <string>
5#include <vector>
6
8{
9 friend class CGLSL;
10
11public:
12 enum class EShaderType
13 {
14 VERTEX,
15 FRAGMENT,
16 };
17
19 {
20 TEXTURE_2D,
21 TEXTURE_3D,
22 TEXTURE_2D_ARRAY,
23 };
24
25 CGLSLCompiler(int OpenGLVersionMajor, int OpenGLVersionMinor, int OpenGLVersionPatch, bool IsOpenGLES, float TextureLODBias);
26 void SetHasTextureArray(bool TextureArray) { m_HasTextureArray = TextureArray; }
27 void SetTextureReplaceType(ETextureReplaceType TextureReplaceType) { m_TextureReplaceType = TextureReplaceType; }
28
29 void AddDefine(const char *pDefineName, const char *pDefineValue);
30 void ClearDefines();
31
32 void ParseLine(std::string &Line, const char *pReadLine, EShaderType Type) const;
33
34private:
35 void ParseLineOldOpenGL(std::string &Line, const char *pReadLine, EShaderType Type) const;
36 void ParseLineGLES(std::string &Line, const char *pReadLine) const;
37
38 class CDefine
39 {
40 public:
41 CDefine(const char *pDefineName, const char *pDefineValue)
42 {
43 m_DefineName = pDefineName;
44 m_DefineValue = pDefineValue;
45 }
46 std::string m_DefineName;
47 std::string m_DefineValue;
48 };
49
50 std::vector<CDefine> m_vDefines;
51
55
57
59
62};
63
64#endif
CDefine(const char *pDefineName, const char *pDefineValue)
Definition glsl_shader_compiler.h:41
std::string m_DefineValue
Definition glsl_shader_compiler.h:47
std::string m_DefineName
Definition glsl_shader_compiler.h:46
bool m_IsOpenGLES
Definition glsl_shader_compiler.h:56
ETextureReplaceType
Definition glsl_shader_compiler.h:19
float m_TextureLODBias
Definition glsl_shader_compiler.h:58
int m_OpenGLVersionMajor
Definition glsl_shader_compiler.h:52
int m_OpenGLVersionPatch
Definition glsl_shader_compiler.h:54
void ParseLineGLES(std::string &Line, const char *pReadLine) const
Definition glsl_shader_compiler.cpp:163
bool m_HasTextureArray
Definition glsl_shader_compiler.h:60
void ClearDefines()
Definition glsl_shader_compiler.cpp:27
std::vector< CDefine > m_vDefines
Definition glsl_shader_compiler.h:50
void AddDefine(const char *pDefineName, const char *pDefineValue)
Definition glsl_shader_compiler.cpp:22
int m_OpenGLVersionMinor
Definition glsl_shader_compiler.h:53
CGLSLCompiler(int OpenGLVersionMajor, int OpenGLVersionMinor, int OpenGLVersionPatch, bool IsOpenGLES, float TextureLODBias)
Definition glsl_shader_compiler.cpp:8
void ParseLineOldOpenGL(std::string &Line, const char *pReadLine, EShaderType Type) const
Definition glsl_shader_compiler.cpp:51
void SetTextureReplaceType(ETextureReplaceType TextureReplaceType)
Definition glsl_shader_compiler.h:27
friend class CGLSL
Definition glsl_shader_compiler.h:9
void SetHasTextureArray(bool TextureArray)
Definition glsl_shader_compiler.h:26
void ParseLine(std::string &Line, const char *pReadLine, EShaderType Type) const
Definition glsl_shader_compiler.cpp:32
ETextureReplaceType m_TextureReplaceType
Definition glsl_shader_compiler.h:61
EShaderType
Definition glsl_shader_compiler.h:13