vk_stream_buffer: Respect non coherent access alignment
* Required by nvidia GPUs on MacOS
This commit is contained in:
@@ -205,6 +205,11 @@ public:
|
|||||||
return properties.limits.minUniformBufferOffsetAlignment;
|
return properties.limits.minUniformBufferOffsetAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the minimum alignemt required for accessing host-mapped device memory
|
||||||
|
vk::DeviceSize NonCoherentAtomSize() const {
|
||||||
|
return properties.limits.nonCoherentAtomSize;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the maximum supported elements in a texel buffer
|
/// Returns the maximum supported elements in a texel buffer
|
||||||
u32 MaxTexelBufferElements() const {
|
u32 MaxTexelBufferElements() const {
|
||||||
return properties.limits.maxTexelBufferElements;
|
return properties.limits.maxTexelBufferElements;
|
||||||
|
@@ -94,6 +94,10 @@ StreamBuffer::~StreamBuffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<u8*, u64, bool> StreamBuffer::Map(u64 size, u64 alignment) {
|
std::tuple<u8*, u64, bool> StreamBuffer::Map(u64 size, u64 alignment) {
|
||||||
|
if (!is_coherent && type == BufferType::Stream) {
|
||||||
|
size = Common::AlignUp(size, instance.NonCoherentAtomSize());
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(size <= stream_buffer_size);
|
ASSERT(size <= stream_buffer_size);
|
||||||
mapped_size = size;
|
mapped_size = size;
|
||||||
|
|
||||||
@@ -122,6 +126,10 @@ std::tuple<u8*, u64, bool> StreamBuffer::Map(u64 size, u64 alignment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StreamBuffer::Commit(u64 size) {
|
void StreamBuffer::Commit(u64 size) {
|
||||||
|
if (!is_coherent && type == BufferType::Stream) {
|
||||||
|
size = Common::AlignUp(size, instance.NonCoherentAtomSize());
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_MSG(size <= mapped_size, "Reserved size {} is too small compared to {}", mapped_size,
|
ASSERT_MSG(size <= mapped_size, "Reserved size {} is too small compared to {}", mapped_size,
|
||||||
size);
|
size);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user