From fcee1b709cd24184cc0c01973b8ee772236f7278 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 26 May 2009 09:15:12 +0200 Subject: [PATCH] d3d10core: Implement ID3D10Device::CreateVertexShader(). --- dlls/d3d10core/d3d10core_private.h | 3 +++ dlls/d3d10core/device.c | 25 ++++++++++++++++++++++++- dlls/d3d10core/shader.c | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 7600e232cc0..4828ab692b5 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -141,6 +141,9 @@ struct d3d10_vertex_shader { const struct ID3D10VertexShaderVtbl *vtbl; LONG refcount; + + IWineD3DVertexShader *wined3d_shader; + struct wined3d_shader_signature output_signature; }; /* ID3D10GeometryShader */ diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index bbc527b0b46..ce18eb71c73 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -970,9 +970,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *if static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface, const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader) { + struct d3d10_device *This = (struct d3d10_device *)iface; struct d3d10_vertex_shader *object; + struct d3d10_shader_info shader_info; + HRESULT hr; - FIXME("iface %p, byte_code %p, byte_code_length %lu, shader %p stub!\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)); @@ -985,6 +988,26 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *i object->vtbl = &d3d10_vertex_shader_vtbl; object->refcount = 1; + shader_info.output_signature = &object->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); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + hr = IWineD3DDevice_CreateVertexShader(This->wined3d_device, NULL, + shader_info.shader_code, &object->output_signature, + &object->wined3d_shader, (IUnknown *)object); + if (FAILED(hr)) + { + ERR("CreateVertexShader failed, hr %#x\n", hr); + shader_free_signature(&object->output_signature); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + *shader = (ID3D10VertexShader *)object; return S_OK; diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c index 41b5a1a55d6..582d2a88010 100644 --- a/dlls/d3d10core/shader.c +++ b/dlls/d3d10core/shader.c @@ -176,6 +176,8 @@ static ULONG STDMETHODCALLTYPE d3d10_vertex_shader_Release(ID3D10VertexShader *i if (!refcount) { + IWineD3DVertexShader_Release(This->wined3d_shader); + shader_free_signature(&This->output_signature); HeapFree(GetProcessHeap(), 0, This); } -- 2.11.4.GIT