mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
vk: Add support for dynamic buffer offsets
This commit is contained in:
parent
73f2aaf9d8
commit
edcef238bb
2 changed files with 20 additions and 1 deletions
|
@ -430,6 +430,17 @@ namespace vk
|
|||
}
|
||||
}
|
||||
|
||||
void descriptor_set::push(const descriptor_set_dynamic_offset_t& offset)
|
||||
{
|
||||
ensure(offset.location >= 0 && offset.location <= 16);
|
||||
while (m_dynamic_offsets.size() < (offset.location + 1))
|
||||
{
|
||||
m_dynamic_offsets.push_back(0);
|
||||
}
|
||||
|
||||
m_dynamic_offsets[offset.location] = offset.value;
|
||||
}
|
||||
|
||||
void descriptor_set::bind(const vk::command_buffer& cmd, VkPipelineBindPoint bind_point, VkPipelineLayout layout)
|
||||
{
|
||||
if ((m_push_type_mask & ~m_update_after_bind_mask) || (m_pending_writes.size() >= max_cache_size))
|
||||
|
@ -437,7 +448,7 @@ namespace vk
|
|||
flush();
|
||||
}
|
||||
|
||||
vkCmdBindDescriptorSets(cmd, bind_point, layout, 0, 1, &m_handle, 0, nullptr);
|
||||
vkCmdBindDescriptorSets(cmd, bind_point, layout, 0, 1, &m_handle, ::size32(m_dynamic_offsets), m_dynamic_offsets.data());
|
||||
}
|
||||
|
||||
void descriptor_set::flush()
|
||||
|
|
|
@ -27,6 +27,12 @@ namespace vk
|
|||
}
|
||||
};
|
||||
|
||||
struct descriptor_set_dynamic_offset_t
|
||||
{
|
||||
int location;
|
||||
u32 value;
|
||||
};
|
||||
|
||||
class descriptor_pool
|
||||
{
|
||||
public:
|
||||
|
@ -95,6 +101,7 @@ namespace vk
|
|||
void push(const VkDescriptorImageInfo& image_info, VkDescriptorType type, u32 binding);
|
||||
void push(const VkDescriptorImageInfo* image_info, u32 count, VkDescriptorType type, u32 binding);
|
||||
void push(rsx::simple_array<VkCopyDescriptorSet>& copy_cmd, u32 type_mask = umax);
|
||||
void push(const descriptor_set_dynamic_offset_t& offset);
|
||||
|
||||
void bind(const vk::command_buffer& cmd, VkPipelineBindPoint bind_point, VkPipelineLayout layout);
|
||||
|
||||
|
@ -109,6 +116,7 @@ namespace vk
|
|||
rsx::simple_array<VkBufferView> m_buffer_view_pool;
|
||||
rsx::simple_array<VkDescriptorBufferInfo> m_buffer_info_pool;
|
||||
rsx::simple_array<VkDescriptorImageInfo> m_image_info_pool;
|
||||
rsx::simple_array<u32> m_dynamic_offsets;
|
||||
|
||||
#ifdef __clang__
|
||||
// Clang (pre 16.x) does not support LWG 2089, std::construct_at for POD types
|
||||
|
|
Loading…
Add table
Reference in a new issue