d3d11: Add support for FrontCounterClockwise.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-07-27 23:33:42 +02:00 committed by Alexandre Julliard
parent 3861b4bb37
commit 3449c79d13
3 changed files with 21 additions and 6 deletions

View File

@ -419,6 +419,7 @@ struct d3d_rasterizer_state
LONG refcount;
struct wined3d_private_store private_store;
struct wined3d_rasterizer_state *wined3d_state;
D3D11_RASTERIZER_DESC desc;
struct wine_rb_entry entry;
ID3D11Device *device;

View File

@ -834,6 +834,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
wined3d_mutex_lock();
if (!(device->rasterizer_state = unsafe_impl_from_ID3D11RasterizerState(rasterizer_state)))
{
wined3d_device_set_rasterizer_state(device->wined3d_device, NULL);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_FILLMODE, WINED3D_FILL_SOLID);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, WINED3D_CULL_CCW);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE);
@ -843,12 +844,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
return;
}
wined3d_device_set_rasterizer_state(device->wined3d_device, device->rasterizer_state->wined3d_state);
desc = &device->rasterizer_state->desc;
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_FILLMODE, desc->FillMode);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode);
/* glFrontFace() */
if (desc->FrontCounterClockwise)
FIXME("Ignoring FrontCounterClockwise %#x.\n", desc->FrontCounterClockwise);
/* OpenGL style depth bias. */
if (desc->DepthBias || desc->SlopeScaledDepthBias)
FIXME("Ignoring depth bias.\n");

View File

@ -664,9 +664,10 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt
struct d3d_device *device = impl_from_ID3D11Device(state->device);
wined3d_mutex_lock();
wine_rb_remove(&device->rasterizer_states, &state->desc);
ID3D11Device_Release(state->device);
wined3d_rasterizer_state_decref(state->wined3d_state);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();
ID3D11Device_Release(state->device);
HeapFree(GetProcessHeap(), 0, state);
}
@ -849,6 +850,9 @@ static const struct ID3D10RasterizerStateVtbl d3d10_rasterizer_state_vtbl =
HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d_device *device,
const D3D11_RASTERIZER_DESC *desc)
{
struct wined3d_rasterizer_state_desc wined3d_desc;
HRESULT hr;
state->ID3D11RasterizerState_iface.lpVtbl = &d3d11_rasterizer_state_vtbl;
state->ID3D10RasterizerState_iface.lpVtbl = &d3d10_rasterizer_state_vtbl;
state->refcount = 1;
@ -856,17 +860,27 @@ HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d
wined3d_private_store_init(&state->private_store);
state->desc = *desc;
wined3d_desc.front_ccw = desc->FrontCounterClockwise;
if (FAILED(hr = wined3d_rasterizer_state_create(device->wined3d_device,
&wined3d_desc, &state->wined3d_state)))
{
WARN("Failed to create wined3d rasterizer state, hr %#x.\n", hr);
wined3d_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock();
return hr;
}
if (wine_rb_put(&device->rasterizer_states, desc, &state->entry) == -1)
{
ERR("Failed to insert rasterizer state entry.\n");
wined3d_private_store_cleanup(&state->private_store);
wined3d_rasterizer_state_decref(state->wined3d_state);
wined3d_mutex_unlock();
return E_FAIL;
}
wined3d_mutex_unlock();
state->device = &device->ID3D11Device_iface;
ID3D11Device_AddRef(state->device);
ID3D11Device_AddRef(state->device = &device->ID3D11Device_iface);
return S_OK;
}