[vulkan] Limit shadow textures to 32

This is the minimum maximum count for sampled images, and with layered
shadow maps (with a minimum of 2048 layers supported), that's really way
more than enough.
This commit is contained in:
Bill Currie 2022-11-25 13:35:07 +09:00
parent edc1326736
commit 87f99f9081
4 changed files with 4 additions and 11 deletions

View file

@ -58,7 +58,7 @@ typedef struct qfv_light_buffer_s {
#define LIGHTING_BUFFER_INFOS 1
#define LIGHTING_ATTACH_INFOS 5
#define LIGHTING_SHADOW_INFOS MaxLights
#define LIGHTING_SHADOW_INFOS 32
#define LIGHTING_DESCRIPTORS (LIGHTING_BUFFER_INFOS + LIGHTING_ATTACH_INFOS + 1)
typedef struct lightingframe_s {

View file

@ -47,11 +47,6 @@ typedef struct qfv_matrix_buffer_s {
vec4f_t pad2[3];
} qfv_matrix_buffer_t;
#define LIGHTING_BUFFER_INFOS 1
#define LIGHTING_ATTACH_INFOS 5
#define LIGHTING_SHADOW_INFOS MaxLights
#define LIGHTING_DESCRIPTORS (LIGHTING_BUFFER_INFOS + LIGHTING_ATTACH_INFOS + 1)
typedef struct matrixframe_s {
//VkCommandBuffer cmd;
VkBuffer buffer;

View file

@ -229,7 +229,7 @@
bindings = (
{
type = combined_image_sampler;
descriptorCount = 768;//"$frames.size * size_t($properties.limits.maxSamplers)";
descriptorCount = "$frames.size * size_t(32)";
},
);
};
@ -378,7 +378,7 @@
{
binding = 0;
descriptorType = combined_image_sampler;
descriptorCount = 768;//$properties.limits.maxSamplers;
descriptorCount = 32;
stageFlags = fragment;
},
);

View file

@ -448,9 +448,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
lframe->shadowWrite = base_image_write;
lframe->shadowWrite.dstSet = shadow_set->a[i];
lframe->shadowWrite.dstBinding = 0;
lframe->shadowWrite.descriptorCount
= min (MaxLights,
device->physDev->properties->limits.maxPerStageDescriptorSamplers);
lframe->shadowWrite.descriptorCount = LIGHTING_SHADOW_INFOS;
lframe->shadowWrite.pImageInfo = lframe->shadowInfo;
}
free (shadow_set);