diff options
author | quou <quou@disroot.org> | 2024-12-28 18:20:34 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-28 18:20:34 +1100 |
commit | d0b8f74f363095b00b46c32981078619a181a8b1 (patch) | |
tree | 0b4c824d0f2691f2d2034f69230b1eff70168be3 /video.cpp | |
parent | bb5369050ed8c64e2c428454899b47ad22d278a8 (diff) |
Fix drawing with no descriptors
Diffstat (limited to 'video.cpp')
-rw-r--r-- | video.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
@@ -1800,7 +1800,9 @@ void Context::submit( Rpo_Key rpo_key = { dev->first_rp, rp }; Pso_Key pso_key = { p, rpo_key }; Pipeline_Vk& pso = dev->get_pso(pso_key); - Descriptor_Set_Vk& dso = dev->get_dso(pso, *(Dso_Key*)&p); + Descriptor_Set_Vk* dso = 0; + if (p.descriptor_count) + dso = &dev->get_dso(pso, *(Dso_Key*)&p); auto& rpo = ctx->begin_rp(rp); Texture_Vk& target = *(Texture_Vk*)&dev->get_texture( dev->get_backbuffer() @@ -1811,16 +1813,17 @@ void Context::submit( VK_PIPELINE_BIND_POINT_GRAPHICS, pso.pip ); - vkCmdBindDescriptorSets( - ctx->cb, - VK_PIPELINE_BIND_POINT_GRAPHICS, - pso.lay, - 0, - 1, - &dso.dset, - 0, - 0 - ); + if (dso) + vkCmdBindDescriptorSets( + ctx->cb, + VK_PIPELINE_BIND_POINT_GRAPHICS, + pso.lay, + 0, + 1, + &dso->dset, + 0, + 0 + ); for (binding = draw.verts; binding->id; binding++) { VkBuffer buf = ((Buffer_Vk*)&dev->get_buffer(binding->id))->buf; VkDeviceSize offset = (VkDeviceSize)binding->offset; @@ -1835,7 +1838,8 @@ void Context::submit( ); ctx->end_rp(rpo); pso.on_submit(); - dso.on_submit(); + if (dso) + dso->on_submit(); } void Context::submit( @@ -2389,9 +2393,10 @@ void Pipeline_Vk::init_layout( VkPipelineLayoutCreateInfo li{}; (void)desc; int set_count = desc.descriptor_count? 1: 0; - if (set_count) { + if (set_count) init_descriptors(dev, desc); - } + else + dlay = VK_NULL_HANDLE; li.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; li.setLayoutCount = set_count; li.pSetLayouts = &dlay; @@ -2444,7 +2449,8 @@ void Pipeline_Vk::init(Device_Vk* dev, const Pso_Key& key) { } void Pipeline_Vk::destroy(Device_Vk* dev) { - vkDestroyDescriptorSetLayout(dev->dev, dlay, &dev->ac); + if (dlay) + vkDestroyDescriptorSetLayout(dev->dev, dlay, &dev->ac); vkDestroyPipelineLayout(dev->dev, lay, &dev->ac); vkDestroyPipeline(dev->dev, pip, &dev->ac); } |