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