Tie max bindless texture slots to a CVar, as a workaround for some issues.

This commit is contained in:
Mari the Deer 2025-10-23 13:28:34 +02:00
commit 1949938752
2 changed files with 11 additions and 2 deletions

View file

@ -38,6 +38,12 @@
#include "hw_viewpointuniforms.h"
#include "v_2ddrawer.h"
#include "fcolormap.h"
#include "printf.h"
CUSTOM_CVAR(Int, vk_max_bindless_textures, 16536, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
VkDescriptorSetManager::VkDescriptorSetManager(VulkanRenderDevice* fb) : fb(fb)
{
@ -381,6 +387,9 @@ void VkDescriptorSetManager::CreateFixedPool()
void VkDescriptorSetManager::CreateBindlessSet()
{
// [MK] ensure this value remains unchanged until next restart
MaxBindlessTextures = vk_max_bindless_textures;
Bindless.Pool = DescriptorPoolBuilder()
.Flags(VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT)
.AddPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MaxBindlessTextures)
@ -435,7 +444,7 @@ int VkDescriptorSetManager::AllocBindlessSlot(int count)
else
{
if (Bindless.NextIndex + count > MaxBindlessTextures)
I_FatalError("Out of bindless texture slots!");
I_FatalError("Out of bindless texture slots. Try raising the value of vk_max_bindless_textures.");
int index = Bindless.NextIndex;
if (Bindless.AllocSizes.size() < index + count)
Bindless.AllocSizes.resize(index + count, 0);

View file

@ -73,7 +73,7 @@ private:
VulkanRenderDevice* fb = nullptr;
static const int MaxFixedSets = 100;
static const int MaxBindlessTextures = 16536;
int MaxBindlessTextures;
static const int FixedBindlessSlots = 3;
static const int MaxLightmaps = 128;