ddraw: Handle stateblocks in d3d_device7_SetRenderState().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-10-21 21:35:56 -05:00 committed by Alexandre Julliard
parent db9db753c3
commit 16291e5211
1 changed files with 24 additions and 13 deletions

View File

@ -2486,6 +2486,22 @@ static HRESULT WINAPI d3d_device2_GetRenderState(IDirect3DDevice2 *iface,
return IDirect3DDevice3_GetRenderState(&device->IDirect3DDevice3_iface, state, value); return IDirect3DDevice3_GetRenderState(&device->IDirect3DDevice3_iface, state, value);
} }
static void d3d_device_set_render_state(struct d3d_device *device,
enum wined3d_render_state state, DWORD value)
{
wined3d_stateblock_set_render_state(device->update_state, state, value);
if (!device->recording)
wined3d_device_set_render_state(device->wined3d_device, state, value);
}
static void d3d_device_set_sampler_state(struct d3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
{
wined3d_stateblock_set_sampler_state(device->update_state, sampler_idx, state, value);
if (!device->recording)
wined3d_device_set_sampler_state(device->wined3d_device, sampler_idx, state, value);
}
/***************************************************************************** /*****************************************************************************
* IDirect3DDevice7::SetRenderState * IDirect3DDevice7::SetRenderState
* *
@ -2546,7 +2562,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
break; break;
} }
wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag); d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag);
break; break;
} }
@ -2589,24 +2605,19 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
break; break;
} }
wined3d_device_set_sampler_state(device->wined3d_device, d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_MIP_FILTER, tex_mip);
0, WINED3D_SAMP_MIP_FILTER, tex_mip); d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_MIN_FILTER, tex_min);
wined3d_device_set_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_MIN_FILTER, tex_min);
break; break;
} }
case D3DRENDERSTATE_TEXTUREADDRESS: case D3DRENDERSTATE_TEXTUREADDRESS:
wined3d_device_set_sampler_state(device->wined3d_device, d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_ADDRESS_V, value);
0, WINED3D_SAMP_ADDRESS_V, value);
/* Drop through */ /* Drop through */
case D3DRENDERSTATE_TEXTUREADDRESSU: case D3DRENDERSTATE_TEXTUREADDRESSU:
wined3d_device_set_sampler_state(device->wined3d_device, d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_ADDRESS_U, value);
0, WINED3D_SAMP_ADDRESS_U, value);
break; break;
case D3DRENDERSTATE_TEXTUREADDRESSV: case D3DRENDERSTATE_TEXTUREADDRESSV:
wined3d_device_set_sampler_state(device->wined3d_device, d3d_device_set_sampler_state(device, 0, WINED3D_SAMP_ADDRESS_V, value);
0, WINED3D_SAMP_ADDRESS_V, value);
break; break;
case D3DRENDERSTATE_BORDERCOLOR: case D3DRENDERSTATE_BORDERCOLOR:
@ -2623,7 +2634,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
break; break;
case D3DRENDERSTATE_ZBIAS: case D3DRENDERSTATE_ZBIAS:
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); d3d_device_set_render_state(device, WINED3D_RS_DEPTHBIAS, value);
break; break;
default: default:
@ -2635,7 +2646,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
break; break;
} }
wined3d_device_set_render_state(device->wined3d_device, state, value); d3d_device_set_render_state(device, state, value);
break; break;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();