Commit 70fdfdb1 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Implement d3d11_device_CreateVertexShader().

parent 32892beb
......@@ -236,8 +236,8 @@ struct d3d_vertex_shader
ID3D11Device *device;
};
HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
HRESULT d3d_vertex_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_vertex_shader **shader) DECLSPEC_HIDDEN;
struct d3d_vertex_shader *unsafe_impl_from_ID3D10VertexShader(ID3D10VertexShader *iface) DECLSPEC_HIDDEN;
/* ID3D10GeometryShader */
......
......@@ -199,10 +199,22 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateInputLayout(ID3D11Device *if
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateVertexShader(ID3D11Device *iface, const void *byte_code,
SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11VertexShader **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_vertex_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_vertex_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
*shader = &object->ID3D11VertexShader_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShader(ID3D11Device *iface, const void *byte_code,
......@@ -2237,26 +2249,16 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device1 *i
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device1 *iface,
const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
{
struct d3d_device *This = impl_from_ID3D10Device(iface);
struct d3d_device *device = impl_from_ID3D10Device(iface);
struct d3d_vertex_shader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
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_vertex_shader_init(object, This, byte_code, byte_code_length);
if (FAILED(hr))
{
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
if (FAILED(hr = d3d_vertex_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
}
TRACE("Created vertex shader %p.\n", object);
*shader = &object->ID3D10VertexShader_iface;
return S_OK;
......
......@@ -359,7 +359,7 @@ static const struct wined3d_parent_ops d3d_vertex_shader_wined3d_parent_ops =
d3d_vertex_shader_wined3d_object_destroyed,
};
HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d3d_device *device,
static HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length)
{
struct wined3d_shader_signature output_signature;
......@@ -408,6 +408,28 @@ HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d3d_devi
return S_OK;
}
HRESULT d3d_vertex_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_vertex_shader **shader)
{
struct d3d_vertex_shader *object;
HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_vertex_shader_init(object, device, byte_code, byte_code_length)))
{
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created vertex shader %p.\n", object);
*shader = object;
return S_OK;
}
struct d3d_vertex_shader *unsafe_impl_from_ID3D10VertexShader(ID3D10VertexShader *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