From 7506a660081775183e0f9af534f2a7899618b43b Mon Sep 17 00:00:00 2001 From: Jayou <906832263@qq.com> Date: Thu, 15 Oct 2020 14:58:31 +0800 Subject: [PATCH] fix bug when use .dll with diff env (e.g. debug/release). --- glsl2spv.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/glsl2spv.cpp b/glsl2spv.cpp index 93b3e04..2cd7263 100644 --- a/glsl2spv.cpp +++ b/glsl2spv.cpp @@ -215,14 +215,17 @@ extern "C" enum class ShaderType { - GLSL, - HLSL - }; + GLSL=0, + HLSL, + + MAX=0xff + };//enum class ShaderType struct CompileInfo { ShaderType shader_type = ShaderType::GLSL; - std::vector include_dirs; + uint32_t includes_count; + const char** includes; }; enum class VertexAttribBaseType @@ -346,9 +349,9 @@ extern "C" Init(); } - SPVData(const char* log) + SPVData(const char* log) : SPVData(log, log) { - SPVData(log, log); + } SPVData(const std::vector &spirv) @@ -497,8 +500,10 @@ extern "C" shader.setEntryPoint("main"); } - for (auto& dir:compile_info->include_dirs) - includer.pushExternalLocalDirectory(dir); + for (uint32_t i = 0; i < compile_info->includes_count; i++) + { + includer.pushExternalLocalDirectory(compile_info->includes[i]); + } } shaderStrings[0] = shader_source;