d3d10core: Implement d3d10_vertex_shader_GetDevice().
This commit is contained in:
parent
539a579d54
commit
687c1c7358
|
@ -181,6 +181,7 @@ struct d3d10_vertex_shader
|
||||||
|
|
||||||
struct wined3d_shader *wined3d_shader;
|
struct wined3d_shader *wined3d_shader;
|
||||||
struct wined3d_shader_signature output_signature;
|
struct wined3d_shader_signature output_signature;
|
||||||
|
ID3D10Device1 *device;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device,
|
HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device,
|
||||||
|
|
|
@ -167,7 +167,10 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_AddRef(ID3D10VertexShader *if
|
||||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||||
|
|
||||||
if (refcount == 1)
|
if (refcount == 1)
|
||||||
|
{
|
||||||
|
ID3D10Device1_AddRef(This->device);
|
||||||
wined3d_shader_incref(This->wined3d_shader);
|
wined3d_shader_incref(This->wined3d_shader);
|
||||||
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +183,14 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_Release(ID3D10VertexShader *i
|
||||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
|
{
|
||||||
|
ID3D10Device1 *device = This->device;
|
||||||
|
|
||||||
wined3d_shader_decref(This->wined3d_shader);
|
wined3d_shader_decref(This->wined3d_shader);
|
||||||
|
/* Release the device last, it may cause the wined3d device to be
|
||||||
|
* destroyed. */
|
||||||
|
ID3D10Device1_Release(device);
|
||||||
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +199,12 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_Release(ID3D10VertexShader *i
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d10_vertex_shader_GetDevice(ID3D10VertexShader *iface, ID3D10Device **device)
|
static void STDMETHODCALLTYPE d3d10_vertex_shader_GetDevice(ID3D10VertexShader *iface, ID3D10Device **device)
|
||||||
{
|
{
|
||||||
FIXME("iface %p, device %p stub!\n", iface, device);
|
struct d3d10_vertex_shader *shader = impl_from_ID3D10VertexShader(iface);
|
||||||
|
|
||||||
|
TRACE("iface %p, device %p.\n", iface, device);
|
||||||
|
|
||||||
|
*device = (ID3D10Device *)shader->device;
|
||||||
|
ID3D10Device_AddRef(*device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_GetPrivateData(ID3D10VertexShader *iface,
|
static HRESULT STDMETHODCALLTYPE d3d10_vertex_shader_GetPrivateData(ID3D10VertexShader *iface,
|
||||||
|
@ -270,6 +285,9 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shader->device = &device->ID3D10Device1_iface;
|
||||||
|
ID3D10Device1_AddRef(shader->device);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -549,10 +549,10 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||||
0x00000000, 0x00000000,
|
0x00000000, 0x00000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ULONG refcount, expected_refcount;
|
||||||
ID3D10VertexShader *vs = NULL;
|
ID3D10VertexShader *vs = NULL;
|
||||||
ID3D10PixelShader *ps = NULL;
|
ID3D10PixelShader *ps = NULL;
|
||||||
ID3D10Device *device;
|
ID3D10Device *device, *tmp;
|
||||||
ULONG refcount;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (!(device = create_device()))
|
if (!(device = create_device()))
|
||||||
|
@ -561,10 +561,19 @@ float4 main(const float4 color : COLOR) : SV_TARGET
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expected_refcount = get_refcount((IUnknown *)device) + 1;
|
||||||
hr = ID3D10Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), &vs);
|
hr = ID3D10Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), &vs);
|
||||||
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
|
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
|
||||||
if (vs)
|
refcount = get_refcount((IUnknown *)device);
|
||||||
ID3D10VertexShader_Release(vs);
|
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
|
||||||
|
tmp = NULL;
|
||||||
|
expected_refcount = refcount + 1;
|
||||||
|
ID3D10VertexShader_GetDevice(vs, &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);
|
||||||
|
ID3D10VertexShader_Release(vs);
|
||||||
|
|
||||||
hr = ID3D10Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), &vs);
|
hr = ID3D10Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), &vs);
|
||||||
ok(hr == E_INVALIDARG, "Created a SM2 vertex shader, hr %#x\n", hr);
|
ok(hr == E_INVALIDARG, "Created a SM2 vertex shader, hr %#x\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue