mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-04 01:29:26 +01:00
[d3d9] Adjust out of bounds clip plane index handling
This commit is contained in:
parent
9c012c8e75
commit
fb56668dc0
@ -2187,9 +2187,13 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::SetClipPlane(DWORD Index, const float* pPlane) {
|
||||
D3D9DeviceLock lock = LockDevice();
|
||||
|
||||
if (unlikely(Index >= caps::MaxClipPlanes || !pPlane))
|
||||
if (unlikely(!pPlane))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// Higher indexes will be capped to the last valid index
|
||||
if (unlikely(Index >= caps::MaxClipPlanes))
|
||||
Index = caps::MaxClipPlanes - 1;
|
||||
|
||||
if (unlikely(ShouldRecord()))
|
||||
return m_recorder->SetClipPlane(Index, pPlane);
|
||||
|
||||
@ -2213,9 +2217,13 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetClipPlane(DWORD Index, float* pPlane) {
|
||||
D3D9DeviceLock lock = LockDevice();
|
||||
|
||||
if (unlikely(Index >= caps::MaxClipPlanes || !pPlane))
|
||||
if (unlikely(!pPlane))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// Higher indexes will be capped to the last valid index
|
||||
if (unlikely(Index >= caps::MaxClipPlanes))
|
||||
Index = caps::MaxClipPlanes - 1;
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
pPlane[i] = m_state.clipPlanes[Index].coeff[i];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user