From c8af9c3b0e69fe4aab6dc4b3462e180a8560c750 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Fri, 6 Nov 2020 17:46:29 +0100 Subject: [PATCH] Fixed savegame size problem with some user maps --- neo/renderer/Vulkan/RenderBackend_VK.cpp | 4 +- neo/renderer/Vulkan/RenderProgs_VK.cpp | 137 ++++++++++++++++++++--- neo/sys/sys_savegame.h | 5 +- 3 files changed, 128 insertions(+), 18 deletions(-) diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index b02d49a5..34f16306 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -121,8 +121,8 @@ const char* VK_ErrorToString( VkResult result ) ID_VK_ERROR_STRING( VK_ERROR_INCOMPATIBLE_DISPLAY_KHR ); ID_VK_ERROR_STRING( VK_ERROR_VALIDATION_FAILED_EXT ); ID_VK_ERROR_STRING( VK_ERROR_INVALID_SHADER_NV ); - ID_VK_ERROR_STRING( VK_RESULT_BEGIN_RANGE ); - ID_VK_ERROR_STRING( VK_RESULT_RANGE_SIZE ); + //ID_VK_ERROR_STRING( VK_RESULT_BEGIN_RANGE ); + //ID_VK_ERROR_STRING( VK_RESULT_RANGE_SIZE ); default: return "UNKNOWN"; }; diff --git a/neo/renderer/Vulkan/RenderProgs_VK.cpp b/neo/renderer/Vulkan/RenderProgs_VK.cpp index 79602cb3..61a54e02 100644 --- a/neo/renderer/Vulkan/RenderProgs_VK.cpp +++ b/neo/renderer/Vulkan/RenderProgs_VK.cpp @@ -395,9 +395,13 @@ static int CompileGLSLtoSPIRV( const char* filename, const idStr& dataGLSL, cons } #else -#include -#include -#include +//#include +//#include +//#include + +#include "../../extern/glslang/glslang/Public/ShaderLang.h" +#include "../../extern/glslang/glslang/Include/ResourceLimits.h" +#include "../../extern/glslang/SPIRV/GlslangToSpv.h" //#include @@ -410,7 +414,7 @@ namespace glslang #if 0 // RB: if you want to use this then you need to compile GLSLANG with ENABLE_GLSLANG_BINARIES ON extern const TBuiltInResource DefaultTBuiltInResource; -#else +//#else // RB: see RBDOOM-3-BFG\neo\extern\glslang\StandAlone\ResourceLimits.cpp const TBuiltInResource DefaultTBuiltInResource = @@ -509,15 +513,15 @@ const TBuiltInResource DefaultTBuiltInResource = /* .maxMeshViewCountNV = */ 4, /* .limits = */ { - /* .nonInductiveForLoops = */ 1, - /* .whileLoops = */ 1, - /* .doWhileLoops = */ 1, - /* .generalUniformIndexing = */ 1, - /* .generalAttributeMatrixVectorIndexing = */ 1, - /* .generalVaryingIndexing = */ 1, - /* .generalSamplerIndexing = */ 1, - /* .generalVariableIndexing = */ 1, - /* .generalConstantMatrixVectorIndexing = */ 1, + /* .nonInductiveForLoops = */ false, + /* .whileLoops = */ false, + /* .doWhileLoops = */ false, + /* .generalUniformIndexing = */ false, + /* .generalAttributeMatrixVectorIndexing = */ false, + /* .generalVaryingIndexing = */ false, + /* .generalSamplerIndexing = */ false, + /* .generalVariableIndexing = */ false, + /* .generalConstantMatrixVectorIndexing = */ false, } }; #endif @@ -560,8 +564,111 @@ static int CompileGLSLtoSPIRV( const char* filename, const idStr& dataGLSL, cons shader.setEnvClient( glslang::EShClientVulkan, vulkanClientVersion ); shader.setEnvTarget( glslang::EShTargetSpv, targetVersion ); - TBuiltInResource resources; - resources = glslang::DefaultTBuiltInResource; + static TBuiltInResource resources; + resources.maxLights = 32; + resources.maxClipPlanes = 6; + resources.maxTextureUnits = 32; + resources.maxTextureCoords = 32; + resources.maxVertexAttribs = 64; + resources.maxVertexUniformComponents = 4096; + resources.maxVaryingFloats = 64; + resources.maxVertexTextureImageUnits = 32; + resources.maxCombinedTextureImageUnits = 80; + resources.maxTextureImageUnits = 32; + resources.maxFragmentUniformComponents = 4096; + resources.maxDrawBuffers = 32; + resources.maxVertexUniformVectors = 128; + resources.maxVaryingVectors = 8; + resources.maxFragmentUniformVectors = 16; + resources.maxVertexOutputVectors = 16; + resources.maxFragmentInputVectors = 15; + resources.minProgramTexelOffset = -8; + resources.maxProgramTexelOffset = 7; + resources.maxClipDistances = 8; + resources.maxComputeWorkGroupCountX = 65535; + resources.maxComputeWorkGroupCountY = 65535; + resources.maxComputeWorkGroupCountZ = 65535; + resources.maxComputeWorkGroupSizeX = 1024; + resources.maxComputeWorkGroupSizeY = 1024; + resources.maxComputeWorkGroupSizeZ = 64; + resources.maxComputeUniformComponents = 1024; + resources.maxComputeTextureImageUnits = 16; + resources.maxComputeImageUniforms = 8; + resources.maxComputeAtomicCounters = 8; + resources.maxComputeAtomicCounterBuffers = 1; + resources.maxVaryingComponents = 60; + resources.maxVertexOutputComponents = 64; + resources.maxGeometryInputComponents = 64; + resources.maxGeometryOutputComponents = 128; + resources.maxFragmentInputComponents = 128; + resources.maxImageUnits = 8; + resources.maxCombinedImageUnitsAndFragmentOutputs = 8; + resources.maxCombinedShaderOutputResources = 8; + resources.maxImageSamples = 0; + resources.maxVertexImageUniforms = 0; + resources.maxTessControlImageUniforms = 0; + resources.maxTessEvaluationImageUniforms = 0; + resources.maxGeometryImageUniforms = 0; + resources.maxFragmentImageUniforms = 8; + resources.maxCombinedImageUniforms = 8; + resources.maxGeometryTextureImageUnits = 16; + resources.maxGeometryOutputVertices = 256; + resources.maxGeometryTotalOutputComponents = 1024; + resources.maxGeometryUniformComponents = 1024; + resources.maxGeometryVaryingComponents = 64; + resources.maxTessControlInputComponents = 128; + resources.maxTessControlOutputComponents = 128; + resources.maxTessControlTextureImageUnits = 16; + resources.maxTessControlUniformComponents = 1024; + resources.maxTessControlTotalOutputComponents = 4096; + resources.maxTessEvaluationInputComponents = 128; + resources.maxTessEvaluationOutputComponents = 128; + resources.maxTessEvaluationTextureImageUnits = 16; + resources.maxTessEvaluationUniformComponents = 1024; + resources.maxTessPatchComponents = 120; + resources.maxPatchVertices = 32; + resources.maxTessGenLevel = 64; + resources.maxViewports = 16; + resources.maxVertexAtomicCounters = 0; + resources.maxTessControlAtomicCounters = 0; + resources.maxTessEvaluationAtomicCounters = 0; + resources.maxGeometryAtomicCounters = 0; + resources.maxFragmentAtomicCounters = 8; + resources.maxCombinedAtomicCounters = 8; + resources.maxAtomicCounterBindings = 1; + resources.maxVertexAtomicCounterBuffers = 0; + resources.maxTessControlAtomicCounterBuffers = 0; + resources.maxTessEvaluationAtomicCounterBuffers = 0; + resources.maxGeometryAtomicCounterBuffers = 0; + resources.maxFragmentAtomicCounterBuffers = 1; + resources.maxCombinedAtomicCounterBuffers = 1; + resources.maxAtomicCounterBufferSize = 16384; + resources.maxTransformFeedbackBuffers = 4; + resources.maxTransformFeedbackInterleavedComponents = 64; + resources.maxCullDistances = 8; + resources.maxCombinedClipAndCullDistances = 8; + resources.maxSamples = 4; + resources.maxMeshOutputVerticesNV = 256; + resources.maxMeshOutputPrimitivesNV = 512; + resources.maxMeshWorkGroupSizeX_NV = 32; + resources.maxMeshWorkGroupSizeY_NV = 1; + resources.maxMeshWorkGroupSizeZ_NV = 1; + resources.maxTaskWorkGroupSizeX_NV = 32; + resources.maxTaskWorkGroupSizeY_NV = 1; + resources.maxTaskWorkGroupSizeZ_NV = 1; + resources.maxMeshViewCountNV = 4; + + resources.limits.nonInductiveForLoops = false; + resources.limits.whileLoops = false; + resources.limits.doWhileLoops = false; + resources.limits.generalUniformIndexing = false; + resources.limits.generalAttributeMatrixVectorIndexing = false; + resources.limits.generalVaryingIndexing = false; + resources.limits.generalSamplerIndexing = false; + resources.limits.generalVariableIndexing = false; + resources.limits.generalConstantMatrixVectorIndexing = false; + + //resources = glslang::DefaultTBuiltInResource; EShMessages messages = ( EShMessages )( EShMsgSpvRules | EShMsgVulkanRules ); const int defaultVersion = 100; diff --git a/neo/sys/sys_savegame.h b/neo/sys/sys_savegame.h index 3a0d786c..8758efbd 100644 --- a/neo/sys/sys_savegame.h +++ b/neo/sys/sys_savegame.h @@ -41,8 +41,11 @@ If you have questions concerning this license or the applicable additional terms #define DEFINE_CLASS( x ) virtual const char * Name() const { return #x; } #define MAX_SAVEGAMES 16 #define MAX_FILES_WITHIN_SAVEGAME 10 + #define MIN_SAVEGAME_SIZE_BYTES ( 4 * 1024 * 1024 ) -#define MAX_SAVEGAME_STRING_TABLE_SIZE 400 * 1024 // 400 kB max string table size + +// RB: doubled this for DoomSpartan360 mods +#define MAX_SAVEGAME_STRING_TABLE_SIZE ( 400 * 1024 * 2 ) // 400 kB max string table size #define MAX_FILENAME_LENGTH 255