Skip to content

Commit

Permalink
[d3d9] Return empty buffer slice for out-of-bounds offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
doitsujin authored and misyltoad committed Nov 14, 2023
1 parent 1cb58b0 commit ea31498
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/d3d9/d3d9_common_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ea31498

Please sign in to comment.