Added KRShaderManager::Includer

Now able to include shaders from other shaders with GL_GOOGLE_include_directive.
Added vulkan_test_include.glsl and included it from vulkan_test.vert.
This commit is contained in:
2022-08-15 19:48:59 -07:00
parent 7433d54c16
commit 2085908017
5 changed files with 61 additions and 2 deletions

View File

@@ -61,7 +61,24 @@ public:
unordered_map<std::string, unordered_map<std::string, KRShader*> >& getShaders();
class Includer : public glslang::TShader::Includer
{
public:
Includer() = delete;
Includer(KRContext* context);
IncludeResult* includeSystem(const char* headerName,
const char* includerName,
size_t inclusionDepth) override;
IncludeResult* includeLocal(const char* headerName,
const char* includerName,
size_t inclusionDepth) override;
void releaseInclude(IncludeResult* includeResult) override;
private:
KRContext* m_context;
};
private:
unordered_map<std::string, unordered_map<std::string, KRShader*> > m_shaders;
bool m_initializedGlslang;
Includer m_includer;
};