Commit 0d901c1c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d11: Implement ID3D11Device1::CreateRasterizerState1().

parent 7bf9e838
...@@ -467,12 +467,12 @@ struct d3d_rasterizer_state ...@@ -467,12 +467,12 @@ struct d3d_rasterizer_state
struct wined3d_private_store private_store; struct wined3d_private_store private_store;
struct wined3d_rasterizer_state *wined3d_state; struct wined3d_rasterizer_state *wined3d_state;
D3D11_RASTERIZER_DESC desc; D3D11_RASTERIZER_DESC1 desc;
struct wine_rb_entry entry; struct wine_rb_entry entry;
ID3D11Device2 *device; ID3D11Device2 *device;
}; };
HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTERIZER_DESC *desc, HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTERIZER_DESC1 *desc,
struct d3d_rasterizer_state **state) DECLSPEC_HIDDEN; struct d3d_rasterizer_state **state) DECLSPEC_HIDDEN;
struct d3d_rasterizer_state *unsafe_impl_from_ID3D11RasterizerState(ID3D11RasterizerState *iface) DECLSPEC_HIDDEN; struct d3d_rasterizer_state *unsafe_impl_from_ID3D11RasterizerState(ID3D11RasterizerState *iface) DECLSPEC_HIDDEN;
struct d3d_rasterizer_state *unsafe_impl_from_ID3D10RasterizerState(ID3D10RasterizerState *iface) DECLSPEC_HIDDEN; struct d3d_rasterizer_state *unsafe_impl_from_ID3D10RasterizerState(ID3D10RasterizerState *iface) DECLSPEC_HIDDEN;
......
...@@ -3598,11 +3598,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState(ID3D11Device ...@@ -3598,11 +3598,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState(ID3D11Device
{ {
struct d3d_device *device = impl_from_ID3D11Device2(iface); struct d3d_device *device = impl_from_ID3D11Device2(iface);
struct d3d_rasterizer_state *object; struct d3d_rasterizer_state *object;
D3D11_RASTERIZER_DESC1 desc1;
HRESULT hr; HRESULT hr;
TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state); TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
if (FAILED(hr = d3d_rasterizer_state_create(device, desc, &object))) if (!desc)
return E_INVALIDARG;
memcpy(&desc1, desc, sizeof(*desc));
desc1.ForcedSampleCount = 0;
if (FAILED(hr = d3d_rasterizer_state_create(device, &desc1, &object)))
return hr; return hr;
*rasterizer_state = (ID3D11RasterizerState *)&object->ID3D11RasterizerState1_iface; *rasterizer_state = (ID3D11RasterizerState *)&object->ID3D11RasterizerState1_iface;
...@@ -4210,9 +4217,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *i ...@@ -4210,9 +4217,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *i
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState1(ID3D11Device2 *iface, static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState1(ID3D11Device2 *iface,
const D3D11_RASTERIZER_DESC1 *desc, ID3D11RasterizerState1 **state) const D3D11_RASTERIZER_DESC1 *desc, ID3D11RasterizerState1 **state)
{ {
FIXME("iface %p, desc %p, state %p stub!\n", iface, desc, state); struct d3d_device *device = impl_from_ID3D11Device2(iface);
struct d3d_rasterizer_state *object;
HRESULT hr;
return E_NOTIMPL; TRACE("iface %p, desc %p, state %p.\n", iface, desc, state);
if (!desc)
return E_INVALIDARG;
if (FAILED(hr = d3d_rasterizer_state_create(device, desc, &object)))
return hr;
*state = &object->ID3D11RasterizerState1_iface;
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Device2 *iface, UINT flags, static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Device2 *iface, UINT flags,
...@@ -6239,11 +6258,18 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device ...@@ -6239,11 +6258,18 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device
{ {
struct d3d_device *device = impl_from_ID3D10Device(iface); struct d3d_device *device = impl_from_ID3D10Device(iface);
struct d3d_rasterizer_state *object; struct d3d_rasterizer_state *object;
D3D11_RASTERIZER_DESC1 desc1;
HRESULT hr; HRESULT hr;
TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state); TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
if (FAILED(hr = d3d_rasterizer_state_create(device, (const D3D11_RASTERIZER_DESC *)desc, &object))) if (!desc)
return E_INVALIDARG;
memcpy(&desc1, desc, sizeof(*desc));
desc1.ForcedSampleCount = 0;
if (FAILED(hr = d3d_rasterizer_state_create(device, &desc1, &object)))
return hr; return hr;
*rasterizer_state = &object->ID3D10RasterizerState_iface; *rasterizer_state = &object->ID3D10RasterizerState_iface;
...@@ -6779,8 +6805,8 @@ static int d3d_depthstencil_state_compare(const void *key, const struct wine_rb_ ...@@ -6779,8 +6805,8 @@ static int d3d_depthstencil_state_compare(const void *key, const struct wine_rb_
static int d3d_rasterizer_state_compare(const void *key, const struct wine_rb_entry *entry) static int d3d_rasterizer_state_compare(const void *key, const struct wine_rb_entry *entry)
{ {
const D3D11_RASTERIZER_DESC *ka = key; const D3D11_RASTERIZER_DESC1 *ka = key;
const D3D11_RASTERIZER_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d_rasterizer_state, entry)->desc; const D3D11_RASTERIZER_DESC1 *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d_rasterizer_state, entry)->desc;
return memcmp(ka, kb, sizeof(*ka)); return memcmp(ka, kb, sizeof(*ka));
} }
......
...@@ -958,7 +958,7 @@ static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc(ID3D11RasterizerSta ...@@ -958,7 +958,7 @@ static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc(ID3D11RasterizerSta
TRACE("iface %p, desc %p.\n", iface, desc); TRACE("iface %p, desc %p.\n", iface, desc);
*desc = state->desc; memcpy(desc, &state->desc, sizeof(*desc));
} }
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc1(ID3D11RasterizerState1 *iface, static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc1(ID3D11RasterizerState1 *iface,
...@@ -968,8 +968,7 @@ static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc1(ID3D11RasterizerSt ...@@ -968,8 +968,7 @@ static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc1(ID3D11RasterizerSt
TRACE("iface %p, desc %p.\n", iface, desc); TRACE("iface %p, desc %p.\n", iface, desc);
memcpy(desc, &state->desc, sizeof(state->desc)); *desc = state->desc;
desc->ForcedSampleCount = 0;
} }
static const struct ID3D11RasterizerState1Vtbl d3d11_rasterizer_state_vtbl = static const struct ID3D11RasterizerState1Vtbl d3d11_rasterizer_state_vtbl =
...@@ -1122,7 +1121,7 @@ static enum wined3d_cull wined3d_cull_from_d3d11(D3D11_CULL_MODE mode) ...@@ -1122,7 +1121,7 @@ static enum wined3d_cull wined3d_cull_from_d3d11(D3D11_CULL_MODE mode)
} }
static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d_device *device, static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, struct d3d_device *device,
const D3D11_RASTERIZER_DESC *desc) const D3D11_RASTERIZER_DESC1 *desc)
{ {
struct wined3d_rasterizer_state_desc wined3d_desc; struct wined3d_rasterizer_state_desc wined3d_desc;
HRESULT hr; HRESULT hr;
...@@ -1157,6 +1156,13 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str ...@@ -1157,6 +1156,13 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str
FIXME("Ignoring MultisampleEnable %#x.\n", desc->MultisampleEnable); FIXME("Ignoring MultisampleEnable %#x.\n", desc->MultisampleEnable);
} }
if (desc->ForcedSampleCount)
{
static unsigned int once;
if (!once++)
FIXME("Ignoring ForcedSampleCount %#x.\n", desc->ForcedSampleCount);
}
/* We cannot fail after creating a wined3d_rasterizer_state object. It /* We cannot fail after creating a wined3d_rasterizer_state object. It
* would lead to double free. */ * would lead to double free. */
if (FAILED(hr = wined3d_rasterizer_state_create(device->wined3d_device, &wined3d_desc, if (FAILED(hr = wined3d_rasterizer_state_create(device->wined3d_device, &wined3d_desc,
...@@ -1173,16 +1179,13 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str ...@@ -1173,16 +1179,13 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str
return S_OK; return S_OK;
} }
HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTERIZER_DESC *desc, HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTERIZER_DESC1 *desc,
struct d3d_rasterizer_state **state) struct d3d_rasterizer_state **state)
{ {
struct d3d_rasterizer_state *object; struct d3d_rasterizer_state *object;
struct wine_rb_entry *entry; struct wine_rb_entry *entry;
HRESULT hr; HRESULT hr;
if (!desc)
return E_INVALIDARG;
wined3d_mutex_lock(); wined3d_mutex_lock();
if ((entry = wine_rb_get(&device->rasterizer_states, desc))) if ((entry = wine_rb_get(&device->rasterizer_states, desc)))
{ {
......
...@@ -5586,6 +5586,13 @@ static void test_create_rasterizer_state(void) ...@@ -5586,6 +5586,13 @@ static void test_create_rasterizer_state(void)
ID3D11RasterizerState1_Release(state_ex1); ID3D11RasterizerState1_Release(state_ex1);
memcpy(&desc1, &desc, sizeof(desc));
desc1.ForcedSampleCount = 0;
hr = ID3D11Device1_CreateRasterizerState1(device1, &desc1, &state_ex1);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ID3D11RasterizerState1_Release(state_ex1);
ID3D11Device1_Release(device1); ID3D11Device1_Release(device1);
} }
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