d3d8: Fix texture stage index checks.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2020-02-27 13:31:09 +01:00 committed by Alexandre Julliard
parent e1926af200
commit 565f7b4494
1 changed files with 2 additions and 8 deletions

View File

@ -2159,10 +2159,7 @@ static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stag
if (!texture)
return D3DERR_INVALIDCALL;
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (stage >= WINED3D_MAX_COMBINED_SAMPLERS)
if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS)
{
WARN("Ignoring invalid stage %u.\n", stage);
*texture = NULL;
@ -2253,10 +2250,7 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, state, value);
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (stage >= WINED3D_MAX_COMBINED_SAMPLERS)
if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS)
{
WARN("Invalid stage %u.\n", stage);
*value = 0;