lwjglgamedev / vulkanbook

Online book which introduces the main concepts required to write graphics games or any other applications using Vulkan in Java by using the LWJGL library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Returning VK_ERROR_OUT_OF_POOL_MEMORY From Code Chapter 16

Wertuu opened this issue · comments

Hello,
I finished following along with Chapter 16, but I ended up crashing with a VK_ERROR_OUT_OF_POOL_MEMORY error. My first move was to go back through the guide in case I missed something, but I found nothing so I downloaded the code for each of the changed classes and overwrote mine. I still got the same error so I decided it must have been something I did wrong in an earlier chapter that only just now caught up to me, and that led me to downloading and overwriting the entire chapter. I still get the error by directly using the code given, and I'm now wondering if it's my machine or something. Any help would be greatly appreciated. Thank you.

It was working in chapter 15 just fine. This is my error trace
Exception in thread "main" java.lang.RuntimeException: Failed to create descriptor set: -1000069000 at main.java.org.vulkanb.eng.graph.vk.VulkanUtils.vkCheck(VulkanUtils.java:72) at main.java.org.vulkanb.eng.graph.vk.TextureDescriptorSet.<init>(TextureDescriptorSet.java:31) at main.java.org.vulkanb.eng.graph.shadows.ShadowRenderActivity.loadModels(ShadowRenderActivity.java:176) at main.java.org.vulkanb.eng.graph.Render.loadModels(Render.java:136) at main.java.org.vulkanb.Main.init(Main.java:67) at main.java.org.vulkanb.eng.Engine.<init>(Engine.java:23) at main.java.org.vulkanb.Main.main(Main.java:35)
I am using Windows 10 x64, an RX6600 for the GPU with the associated AMD Driver, and 16 GB of RAM.

Hi,

I will have a loot at it during the weekend. In any case, have you tried to increase the descriptor set limit for texture samplers, just to check if this is the case of the error? Check also if setting Nvidia GPU may help (AMD drivers are more strict about pool sizing).

I've just had a look and it should work. The number of tetxure descriptor sets should not exceed the pool size. Maybe you could try reducing the mextures configuration proprty to heck if we are consuming too much memory?

I attempted to change the materials/texture limit in eng.properties, but too low returns a buffer overload error, and anything higher will return the VK Pool error.

I tried to change the maxMaterials to 100 and it executed correctly. Which value you used? Where do you get the buffer overload error?

With maxMaterials at 32, I receive a buffer overflow error (misremembered the name, my bad). I realized that I have been receiving a warning in the trace during SwapChain creation, but it seems unrelated. Here it is though

2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ UNASSIGNED-GeneralParameterError-RequiredParameter ] Object 0: handle = 0x29c4ca3f3e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x99fb7dfd | vkCreateFramebuffer: required parameter pCreateInfo->renderPass specified as VK_NULL_HANDLE 2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ VUID-VkFramebufferCreateInfo-renderPass-parameter ] Object 0: handle = 0x29c4ab67850, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x98a2a472 | Invalid VkRenderPass Object 0x0. The Vulkan spec states: renderPass must be a valid VkRenderPass handle (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkFramebufferCreateInfo-renderPass-parameter) 2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ UNASSIGNED-GeneralParameterError-RequiredParameter ] Object 0: handle = 0x29c4ca3f3e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x99fb7dfd | vkCreateFramebuffer: required parameter pCreateInfo->renderPass specified as VK_NULL_HANDLE 2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ VUID-VkFramebufferCreateInfo-renderPass-parameter ] Object 0: handle = 0x29c4ab67850, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x98a2a472 | Invalid VkRenderPass Object 0x0. The Vulkan spec states: renderPass must be a valid VkRenderPass handle (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkFramebufferCreateInfo-renderPass-parameter) 2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ UNASSIGNED-GeneralParameterError-RequiredParameter ] Object 0: handle = 0x29c4ca3f3e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x99fb7dfd | vkCreateFramebuffer: required parameter pCreateInfo->renderPass specified as VK_NULL_HANDLE 2024-06-16 12:45:52 [main] main.java.org.vulkanb.eng.graph.vk.Instance.lambda$0() ERROR: VkDebugUtilsCallback, Validation Error: [ VUID-VkFramebufferCreateInfo-renderPass-parameter ] Object 0: handle = 0x29c4ab67850, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x98a2a472 | Invalid VkRenderPass Object 0x0. The Vulkan spec states: renderPass must be a valid VkRenderPass handle (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkFramebufferCreateInfo-renderPass-parameter)

This is not related to swapchain but render pass creation. This should not happen. Have you modified the code?

Not at all, I directly transposed the code from Chapter 16. I downloaded each class and moved it into the folder, overwriting each one and redoing the imports. I'm pretty sure I've had this error warning since the beginning, even before extracting the code, but it never crashed because of it so it wasn't high priority. If you can pinpoint which class is causing that, I can replace the code again, and check the imports?

It should be in the FrameBuffer class. The warning message is complaining that render pass is null. In any case, this seems a separate error. regarding the out of memory error, Can you test it with 100 materials?

MaxTextures set to 100 returns the same error.

Ok, I will try to test it in a AMD GPU to check if I can see something. I will try to test it next weekend

That would be greatly appreciated. Thank you.

Ok, I finally managed to test it on an AMD GPU, and I did get the same crash as you. I do not understand why since it seems the pool is correctly sized. Any way, it can be fixed easliy by increasing the size of the pool for textures:

    private void createDescriptorPool(int numImages) {
...
        descriptorTypeCounts.add(new DescriptorPool.DescriptorTypeCount(engineProps.getMaxTextures() + 10, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER));
...
    }

I'm still trying to understand why this work in the pool created for gemoetry actuivity and not for shadows.

I've been entirely confused about that myself. My only thinking was it may be related to the way AMD interferes with graphics for sharpening. I looked for Vulkan specific extensions and didn't find any explanations, but you'd definitely have more luck if it is that. Thank you!