summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/glslang-module.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/vulkan/glslang-module.h')
-rw-r--r--tools/gfx/vulkan/glslang-module.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/glslang-module.h b/tools/gfx/vulkan/glslang-module.h
new file mode 100644
index 000000000..cda903577
--- /dev/null
+++ b/tools/gfx/vulkan/glslang-module.h
@@ -0,0 +1,36 @@
+// glslang-module.h
+#pragma once
+
+#include "core/slang-list.h"
+#include "external/spirv-tools/include/spirv-tools/linker.hpp"
+#include "slang-com-helper.h"
+#include "slang-com-ptr.h"
+#include "slang-glslang/slang-glslang.h"
+#include "slang.h"
+
+namespace gfx
+{
+
+struct GlslangModule
+{
+ /// true if has been initialized
+ SLANG_FORCE_INLINE bool isInitialized() const { return m_module != nullptr; }
+
+ /// Initialize
+ Slang::Result init();
+
+ /// Destroy
+ void destroy();
+
+ /// Dtor
+ ~GlslangModule() { destroy(); }
+
+ Slang::ComPtr<ISlangBlob> linkSPIRV(Slang::List<Slang::ComPtr<ISlangBlob>> spirvModules);
+
+protected:
+ void* m_module = nullptr;
+
+ glslang_LinkSPIRVFunc m_linkSPIRVFunc = nullptr;
+};
+
+} // namespace gfx