WIP: [vk] Fix Vulkan streaming ring alignment and flushes #2702
3 changed files with 9 additions and 6 deletions
|
@ -127,7 +127,7 @@ public:
|
|||
std::span<u8> BindMappedUniformBuffer([[maybe_unused]] size_t stage,
|
||||
[[maybe_unused]] u32 binding_index, u32 size) {
|
||||
const StagingBufferRef ref = staging_pool.Request(size, MemoryUsage::Upload);
|
||||
BindBuffer(ref.buffer, static_cast<u32>(ref.offset), size);
|
||||
BindBuffer(ref.buffer, ref.offset, static_cast<VkDeviceSize>(size));
|
||||
#ifdef YUZU_DEBUG
|
||||
ASSERT(ref.mapped_span.size() >= size);
|
||||
const VkDeviceSize ubo_align = device.GetUniformBufferAlignment();
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
return ref.mapped_span;
|
||||
}
|
||||
|
||||
void BindUniformBuffer(VkBuffer buffer, u32 offset, u32 size) {
|
||||
void BindUniformBuffer(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size) {
|
||||
#ifdef YUZU_DEBUG
|
||||
const VkDeviceSize ubo_align = device.GetUniformBufferAlignment();
|
||||
ASSERT(ubo_align == 0 || (offset % ubo_align) == 0);
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
BindBuffer(buffer, offset, size);
|
||||
}
|
||||
|
||||
void BindStorageBuffer(VkBuffer buffer, u32 offset, u32 size,
|
||||
void BindStorageBuffer(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size,
|
||||
[[maybe_unused]] bool is_written) {
|
||||
#ifdef YUZU_DEBUG
|
||||
const VkDeviceSize ssbo_align = device.GetStorageBufferAlignment();
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void BindBuffer(VkBuffer buffer, u32 offset, u32 size) {
|
||||
void BindBuffer(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size) {
|
||||
guest_descriptor_queue.AddBuffer(buffer, offset, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
|||
.owner = &stream_buffer,
|
||||
.atom_size = non_coherent_atom_size,
|
||||
.is_coherent = stream_is_coherent,
|
||||
.is_stream_ring = true,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,10 @@ struct StagingBufferRef {
|
|||
const vk::Buffer* owner = nullptr;
|
||||
VkDeviceSize atom_size = 1;
|
||||
bool is_coherent = true;
|
||||
bool is_stream_ring = false;
|
||||
|
||||
void FlushRange(VkDeviceSize range_offset, VkDeviceSize size) const {
|
||||
if (!owner || is_coherent || size == 0) {
|
||||
if (!owner || is_coherent || size == 0 || is_stream_ring) {
|
||||
return;
|
||||
}
|
||||
if (size == VK_WHOLE_SIZE) {
|
||||
|
@ -53,7 +54,7 @@ struct StagingBufferRef {
|
|||
}
|
||||
|
||||
void InvalidateRange(VkDeviceSize range_offset, VkDeviceSize size) const {
|
||||
if (!owner || is_coherent || size == 0) {
|
||||
if (!owner || is_coherent || size == 0 || is_stream_ring) {
|
||||
return;
|
||||
}
|
||||
if (size == VK_WHOLE_SIZE) {
|
||||
|
@ -119,6 +120,7 @@ private:
|
|||
.owner = buffer.get(),
|
||||
.atom_size = atom_size,
|
||||
.is_coherent = is_coherent,
|
||||
.is_stream_ring = false,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue