Commit 73c6355d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Add a wined3d geoemtry shader to struct d3d10_geometry_shader.

parent 41401fb8
...@@ -168,9 +168,13 @@ struct d3d10_geometry_shader ...@@ -168,9 +168,13 @@ struct d3d10_geometry_shader
{ {
const struct ID3D10GeometryShaderVtbl *vtbl; const struct ID3D10GeometryShaderVtbl *vtbl;
LONG refcount; LONG refcount;
IWineD3DGeometryShader *wined3d_shader;
struct wined3d_shader_signature output_signature;
}; };
HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader); HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct d3d10_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
/* ID3D10PixelShader */ /* ID3D10PixelShader */
struct d3d10_pixel_shader struct d3d10_pixel_shader
......
...@@ -848,6 +848,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *i ...@@ -848,6 +848,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *i
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface, static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader) const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
{ {
struct d3d10_device *This = (struct d3d10_device *)iface;
struct d3d10_geometry_shader *object; struct d3d10_geometry_shader *object;
HRESULT hr; HRESULT hr;
...@@ -861,7 +862,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device ...@@ -861,7 +862,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hr = d3d10_geometry_shader_init(object); hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize geometry shader, hr %#x.\n", hr); WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
......
...@@ -313,7 +313,7 @@ static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_Release(ID3D10GeometryShade ...@@ -313,7 +313,7 @@ static ULONG STDMETHODCALLTYPE d3d10_geometry_shader_Release(ID3D10GeometryShade
if (!refcount) if (!refcount)
{ {
HeapFree(GetProcessHeap(), 0, This); IWineD3DGeometryShader_Release(This->wined3d_shader);
} }
return refcount; return refcount;
...@@ -365,11 +365,45 @@ static const struct ID3D10GeometryShaderVtbl d3d10_geometry_shader_vtbl = ...@@ -365,11 +365,45 @@ static const struct ID3D10GeometryShaderVtbl d3d10_geometry_shader_vtbl =
d3d10_geometry_shader_SetPrivateDataInterface, d3d10_geometry_shader_SetPrivateDataInterface,
}; };
HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader) static void STDMETHODCALLTYPE d3d10_geometry_shader_wined3d_object_destroyed(void *parent)
{ {
struct d3d10_geometry_shader *shader = parent;
shader_free_signature(&shader->output_signature);
HeapFree(GetProcessHeap(), 0, shader);
}
static const struct wined3d_parent_ops d3d10_geometry_shader_wined3d_parent_ops =
{
d3d10_geometry_shader_wined3d_object_destroyed,
};
HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct d3d10_device *device,
const void *byte_code, SIZE_T byte_code_length)
{
struct d3d10_shader_info shader_info;
HRESULT hr;
shader->vtbl = &d3d10_geometry_shader_vtbl; shader->vtbl = &d3d10_geometry_shader_vtbl;
shader->refcount = 1; shader->refcount = 1;
shader_info.output_signature = &shader->output_signature;
hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
if (FAILED(hr))
{
ERR("Failed to extract shader, hr %#x.\n", hr);
return hr;
}
hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader,
(IUnknown *)shader, &d3d10_geometry_shader_wined3d_parent_ops);
if (FAILED(hr))
{
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
shader_free_signature(&shader->output_signature);
return hr;
}
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