- refactored all places which treated FileData as zero terminated.

This commit is contained in:
Christoph Oelckers 2023-08-20 01:49:22 +02:00
commit 2c2bf0265f
19 changed files with 63 additions and 47 deletions

View file

@ -26,6 +26,7 @@
#include "zvulkan/vulkanbuilders.h"
#include "vulkan/system/vk_commandbuffer.h"
#include "filesystem.h"
#include "cmdlib.h"
VkPPShader::VkPPShader(VulkanRenderDevice* fb, PPShader *shader) : fb(fb)
{
@ -66,7 +67,8 @@ FString VkPPShader::LoadShaderCode(const FString &lumpName, const FString &defin
{
int lump = fileSystem.CheckNumForFullName(lumpName);
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars());
FString code = fileSystem.ReadFile(lump).GetString();
auto sp = fileSystem.ReadFile(lump);
FString code = GetStringFromLump(lump);
FString patchedCode;
patchedCode.AppendFormat("#version %d\n", 450);

View file

@ -466,8 +466,7 @@ FString VkShaderManager::LoadPublicShaderLump(const char *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();
return GetStringFromLump(lump);
}
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
@ -475,7 +474,7 @@ FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
FileData data = fileSystem.ReadFile(lump);
return data.GetString();
return GetStringFromLump(lump);
}
VkPPShader* VkShaderManager::GetVkShader(PPShader* shader)