From b82b5384a0cf12dae579938095e78380434d4f80 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Aug 2021 12:52:21 +0200 Subject: [PATCH] - Backend update from Raze. * voc loader fix. * better prefix detection in Zip loader. * SDL Vulkan init. * disabling of shadowmap management when the feature is off. --- src/common/audio/sound/i_sound.cpp | 4 +- src/common/filesystem/file_zip.cpp | 43 +++++++++++-------- src/common/platform/posix/sdl/sdlglvideo.cpp | 4 +- .../hwrenderer/data/hw_shadowmap.cpp | 4 +- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/common/audio/sound/i_sound.cpp b/src/common/audio/sound/i_sound.cpp index 6855ce51b..5f828d985 100644 --- a/src/common/audio/sound/i_sound.cpp +++ b/src/common/audio/sound/i_sound.cpp @@ -367,7 +367,7 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length) i += 4; if (i + blocksize > length) { - okay = false; + //okay = false; break; } @@ -450,7 +450,7 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length) } // Second pass to write the data - if (okay) + if (okay && len > 0) { data = new uint8_t[len]; i = 26; diff --git a/src/common/filesystem/file_zip.cpp b/src/common/filesystem/file_zip.cpp index f33b60ba4..0096507bf 100644 --- a/src/common/filesystem/file_zip.cpp +++ b/src/common/filesystem/file_zip.cpp @@ -208,8 +208,9 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter) char *dirptr = (char*)directory; FZipLump *lump_p = Lumps; - FString name0; + FString name0, name1; bool foundspeciallump = false; + bool foundprefix = false; // Check if all files have the same prefix so that this can be stripped out. // This will only be done if there is either a MAPINFO, ZMAPINFO or GAMEINFO lump in the subdirectory, denoting a ZDoom mod. @@ -234,31 +235,39 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter) name.ToLower(); if (name.IndexOf("__macosx") == 0) - continue; // skip Apple garbage. At this stage only the root folder matters, - if (i == 0) + continue; // skip Apple garbage. At this stage only the root folder matters. + if (!foundprefix) { // check for special names, if one of these gets found this must be treated as a normal zip. bool isspecial = name.IndexOf("/") < 0 || (filter && filter->reservedFolders.Find(name) < filter->reservedFolders.Size()); if (isspecial) break; name0 = name.Left(name.LastIndexOf("/")+1); + name1 = name.Left(name.IndexOf("/") + 1); + foundprefix = true; } - else + + if (name.IndexOf(name0) != 0) { - if (name.IndexOf(name0) != 0) + if (name1.IsNotEmpty()) { - name0 = ""; - break; + name0 = name1; + if (name.IndexOf(name0) != 0) + { + name0 = ""; + } } - else if (!foundspeciallump && filter) - { - // at least one of the more common definition lumps must be present. - for (auto &p : filter->requiredPrefixes) - { - if (name.IndexOf(name0 + p) == 0 || name.LastIndexOf(p) == name.Len() - strlen(p)) - { - foundspeciallump = true; - break; - } + if (name0.IsEmpty()) + break; + } + if (!foundspeciallump && filter) + { + // at least one of the more common definition lumps must be present. + for (auto &p : filter->requiredPrefixes) + { + if (name.IndexOf(name0 + p) == 0 || name.LastIndexOf(p) == name.Len() - strlen(p)) + { + foundspeciallump = true; + break; } } } diff --git a/src/common/platform/posix/sdl/sdlglvideo.cpp b/src/common/platform/posix/sdl/sdlglvideo.cpp index 43bd99a64..4f7dc6e88 100644 --- a/src/common/platform/posix/sdl/sdlglvideo.cpp +++ b/src/common/platform/posix/sdl/sdlglvideo.cpp @@ -115,8 +115,6 @@ CCMD(vid_list_sdl_render_drivers) namespace Priv { - static const uint32_t VulkanWindowFlag = SDL_WINDOW_VULKAN; - SDL_Window *window; bool vulkanEnabled; bool softpolyEnabled; @@ -408,7 +406,7 @@ SDLVideo::SDLVideo () if (Priv::vulkanEnabled) { - Priv::CreateWindow(Priv::VulkanWindowFlag | SDL_WINDOW_HIDDEN); + Priv::CreateWindow(SDL_WINDOW_VULKAN | SDL_WINDOW_HIDDEN | (vid_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)); if (Priv::window == nullptr) { diff --git a/src/common/rendering/hwrenderer/data/hw_shadowmap.cpp b/src/common/rendering/hwrenderer/data/hw_shadowmap.cpp index f3e37ed61..cb5630594 100644 --- a/src/common/rendering/hwrenderer/data/hw_shadowmap.cpp +++ b/src/common/rendering/hwrenderer/data/hw_shadowmap.cpp @@ -85,7 +85,7 @@ CUSTOM_CVAR(Int, gl_shadowmap_quality, 512, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) bool IShadowMap::ShadowTest(const DVector3 &lpos, const DVector3 &pos) { - if (mAABBTree) + if (mAABBTree && gl_light_shadowmap) return mAABBTree->RayTest(lpos, pos) >= 1.0f; else return true; @@ -98,7 +98,7 @@ bool IShadowMap::PerformUpdate() LightsProcessed = 0; LightsShadowmapped = 0; - if (CollectLights != nullptr) + if (gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER) && CollectLights != nullptr) { UpdateCycles.Clock(); UploadAABBTree();