Commit e4eee4dd authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_pixel_shader_GetDevice().

parent 687c1c73
......@@ -210,6 +210,7 @@ struct d3d10_pixel_shader
struct wined3d_shader *wined3d_shader;
struct wined3d_shader_signature output_signature;
ID3D10Device1 *device;
};
HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device,
......
......@@ -482,7 +482,10 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_AddRef(ID3D10PixelShader *ifac
TRACE("%p increasing refcount to %u\n", This, refcount);
if (refcount == 1)
{
ID3D10Device1_AddRef(This->device);
wined3d_shader_incref(This->wined3d_shader);
}
return refcount;
}
......@@ -495,7 +498,14 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_Release(ID3D10PixelShader *ifa
TRACE("%p decreasing refcount to %u\n", This, refcount);
if (!refcount)
{
ID3D10Device1 *device = This->device;
wined3d_shader_decref(This->wined3d_shader);
/* Release the device last, it may cause the wined3d device to be
* destroyed. */
ID3D10Device1_Release(device);
}
return refcount;
}
......@@ -504,7 +514,12 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_Release(ID3D10PixelShader *ifa
static void STDMETHODCALLTYPE d3d10_pixel_shader_GetDevice(ID3D10PixelShader *iface, ID3D10Device **device)
{
FIXME("iface %p, device %p stub!\n", iface, device);
struct d3d10_pixel_shader *shader = impl_from_ID3D10PixelShader(iface);
TRACE("iface %p, device %p.\n", iface, device);
*device = (ID3D10Device *)shader->device;
ID3D10Device_AddRef(*device);
}
static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_GetPrivateData(ID3D10PixelShader *iface,
......@@ -585,6 +600,9 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
return hr;
}
shader->device = &device->ID3D10Device1_iface;
ID3D10Device1_AddRef(shader->device);
return S_OK;
}
......
......@@ -584,9 +584,18 @@ float4 main(const float4 color : COLOR) : SV_TARGET
hr = ID3D10Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), &vs);
ok(hr == E_INVALIDARG, "Created a SM4 vertex shader from a pixel shader source, hr %#x\n", hr);
expected_refcount = get_refcount((IUnknown *)device) + 1;
hr = ID3D10Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), &ps);
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
if (ps)
refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
tmp = NULL;
expected_refcount = refcount + 1;
ID3D10PixelShader_GetDevice(ps, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
ID3D10Device_Release(tmp);
ID3D10PixelShader_Release(ps);
refcount = ID3D10Device_Release(device);
......
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