diff --git a/src/rendering/vulkan/renderer/vk_postprocess.cpp b/src/rendering/vulkan/renderer/vk_postprocess.cpp index 5c6ad966bb..7b4d054a32 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.cpp +++ b/src/rendering/vulkan/renderer/vk_postprocess.cpp @@ -363,7 +363,7 @@ void VkPostprocess::CompileEffectShaders() FString VkPostprocess::LoadShaderCode(const FString &lumpName, const FString &defines, int version) { - int lump = Wads.CheckNumForFullName(lumpName, 0); + int lump = Wads.CheckNumForFullName(lumpName); if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars()); FString code = Wads.ReadLump(lump).GetString().GetChars(); diff --git a/src/rendering/vulkan/shaders/vk_shader.cpp b/src/rendering/vulkan/shaders/vk_shader.cpp index ddb3aab00e..67e5f82490 100644 --- a/src/rendering/vulkan/shaders/vk_shader.cpp +++ b/src/rendering/vulkan/shaders/vk_shader.cpp @@ -217,7 +217,7 @@ std::unique_ptr VkShaderManager::LoadVertShader(FString shadername FString code = GetTargetGlslVersion(); code << defines << shaderBindings; code << "#line 1\n"; - code << LoadShaderLump(vert_lump).GetChars() << "\n"; + code << LoadPrivateShaderLump(vert_lump).GetChars() << "\n"; ShaderBuilder builder; builder.setVertexShader(code); @@ -233,19 +233,19 @@ std::unique_ptr VkShaderManager::LoadFragShader(FString shadername if (gbufferpass) code << "#define GBUFFER_PASS\n"; code << "\n#line 1\n"; - code << LoadShaderLump(frag_lump).GetChars() << "\n"; + code << LoadPrivateShaderLump(frag_lump).GetChars() << "\n"; if (material_lump) { if (material_lump[0] != '#') { - FString pp_code = LoadShaderLump(material_lump); + FString pp_code = LoadPublicShaderLump(material_lump); if (pp_code.IndexOf("ProcessMaterial") < 0) { // this looks like an old custom hardware shader. // add ProcessMaterial function that calls the older ProcessTexel function - code << "\n" << LoadShaderLump("shaders/glsl/func_defaultmat.fp").GetChars() << "\n"; + code << "\n" << LoadPrivateShaderLump("shaders/glsl/func_defaultmat.fp").GetChars() << "\n"; if (pp_code.IndexOf("ProcessTexel") < 0) { @@ -269,7 +269,7 @@ std::unique_ptr VkShaderManager::LoadFragShader(FString shadername if (pp_code.IndexOf("ProcessLight") < 0) { - code << "\n" << LoadShaderLump("shaders/glsl/func_defaultlight.fp").GetChars() << "\n"; + code << "\n" << LoadPrivateShaderLump("shaders/glsl/func_defaultlight.fp").GetChars() << "\n"; } } else @@ -282,7 +282,7 @@ std::unique_ptr VkShaderManager::LoadFragShader(FString shadername if (light_lump) { code << "\n#line 1\n"; - code << LoadShaderLump(light_lump).GetChars(); + code << LoadPrivateShaderLump(light_lump).GetChars(); } ShaderBuilder builder; @@ -295,7 +295,15 @@ FString VkShaderManager::GetTargetGlslVersion() return "#version 450 core\n"; } -FString VkShaderManager::LoadShaderLump(const char *lumpname) +FString VkShaderManager::LoadPublicShaderLump(const char *lumpname) +{ + int lump = Wads.CheckNumForFullName(lumpname); + if (lump == -1) I_Error("Unable to load '%s'", lumpname); + FMemLump data = Wads.ReadLump(lump); + return data.GetString(); +} + +FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname) { int lump = Wads.CheckNumForFullName(lumpname, 0); if (lump == -1) I_Error("Unable to load '%s'", lumpname); diff --git a/src/rendering/vulkan/shaders/vk_shader.h b/src/rendering/vulkan/shaders/vk_shader.h index 5cff6fb2c9..5dd636e126 100644 --- a/src/rendering/vulkan/shaders/vk_shader.h +++ b/src/rendering/vulkan/shaders/vk_shader.h @@ -95,7 +95,8 @@ private: std::unique_ptr LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char *light_lump, const char *defines, bool alphatest, bool gbufferpass); FString GetTargetGlslVersion(); - FString LoadShaderLump(const char *lumpname); + FString LoadPublicShaderLump(const char *lumpname); + FString LoadPrivateShaderLump(const char *lumpname); VulkanDevice *device;