diff --git a/src/main/java/net/vulkanmod/vulkan/shader/descriptor/DescriptorManager.java b/src/main/java/net/vulkanmod/vulkan/shader/descriptor/DescriptorManager.java index a64e22a90..c8c52049d 100644 --- a/src/main/java/net/vulkanmod/vulkan/shader/descriptor/DescriptorManager.java +++ b/src/main/java/net/vulkanmod/vulkan/shader/descriptor/DescriptorManager.java @@ -50,6 +50,7 @@ public class DescriptorManager { Initializer.LOGGER.info("Setting Rendering Mode: Bindless mode: {}", semiBindless ? "Semi-Bindless" : "Fully-Bindless"); Initializer.LOGGER.info("Max Per Stage Samplers: {}", maxPerStageSamplers); + Initializer.LOGGER.info("Sets: {}", semiBindless ? MAX_SETS : TOTAL_SETS); try (MemoryStack stack = stackPush()) { @@ -148,11 +149,12 @@ public static long createGlobalDescriptorPool() { try(MemoryStack stack = stackPush()) { VkDescriptorPoolSize.Buffer poolSizes = VkDescriptorPoolSize.calloc(3, stack); - + //4 Sets on Bindless, 64 on semi-Bindless + final int maxSets = (semiBindless ? TOTAL_SETS : MAX_SETS) * PER_SET_ALLOCS; VkDescriptorPoolSize uniformBufferPoolSize = poolSizes.get(0); uniformBufferPoolSize.type(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); - uniformBufferPoolSize.descriptorCount(1); + uniformBufferPoolSize.descriptorCount(maxSets); VkDescriptorPoolSize uniformBufferPoolSize2 = poolSizes.get(1); uniformBufferPoolSize2.type(VK13.VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK); @@ -160,17 +162,17 @@ public static long createGlobalDescriptorPool() VkDescriptorPoolSize textureSamplerPoolSize = poolSizes.get(2); textureSamplerPoolSize.type(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); - textureSamplerPoolSize.descriptorCount(MAX_POOL_SAMPLERS); + textureSamplerPoolSize.descriptorCount(semiBindless ? maxPerStageSamplers * PER_SET_ALLOCS * maxSets : MAX_POOL_SAMPLERS); VkDescriptorPoolInlineUniformBlockCreateInfo inlineUniformBlockCreateInfo = VkDescriptorPoolInlineUniformBlockCreateInfo.calloc(stack) .sType$Default() - .maxInlineUniformBlockBindings(1); + .maxInlineUniformBlockBindings(maxSets); VkDescriptorPoolCreateInfo poolInfo = VkDescriptorPoolCreateInfo.calloc(stack); poolInfo.sType(VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO); poolInfo.pNext(inlineUniformBlockCreateInfo); poolInfo.pPoolSizes(poolSizes); - poolInfo.maxSets(MAX_SETS * (semiBindless ? TOTAL_SETS : PER_SET_ALLOCS)); //The real descriptor pool size is pPoolSizes * maxSets: not the individual descriptorPool sizes + poolInfo.maxSets(maxSets); LongBuffer pDescriptorPool = stack.mallocLong(1); diff --git a/src/main/java/net/vulkanmod/vulkan/util/VkResult.java b/src/main/java/net/vulkanmod/vulkan/util/VkResult.java index 79ff67df6..bb77a1600 100644 --- a/src/main/java/net/vulkanmod/vulkan/util/VkResult.java +++ b/src/main/java/net/vulkanmod/vulkan/util/VkResult.java @@ -1,5 +1,7 @@ package net.vulkanmod.vulkan.util; +import org.lwjgl.vulkan.VK11; + public class VkResult { public static final int VK_SUCCESS = 0; public static final int VK_NOT_READY = 1; @@ -41,6 +43,7 @@ public static String decode(int result) { case VK_ERROR_TOO_MANY_OBJECTS -> "VK_ERROR_TOO_MANY_OBJECTS"; case VK_ERROR_FORMAT_NOT_SUPPORTED -> "VK_ERROR_FORMAT_NOT_SUPPORTED"; case VK_ERROR_FRAGMENTED_POOL -> "VK_ERROR_FRAGMENTED_POOL"; + case VK11.VK_ERROR_OUT_OF_POOL_MEMORY -> "VK_ERROR_OUT_OF_POOL_MEMORY"; case VK_ERROR_UNKNOWN -> "VK_ERROR_UNKNOWN"; default -> Integer.toString(result);