d3d11: Implement d3d11_device_CreateInputLayout().
This commit is contained in:
parent
8361963f7b
commit
1cb181668e
|
@ -218,9 +218,10 @@ struct d3d_input_layout
|
|||
struct wined3d_vertex_declaration *wined3d_decl;
|
||||
};
|
||||
|
||||
HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d_device *device,
|
||||
const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
||||
const void *shader_byte_code, SIZE_T shader_byte_code_length) DECLSPEC_HIDDEN;
|
||||
HRESULT d3d_input_layout_create(struct d3d_device *device,
|
||||
const D3D11_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
||||
const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
||||
struct d3d_input_layout **layout) DECLSPEC_HIDDEN;
|
||||
struct d3d_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* ID3D10VertexShader */
|
||||
|
|
|
@ -179,11 +179,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateInputLayout(ID3D11Device *if
|
|||
const D3D11_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
|
||||
SIZE_T shader_byte_code_length, ID3D11InputLayout **input_layout)
|
||||
{
|
||||
FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p, shader_byte_code_length %lu, "
|
||||
"input_layout %p stub!\n", iface, element_descs, element_count, shader_byte_code,
|
||||
struct d3d_device *device = impl_from_ID3D11Device(iface);
|
||||
struct d3d_input_layout *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p, shader_byte_code_length %lu, "
|
||||
"input_layout %p.\n", iface, element_descs, element_count, shader_byte_code,
|
||||
shader_byte_code_length, input_layout);
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (FAILED(hr = d3d_input_layout_create(device, element_descs, element_count,
|
||||
shader_byte_code, shader_byte_code_length, &object)))
|
||||
return hr;
|
||||
|
||||
*input_layout = &object->ID3D11InputLayout_iface;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateVertexShader(ID3D11Device *iface, const void *byte_code,
|
||||
|
@ -2206,7 +2216,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device1 *i
|
|||
const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
||||
ID3D10InputLayout **input_layout)
|
||||
{
|
||||
struct d3d_device *This = impl_from_ID3D10Device(iface);
|
||||
struct d3d_device *device = impl_from_ID3D10Device(iface);
|
||||
struct d3d_input_layout *object;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -2215,20 +2225,10 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device1 *i
|
|||
iface, element_descs, element_count, shader_byte_code,
|
||||
shader_byte_code_length, input_layout);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = d3d_input_layout_init(object, This, element_descs, element_count,
|
||||
shader_byte_code, shader_byte_code_length);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize input layout, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
if (FAILED(hr = d3d_input_layout_create(device, (const D3D11_INPUT_ELEMENT_DESC *)element_descs, element_count,
|
||||
shader_byte_code, shader_byte_code_length, &object)))
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("Created input layout %p.\n", object);
|
||||
*input_layout = &object->ID3D10InputLayout_iface;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -39,7 +39,7 @@ static HRESULT isgn_handler(const char *data, DWORD data_size, DWORD tag, void *
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEMENT_DESC *element_descs,
|
||||
static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEMENT_DESC *element_descs,
|
||||
UINT element_count, const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
||||
struct wined3d_vertex_element **wined3d_elements)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEME
|
|||
for (i = 0; i < element_count; ++i)
|
||||
{
|
||||
struct wined3d_vertex_element *e = &(*wined3d_elements)[i];
|
||||
const D3D10_INPUT_ELEMENT_DESC *f = &element_descs[i];
|
||||
const D3D11_INPUT_ELEMENT_DESC *f = &element_descs[i];
|
||||
UINT j;
|
||||
|
||||
e->format = wined3dformat_from_dxgi_format(f->Format);
|
||||
|
@ -316,8 +316,8 @@ static const struct wined3d_parent_ops d3d_input_layout_wined3d_parent_ops =
|
|||
d3d_input_layout_wined3d_object_destroyed,
|
||||
};
|
||||
|
||||
HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d_device *device,
|
||||
const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
||||
static HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d_device *device,
|
||||
const D3D11_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
||||
const void *shader_byte_code, SIZE_T shader_byte_code_length)
|
||||
{
|
||||
struct wined3d_vertex_element *wined3d_elements;
|
||||
|
@ -329,7 +329,7 @@ HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d_device
|
|||
wined3d_mutex_lock();
|
||||
wined3d_private_store_init(&layout->private_store);
|
||||
|
||||
if (FAILED(hr = d3d10_input_layout_to_wined3d_declaration(element_descs, element_count,
|
||||
if (FAILED(hr = d3d11_input_layout_to_wined3d_declaration(element_descs, element_count,
|
||||
shader_byte_code, shader_byte_code_length, &wined3d_elements)))
|
||||
{
|
||||
WARN("Failed to create wined3d vertex declaration elements, hr %#x.\n", hr);
|
||||
|
@ -353,6 +353,32 @@ HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d_device
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT d3d_input_layout_create(struct d3d_device *device,
|
||||
const D3D11_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
||||
const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
||||
struct d3d_input_layout **layout)
|
||||
{
|
||||
struct d3d_input_layout *object;
|
||||
HRESULT hr;
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(hr = d3d_input_layout_init(object, device, element_descs, element_count,
|
||||
shader_byte_code, shader_byte_code_length)))
|
||||
{
|
||||
WARN("Failed to initialize input layout, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("Created input layout %p.\n", object);
|
||||
*layout = object;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
struct d3d_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface)
|
||||
{
|
||||
if (!iface)
|
||||
|
|
Loading…
Reference in New Issue