Commit 7bf9e838 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d11: Implement ID3D11RasterizerState1.

parent 9d494730
......@@ -461,7 +461,7 @@ struct d3d_depthstencil_state *unsafe_impl_from_ID3D10DepthStencilState(
/* ID3D11RasterizerState, ID3D10RasterizerState */
struct d3d_rasterizer_state
{
ID3D11RasterizerState ID3D11RasterizerState_iface;
ID3D11RasterizerState1 ID3D11RasterizerState1_iface;
ID3D10RasterizerState ID3D10RasterizerState_iface;
LONG refcount;
......
......@@ -2283,7 +2283,8 @@ static void STDMETHODCALLTYPE d3d11_device_context_RSGetState(ID3D11DeviceContex
if ((wined3d_state = wined3d_device_context_get_rasterizer_state(context->wined3d_context)))
{
rasterizer_state_impl = wined3d_rasterizer_state_get_parent(wined3d_state);
ID3D11RasterizerState_AddRef(*rasterizer_state = &rasterizer_state_impl->ID3D11RasterizerState_iface);
*rasterizer_state = (ID3D11RasterizerState *)&rasterizer_state_impl->ID3D11RasterizerState1_iface;
ID3D11RasterizerState_AddRef(*rasterizer_state);
}
else
{
......@@ -3604,7 +3605,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState(ID3D11Device
if (FAILED(hr = d3d_rasterizer_state_create(device, desc, &object)))
return hr;
*rasterizer_state = &object->ID3D11RasterizerState_iface;
*rasterizer_state = (ID3D11RasterizerState *)&object->ID3D11RasterizerState1_iface;
return S_OK;
}
......@@ -4950,7 +4951,7 @@ static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device1 *iface, ID3D
rasterizer_state_object = unsafe_impl_from_ID3D10RasterizerState(rasterizer_state);
d3d11_device_context_RSSetState(&device->immediate_context.ID3D11DeviceContext1_iface,
rasterizer_state_object ? &rasterizer_state_object->ID3D11RasterizerState_iface : NULL);
rasterizer_state_object ? (ID3D11RasterizerState *)&rasterizer_state_object->ID3D11RasterizerState1_iface : NULL);
}
static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device1 *iface,
......
......@@ -841,23 +841,24 @@ struct d3d_depthstencil_state *unsafe_impl_from_ID3D10DepthStencilState(ID3D10De
/* ID3D11RasterizerState methods */
static inline struct d3d_rasterizer_state *impl_from_ID3D11RasterizerState(ID3D11RasterizerState *iface)
static inline struct d3d_rasterizer_state *impl_from_ID3D11RasterizerState1(ID3D11RasterizerState1 *iface)
{
return CONTAINING_RECORD(iface, struct d3d_rasterizer_state, ID3D11RasterizerState_iface);
return CONTAINING_RECORD(iface, struct d3d_rasterizer_state, ID3D11RasterizerState1_iface);
}
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_QueryInterface(ID3D11RasterizerState *iface,
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_QueryInterface(ID3D11RasterizerState1 *iface,
REFIID riid, void **object)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D11RasterizerState)
|| IsEqualGUID(riid, &IID_ID3D11RasterizerState1)
|| IsEqualGUID(riid, &IID_ID3D11DeviceChild)
|| IsEqualGUID(riid, &IID_IUnknown))
{
ID3D11RasterizerState_AddRef(iface);
ID3D11RasterizerState1_AddRef(iface);
*object = iface;
return S_OK;
}
......@@ -876,9 +877,9 @@ static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_QueryInterface(ID3D11Ras
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_AddRef(ID3D11RasterizerState *iface)
static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_AddRef(ID3D11RasterizerState1 *iface)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
ULONG refcount = InterlockedIncrement(&state->refcount);
TRACE("%p increasing refcount to %u.\n", state, refcount);
......@@ -892,9 +893,9 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_AddRef(ID3D11RasterizerSta
return refcount;
}
static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerState *iface)
static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerState1 *iface)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
ULONG refcount = InterlockedDecrement(&state->refcount);
TRACE("%p decreasing refcount to %u.\n", state, refcount);
......@@ -909,10 +910,10 @@ static ULONG STDMETHODCALLTYPE d3d11_rasterizer_state_Release(ID3D11RasterizerSt
return refcount;
}
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDevice(ID3D11RasterizerState *iface,
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDevice(ID3D11RasterizerState1 *iface,
ID3D11Device **device)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, device %p.\n", iface, device);
......@@ -920,47 +921,58 @@ static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDevice(ID3D11RasterizerS
ID3D11Device_AddRef(*device);
}
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_GetPrivateData(ID3D11RasterizerState *iface,
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_GetPrivateData(ID3D11RasterizerState1 *iface,
REFGUID guid, UINT *data_size, void *data)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return d3d_get_private_data(&state->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_SetPrivateData(ID3D11RasterizerState *iface,
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_SetPrivateData(ID3D11RasterizerState1 *iface,
REFGUID guid, UINT data_size, const void *data)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return d3d_set_private_data(&state->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_SetPrivateDataInterface(ID3D11RasterizerState *iface,
static HRESULT STDMETHODCALLTYPE d3d11_rasterizer_state_SetPrivateDataInterface(ID3D11RasterizerState1 *iface,
REFGUID guid, const IUnknown *data)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
return d3d_set_private_data_interface(&state->private_store, guid, data);
}
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc(ID3D11RasterizerState *iface,
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc(ID3D11RasterizerState1 *iface,
D3D11_RASTERIZER_DESC *desc)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState(iface);
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, desc %p.\n", iface, desc);
*desc = state->desc;
}
static const struct ID3D11RasterizerStateVtbl d3d11_rasterizer_state_vtbl =
static void STDMETHODCALLTYPE d3d11_rasterizer_state_GetDesc1(ID3D11RasterizerState1 *iface,
D3D11_RASTERIZER_DESC1 *desc)
{
struct d3d_rasterizer_state *state = impl_from_ID3D11RasterizerState1(iface);
TRACE("iface %p, desc %p.\n", iface, desc);
memcpy(desc, &state->desc, sizeof(state->desc));
desc->ForcedSampleCount = 0;
}
static const struct ID3D11RasterizerState1Vtbl d3d11_rasterizer_state_vtbl =
{
/* IUnknown methods */
d3d11_rasterizer_state_QueryInterface,
......@@ -973,6 +985,8 @@ static const struct ID3D11RasterizerStateVtbl d3d11_rasterizer_state_vtbl =
d3d11_rasterizer_state_SetPrivateDataInterface,
/* ID3D11RasterizerState methods */
d3d11_rasterizer_state_GetDesc,
/* ID3D11RasterizerState1 methods */
d3d11_rasterizer_state_GetDesc1,
};
/* ID3D10RasterizerState methods */
......@@ -991,7 +1005,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_rasterizer_state_QueryInterface(ID3D10Ras
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
return d3d11_rasterizer_state_QueryInterface(&state->ID3D11RasterizerState_iface, riid, object);
return d3d11_rasterizer_state_QueryInterface(&state->ID3D11RasterizerState1_iface, riid, object);
}
static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_AddRef(ID3D10RasterizerState *iface)
......@@ -1000,7 +1014,7 @@ static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_AddRef(ID3D10RasterizerSta
TRACE("iface %p.\n", iface);
return d3d11_rasterizer_state_AddRef(&state->ID3D11RasterizerState_iface);
return d3d11_rasterizer_state_AddRef(&state->ID3D11RasterizerState1_iface);
}
static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_Release(ID3D10RasterizerState *iface)
......@@ -1009,7 +1023,7 @@ static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_Release(ID3D10RasterizerSt
TRACE("iface %p.\n", state);
return d3d11_rasterizer_state_Release(&state->ID3D11RasterizerState_iface);
return d3d11_rasterizer_state_Release(&state->ID3D11RasterizerState1_iface);
}
/* ID3D10DeviceChild methods */
......@@ -1113,7 +1127,7 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str
struct wined3d_rasterizer_state_desc wined3d_desc;
HRESULT hr;
state->ID3D11RasterizerState_iface.lpVtbl = &d3d11_rasterizer_state_vtbl;
state->ID3D11RasterizerState1_iface.lpVtbl = &d3d11_rasterizer_state_vtbl;
state->ID3D10RasterizerState_iface.lpVtbl = &d3d10_rasterizer_state_vtbl;
state->refcount = 1;
wined3d_private_store_init(&state->private_store);
......@@ -1175,7 +1189,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE
object = WINE_RB_ENTRY_VALUE(entry, struct d3d_rasterizer_state, entry);
TRACE("Returning existing rasterizer state %p.\n", object);
ID3D11RasterizerState_AddRef(&object->ID3D11RasterizerState_iface);
ID3D11RasterizerState1_AddRef(&object->ID3D11RasterizerState1_iface);
*state = object;
wined3d_mutex_unlock();
......@@ -1207,9 +1221,9 @@ struct d3d_rasterizer_state *unsafe_impl_from_ID3D11RasterizerState(ID3D11Raster
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d11_rasterizer_state_vtbl);
assert(iface->lpVtbl == (ID3D11RasterizerStateVtbl *)&d3d11_rasterizer_state_vtbl);
return impl_from_ID3D11RasterizerState(iface);
return impl_from_ID3D11RasterizerState1((ID3D11RasterizerState1 *)iface);
}
struct d3d_rasterizer_state *unsafe_impl_from_ID3D10RasterizerState(ID3D10RasterizerState *iface)
......
......@@ -5507,6 +5507,7 @@ static void test_create_rasterizer_state(void)
D3D10_RASTERIZER_DESC d3d10_desc;
D3D11_RASTERIZER_DESC desc;
ID3D11Device *device, *tmp;
ID3D11Device1 *device1;
HRESULT hr;
if (!(device = create_device(NULL)))
......@@ -5570,6 +5571,24 @@ static void test_create_rasterizer_state(void)
ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
}
if (ID3D11Device_QueryInterface(device, &IID_ID3D11Device1, (void **)&device1) == S_OK)
{
ID3D11RasterizerState1 *state_ex1;
D3D11_RASTERIZER_DESC1 desc1;
hr = ID3D11RasterizerState_QueryInterface(rast_state1, &IID_ID3D11RasterizerState1, (void **)&state_ex1);
ok(hr == S_OK, "Got hr %#x.\n", hr);
memset(&desc1, 0xcc, sizeof(desc1));
ID3D11RasterizerState1_GetDesc1(state_ex1, &desc1);
ok(!memcmp(&desc1, &desc, sizeof(desc)), "D3D11 desc didn't match.\n");
ok(!desc1.ForcedSampleCount, "Got forced sample count %u.\n", desc1.ForcedSampleCount);
ID3D11RasterizerState1_Release(state_ex1);
ID3D11Device1_Release(device1);
}
refcount = ID3D11RasterizerState_Release(rast_state2);
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
refcount = ID3D11RasterizerState_Release(rast_state1);
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