[d3d9] Return empty buffer slice for out-of-bounds offsets

Fixes #3715.
This commit is contained in:
Philip Rebohle 2023-11-14 12:17:39 +01:00 committed by Joshie
parent 1cb58b0732
commit ea3149801f
1 changed files with 6 additions and 1 deletions

View File

@ -125,7 +125,12 @@ namespace dxvk {
template <D3D9_COMMON_BUFFER_TYPE Type>
inline DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const {
return DxvkBufferSlice(GetBuffer<Type>(), offset, length);
if (likely(length && offset < m_desc.Size)) {
return DxvkBufferSlice(GetBuffer<Type>(), offset,
std::min<VkDeviceSize>(m_desc.Size - offset, length));
}
return DxvkBufferSlice();
}
inline DxvkBufferSliceHandle AllocMapSlice() {