Commit 3449c79d authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Add support for FrontCounterClockwise.

parent 3861b4bb
...@@ -419,6 +419,7 @@ struct d3d_rasterizer_state ...@@ -419,6 +419,7 @@ struct d3d_rasterizer_state
LONG refcount; LONG refcount;
struct wined3d_private_store private_store; struct wined3d_private_store private_store;
struct wined3d_rasterizer_state *wined3d_state;
D3D11_RASTERIZER_DESC desc; D3D11_RASTERIZER_DESC desc;
struct wine_rb_entry entry; struct wine_rb_entry entry;
ID3D11Device *device; ID3D11Device *device;
......
...@@ -834,6 +834,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon ...@@ -834,6 +834,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
wined3d_mutex_lock(); wined3d_mutex_lock();
if (!(device->rasterizer_state = unsafe_impl_from_ID3D11RasterizerState(rasterizer_state))) 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_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_CULLMODE, WINED3D_CULL_CCW);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE);
...@@ -843,12 +844,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon ...@@ -843,12 +844,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
return; return;
} }
wined3d_device_set_rasterizer_state(device->wined3d_device, device->rasterizer_state->wined3d_state);
desc = &device->rasterizer_state->desc; 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_FILLMODE, desc->FillMode);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode); 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. */ /* OpenGL style depth bias. */
if (desc->DepthBias || desc->SlopeScaledDepthBias) if (desc->DepthBias || desc->SlopeScaledDepthBias)
FIXME("Ignoring depth bias.\n"); FIXME("Ignoring depth bias.\n");
......
...@@ -664,9 +664,10 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt ...@@ -664,9 +664,10 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt
struct d3d_device *device = impl_from_ID3D11Device(state->device); struct d3d_device *device = impl_from_ID3D11Device(state->device);
wined3d_mutex_lock(); wined3d_mutex_lock();
wine_rb_remove(&device->rasterizer_states, &state->desc); 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_private_store_cleanup(&state->private_store);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
ID3D11Device_Release(state->device);
HeapFree(GetProcessHeap(), 0, state); HeapFree(GetProcessHeap(), 0, state);
} }
...@@ -849,6 +850,9 @@ static const struct ID3D10RasterizerStateVtbl d3d10_rasterizer_state_vtbl = ...@@ -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, HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d_device *device,
const D3D11_RASTERIZER_DESC *desc) const D3D11_RASTERIZER_DESC *desc)
{ {
struct wined3d_rasterizer_state_desc wined3d_desc;
HRESULT hr;
state->ID3D11RasterizerState_iface.lpVtbl = &d3d11_rasterizer_state_vtbl; state->ID3D11RasterizerState_iface.lpVtbl = &d3d11_rasterizer_state_vtbl;
state->ID3D10RasterizerState_iface.lpVtbl = &d3d10_rasterizer_state_vtbl; state->ID3D10RasterizerState_iface.lpVtbl = &d3d10_rasterizer_state_vtbl;
state->refcount = 1; state->refcount = 1;
...@@ -856,17 +860,27 @@ HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d ...@@ -856,17 +860,27 @@ HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d
wined3d_private_store_init(&state->private_store); wined3d_private_store_init(&state->private_store);
state->desc = *desc; 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) if (wine_rb_put(&device->rasterizer_states, desc, &state->entry) == -1)
{ {
ERR("Failed to insert rasterizer state entry.\n"); ERR("Failed to insert rasterizer state entry.\n");
wined3d_private_store_cleanup(&state->private_store); wined3d_private_store_cleanup(&state->private_store);
wined3d_rasterizer_state_decref(state->wined3d_state);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_FAIL; return E_FAIL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
state->device = &device->ID3D11Device_iface; ID3D11Device_AddRef(state->device = &device->ID3D11Device_iface);
ID3D11Device_AddRef(state->device);
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment