Commit 7da86b43 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Implement d3d11_device_CreateGeometryShader().

parent d8f8194b
......@@ -251,8 +251,8 @@ struct d3d_geometry_shader
struct wined3d_shader *wined3d_shader;
};
HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
HRESULT d3d_geometry_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_geometry_shader **shader) DECLSPEC_HIDDEN;
struct d3d_geometry_shader *unsafe_impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface) DECLSPEC_HIDDEN;
/* ID3D11PixelShader, ID3D10PixelShader */
......
......@@ -215,10 +215,22 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateVertexShader(ID3D11Device *i
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShader(ID3D11Device *iface, const void *byte_code,
SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11GeometryShader **shader)
{
FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
struct d3d_device *device = impl_from_ID3D11Device(iface);
struct d3d_geometry_shader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
iface, byte_code, byte_code_length, class_linkage, shader);
return E_NOTIMPL;
if (class_linkage)
FIXME("Class linkage is not implemented yet.\n");
if (FAILED(hr = d3d_geometry_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
*shader = &object->ID3D11GeometryShader_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShaderWithStreamOutput(ID3D11Device *iface,
......@@ -2309,26 +2321,16 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device1 *
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device1 *iface,
const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
{
struct d3d_device *This = impl_from_ID3D10Device(iface);
struct d3d_device *device = impl_from_ID3D10Device(iface);
struct d3d_geometry_shader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
iface, byte_code, byte_code_length, shader);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
hr = d3d_geometry_shader_init(object, This, byte_code, byte_code_length);
if (FAILED(hr))
{
WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
if (FAILED(hr = d3d_geometry_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
}
TRACE("Created geometry shader %p.\n", object);
*shader = &object->ID3D10GeometryShader_iface;
return S_OK;
......
......@@ -654,7 +654,7 @@ static const struct wined3d_parent_ops d3d_geometry_shader_wined3d_parent_ops =
d3d_geometry_shader_wined3d_object_destroyed,
};
HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, struct d3d_device *device,
static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length)
{
struct wined3d_shader_signature output_signature;
......@@ -700,6 +700,28 @@ HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, struct d3d_
return S_OK;
}
HRESULT d3d_geometry_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_geometry_shader **shader)
{
struct d3d_geometry_shader *object;
HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_geometry_shader_init(object, device, byte_code, byte_code_length)))
{
WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created geometry shader %p.\n", object);
*shader = object;
return S_OK;
}
struct d3d_geometry_shader *unsafe_impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface)
{
if (!iface)
......
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