From e1e4bf5659e5c3de8b7ac2907d76bffb5db372af Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 10 May 2022 10:47:51 +0900 Subject: [PATCH] [vulkan] Up the light limit to 768 For now, at least (I have some ideas to possibly reduce the numbers and also to avoid the need for actual limits). I've seen gmsp3v2 use over 500 lights at once (it has over 1300), and I spent too long figuring out that weird light behavior was due to the limit being hit and lights getting dropped (and even longer figuring out that more weird behavior was due to the lack of shadows and the world being too bright in the first place). --- include/QF/Vulkan/qf_lighting.h | 2 +- libs/video/renderer/vulkan/qfpipeline.plist | 16 ++++++++-------- libs/video/renderer/vulkan/shader/lighting.frag | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/QF/Vulkan/qf_lighting.h b/include/QF/Vulkan/qf_lighting.h index ef6a6bb24..9de79a94b 100644 --- a/include/QF/Vulkan/qf_lighting.h +++ b/include/QF/Vulkan/qf_lighting.h @@ -41,7 +41,7 @@ typedef struct qfv_lightmatset_s DARRAY_TYPE (mat4f_t) qfv_lightmatset_t; -#define MaxLights 256 +#define MaxLights 768 #define ST_NONE 0 // no shadows #define ST_PLANE 1 // single plane shadow map (small spotlight) diff --git a/libs/video/renderer/vulkan/qfpipeline.plist b/libs/video/renderer/vulkan/qfpipeline.plist index 33fef28d3..2ee0f5846 100644 --- a/libs/video/renderer/vulkan/qfpipeline.plist +++ b/libs/video/renderer/vulkan/qfpipeline.plist @@ -170,7 +170,7 @@ bindings = ( { type = combined_image_sampler; - descriptorCount = "$frames.size * size_t($properties.limits.maxSamplers)"; + descriptorCount = 768;//"$frames.size * size_t($properties.limits.maxSamplers)"; }, ); }; @@ -291,7 +291,7 @@ { binding = 0; descriptorType = combined_image_sampler; - descriptorCount = $properties.limits.maxSamplers; + descriptorCount = 768;//$properties.limits.maxSamplers; stageFlags = fragment; }, ); @@ -1035,12 +1035,12 @@ stage = fragment; name = main; module = $builtin/lighting.frag; - specializationInfo = { - mapEntries = ( - { size = 4; offset = 0; constantID = 0; }, - ); - data = "array(uint($properties.limits.maxSamplers))"; - }; + //specializationInfo = { + // mapEntries = ( + // { size = 4; offset = 0; constantID = 0; }, + // ); + // data = "array(uint($properties.limits.maxSamplers))"; + //}; }, ); layout = lighting_layout; diff --git a/libs/video/renderer/vulkan/shader/lighting.frag b/libs/video/renderer/vulkan/shader/lighting.frag index 41ee21629..4b8e516cf 100644 --- a/libs/video/renderer/vulkan/shader/lighting.frag +++ b/libs/video/renderer/vulkan/shader/lighting.frag @@ -29,7 +29,7 @@ struct LightData { #define ST_CASCADE (2 << 10) // cascaded shadow maps #define ST_CUBE (3 << 10) // cubemap (omni, large spotlight) -layout (constant_id = 0) const int MaxLights = 256; +layout (constant_id = 0) const int MaxLights = 768; layout (set = 2, binding = 0) uniform sampler2DArrayShadow shadowCascade[MaxLights]; layout (set = 2, binding = 0) uniform sampler2DShadow shadowPlane[MaxLights];