mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 13:01:27 +12:00
vk: Use write commands instead of copy commands to avoid dependencies
This commit is contained in:
parent
64866098e7
commit
ae74aa336f
5 changed files with 28 additions and 9 deletions
|
@ -48,7 +48,9 @@ namespace vk
|
|||
bool compile_async,
|
||||
std::function<pipeline_type*(pipeline_storage_type&)> callback)
|
||||
{
|
||||
const auto compiler_flags = compile_async ? vk::pipe_compiler::COMPILE_DEFERRED : vk::pipe_compiler::COMPILE_INLINE;
|
||||
vk::pipe_compiler::op_flags compiler_flags = compile_async ? vk::pipe_compiler::COMPILE_DEFERRED : vk::pipe_compiler::COMPILE_INLINE;
|
||||
compiler_flags |= vk::pipe_compiler::SEPARATE_SHADER_OBJECTS;
|
||||
|
||||
auto compiler = vk::get_pipe_compiler();
|
||||
auto result = compiler->compile(
|
||||
pipelineProperties,
|
||||
|
|
|
@ -509,20 +509,20 @@ namespace vk
|
|||
}
|
||||
|
||||
m_copy_cmds.push_back({
|
||||
.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET,
|
||||
.srcSet = m_previous_set,
|
||||
.srcBinding = i,
|
||||
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
|
||||
.dstSet = m_descriptor_set.value(),
|
||||
.dstBinding = i,
|
||||
.descriptorCount = 1
|
||||
.descriptorCount = 1,
|
||||
.descriptorType = m_descriptor_types[i],
|
||||
.pImageInfo = std::get_if<VkDescriptorImageInfo>(&m_descriptor_slots[i]),
|
||||
.pBufferInfo = std::get_if<VkDescriptorBufferInfo>(&m_descriptor_slots[i]),
|
||||
.pTexelBufferView = std::get_if<VkBufferView>(&m_descriptor_slots[i])
|
||||
});
|
||||
|
||||
type_mask |= (1u << m_descriptor_types[i]);
|
||||
}
|
||||
|
||||
m_descriptor_set.push(m_copy_cmds, type_mask); // Write previous state
|
||||
|
||||
m_previous_set = m_descriptor_set.value();
|
||||
m_descriptor_set = allocate_descriptor_set();
|
||||
}
|
||||
|
||||
|
|
|
@ -121,11 +121,10 @@ namespace vk
|
|||
vk::descriptor_set m_descriptor_set{};
|
||||
rsx::simple_array<VkDescriptorPoolSize> m_descriptor_pool_sizes;
|
||||
rsx::simple_array<VkDescriptorType> m_descriptor_types;
|
||||
VkDescriptorSet m_previous_set = VK_NULL_HANDLE;
|
||||
|
||||
std::vector<descriptor_slot_t> m_descriptor_slots;
|
||||
std::vector<bool> m_descriptors_dirty;
|
||||
rsx::simple_array<VkCopyDescriptorSet> m_copy_cmds;
|
||||
rsx::simple_array<VkWriteDescriptorSet> m_copy_cmds;
|
||||
bool m_any_descriptors_dirty = false;
|
||||
|
||||
void init(VkDevice dev);
|
||||
|
|
|
@ -422,6 +422,23 @@ namespace vk
|
|||
}
|
||||
}
|
||||
|
||||
void descriptor_set::push(rsx::simple_array<VkWriteDescriptorSet>& write_cmds, u32 type_mask)
|
||||
{
|
||||
m_push_type_mask |= type_mask;
|
||||
|
||||
if (m_pending_writes.empty()) [[unlikely]]
|
||||
{
|
||||
m_pending_writes = std::move(write_cmds);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto old_size = m_pending_writes.size();
|
||||
const auto new_size = write_cmds.size() + old_size;
|
||||
m_pending_writes.resize(new_size);
|
||||
std::copy(write_cmds.begin(), write_cmds.end(), m_pending_writes.begin() + old_size);
|
||||
}
|
||||
}
|
||||
|
||||
void descriptor_set::push(const descriptor_set_dynamic_offset_t& offset)
|
||||
{
|
||||
ensure(offset.location >= 0 && offset.location <= 16);
|
||||
|
|
|
@ -103,6 +103,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(rsx::simple_array<VkWriteDescriptorSet>& write_cmds, 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue