From 585f841f960a054542c04c203a3fb21a4006ec83 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 30 Aug 2021 22:33:53 +0200 Subject: [PATCH] - core shader override block, backported from GZDoom. --- source/common/objects/dobjgc.h | 16 ++++++++-------- source/common/rendering/gl/gl_shader.cpp | 3 ++- .../rendering/vulkan/shaders/vk_shader.cpp | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/common/objects/dobjgc.h b/source/common/objects/dobjgc.h index de187db6c..e3f8b85b1 100644 --- a/source/common/objects/dobjgc.h +++ b/source/common/objects/dobjgc.h @@ -175,7 +175,7 @@ public: TObjPtr() = default; TObjPtr(const TObjPtr &q) = default; - TObjPtr(T q) throw() + TObjPtr(T q) noexcept : pp(q) { } @@ -207,35 +207,35 @@ public: return *this; } - T Get() throw() + T Get() noexcept { return GC::ReadBarrier(pp); } - T ForceGet() throw() //for situations where the read barrier needs to be skipped. + T ForceGet() noexcept //for situations where the read barrier needs to be skipped. { return pp; } - operator T() throw() + operator T() noexcept { return GC::ReadBarrier(pp); } - T &operator*() + T &operator*() noexcept { T q = GC::ReadBarrier(pp); assert(q != NULL); return *q; } - T operator->() throw() + T operator->() noexcept { return GC::ReadBarrier(pp); } - bool operator!=(T u) throw() + bool operator!=(T u) noexcept { return GC::ReadBarrier(o) != u; } - bool operator==(T u) throw() + bool operator==(T u) noexcept { return GC::ReadBarrier(o) == u; } diff --git a/source/common/rendering/gl/gl_shader.cpp b/source/common/rendering/gl/gl_shader.cpp index 79612885c..5694b7ef0 100644 --- a/source/common/rendering/gl/gl_shader.cpp +++ b/source/common/rendering/gl/gl_shader.cpp @@ -404,7 +404,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * if (*proc_prog_lump != '#') { - int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump); + int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump, 0); // if it's a core shader, ignore overrides by user mods. + if (pp_lump == -1) pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump); if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump); FileData pp_data = fileSystem.ReadFile(pp_lump); diff --git a/source/common/rendering/vulkan/shaders/vk_shader.cpp b/source/common/rendering/vulkan/shaders/vk_shader.cpp index 84f7d3d5e..df065e1ce 100644 --- a/source/common/rendering/vulkan/shaders/vk_shader.cpp +++ b/source/common/rendering/vulkan/shaders/vk_shader.cpp @@ -386,7 +386,8 @@ FString VkShaderManager::GetTargetGlslVersion() FString VkShaderManager::LoadPublicShaderLump(const char *lumpname) { - int lump = fileSystem.CheckNumForFullName(lumpname); + int lump = fileSystem.CheckNumForFullName(lumpname, 0); + if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname); if (lump == -1) I_Error("Unable to load '%s'", lumpname); FileData data = fileSystem.ReadFile(lump); return data.GetString();