1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d11] Perform bound-checking in GetBufferSlice

Ensures that we don't pass invalid buffer slices to the backend.
This commit is contained in:
Philip Rebohle 2021-03-04 17:37:13 +01:00
parent 049fda9218
commit 3acdf6e22a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -77,15 +77,23 @@ namespace dxvk {
}
DxvkBufferSlice GetBufferSlice() const {
return GetBufferSlice(0, m_desc.ByteWidth);
return DxvkBufferSlice(m_buffer, 0, m_desc.ByteWidth);
}
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset) const {
return GetBufferSlice(offset, m_desc.ByteWidth - offset);
VkDeviceSize size = m_desc.ByteWidth;
return likely(offset < size)
? DxvkBufferSlice(m_buffer, offset, size - offset)
: DxvkBufferSlice();
}
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const {
return DxvkBufferSlice(m_buffer, offset, length);
VkDeviceSize size = m_desc.ByteWidth;
return likely(offset < size)
? DxvkBufferSlice(m_buffer, offset, std::min(length, size - offset))
: DxvkBufferSlice();
}
DxvkBufferSlice GetSOCounter() {