2009-03-04 07:07:38 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2009 Henri Verbeet for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2015-08-21 00:07:53 +02:00
|
|
|
#include "d3d11_private.h"
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2015-08-21 00:07:53 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-03-30 11:24:55 +02:00
|
|
|
static HRESULT isgn_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
|
|
|
|
{
|
2009-05-08 17:44:25 +02:00
|
|
|
struct wined3d_shader_signature *is = ctx;
|
2009-03-30 11:24:55 +02:00
|
|
|
|
2017-03-22 09:40:54 +01:00
|
|
|
if (tag != TAG_ISGN)
|
|
|
|
return S_OK;
|
2009-03-30 11:24:55 +02:00
|
|
|
|
2017-03-22 09:40:55 +01:00
|
|
|
if (is->elements)
|
|
|
|
{
|
|
|
|
FIXME("Multiple input signatures.\n");
|
|
|
|
shader_free_signature(is);
|
|
|
|
}
|
2017-03-22 09:40:54 +01:00
|
|
|
return shader_parse_signature(data, data_size, is);
|
2009-03-30 11:24:55 +02:00
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:44 +02:00
|
|
|
static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEMENT_DESC *element_descs,
|
2009-03-30 11:24:55 +02:00
|
|
|
UINT element_count, const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
2015-03-23 09:17:16 +01:00
|
|
|
struct wined3d_vertex_element **wined3d_elements)
|
2009-03-30 11:24:55 +02:00
|
|
|
{
|
2009-05-08 17:44:25 +02:00
|
|
|
struct wined3d_shader_signature is;
|
2016-08-21 23:17:58 +02:00
|
|
|
unsigned int i;
|
2009-03-30 11:24:55 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2017-03-22 09:40:55 +01:00
|
|
|
memset(&is, 0, sizeof(is));
|
2016-08-21 23:17:58 +02:00
|
|
|
if (FAILED(hr = parse_dxbc(shader_byte_code, shader_byte_code_length, isgn_handler, &is)))
|
2009-03-30 11:24:55 +02:00
|
|
|
{
|
|
|
|
ERR("Failed to parse input signature.\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2016-05-24 19:46:45 +02:00
|
|
|
if (!(*wined3d_elements = d3d11_calloc(element_count, sizeof(**wined3d_elements))))
|
2009-03-30 11:24:55 +02:00
|
|
|
{
|
|
|
|
ERR("Failed to allocate wined3d vertex element array memory.\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, is.elements);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < element_count; ++i)
|
|
|
|
{
|
2015-03-23 09:17:16 +01:00
|
|
|
struct wined3d_vertex_element *e = &(*wined3d_elements)[i];
|
2015-09-15 01:37:44 +02:00
|
|
|
const D3D11_INPUT_ELEMENT_DESC *f = &element_descs[i];
|
2017-03-23 12:15:49 +01:00
|
|
|
struct wined3d_shader_signature_element *element;
|
2009-03-30 11:24:55 +02:00
|
|
|
|
2015-03-23 09:17:16 +01:00
|
|
|
e->format = wined3dformat_from_dxgi_format(f->Format);
|
|
|
|
e->input_slot = f->InputSlot;
|
|
|
|
e->offset = f->AlignedByteOffset;
|
|
|
|
e->output_slot = WINED3D_OUTPUT_SLOT_UNUSED;
|
2015-03-24 09:38:23 +01:00
|
|
|
e->input_slot_class = f->InputSlotClass;
|
|
|
|
e->instance_data_step_rate = f->InstanceDataStepRate;
|
2015-03-23 09:17:16 +01:00
|
|
|
e->method = WINED3D_DECL_METHOD_DEFAULT;
|
|
|
|
e->usage = 0;
|
|
|
|
e->usage_idx = 0;
|
|
|
|
|
2017-03-23 12:15:49 +01:00
|
|
|
if ((element = shader_find_signature_element(&is, f->SemanticName, f->SemanticIndex)))
|
|
|
|
e->output_slot = element->register_idx;
|
|
|
|
else
|
2016-08-21 23:17:58 +02:00
|
|
|
WARN("Unused input element %u.\n", i);
|
2009-03-30 11:24:55 +02:00
|
|
|
}
|
|
|
|
|
2009-05-08 17:44:25 +02:00
|
|
|
shader_free_signature(&is);
|
2009-03-30 11:24:55 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
/* ID3D11InputLayout methods */
|
2015-09-15 01:37:42 +02:00
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
static inline struct d3d_input_layout *impl_from_ID3D11InputLayout(ID3D11InputLayout *iface)
|
2011-07-12 12:50:41 +02:00
|
|
|
{
|
2015-09-15 01:37:43 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d_input_layout, ID3D11InputLayout_iface);
|
2011-07-12 12:50:41 +02:00
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d11_input_layout_QueryInterface(ID3D11InputLayout *iface,
|
2009-03-04 07:07:38 +01:00
|
|
|
REFIID riid, void **object)
|
|
|
|
{
|
2015-09-15 01:37:43 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_ID3D11InputLayout)
|
|
|
|
|| IsEqualGUID(riid, &IID_ID3D11DeviceChild)
|
2009-03-04 07:07:38 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IUnknown))
|
|
|
|
{
|
2015-09-15 01:37:43 +02:00
|
|
|
ID3D11InputLayout_AddRef(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
*object = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
if (IsEqualGUID(riid, &IID_ID3D10InputLayout)
|
|
|
|
|| IsEqualGUID(riid, &IID_ID3D10DeviceChild))
|
|
|
|
{
|
|
|
|
ID3D10InputLayout_AddRef(&layout->ID3D10InputLayout_iface);
|
|
|
|
*object = &layout->ID3D10InputLayout_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
*object = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
static ULONG STDMETHODCALLTYPE d3d11_input_layout_AddRef(ID3D11InputLayout *iface)
|
2009-03-04 07:07:38 +01:00
|
|
|
{
|
2015-09-15 01:37:43 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
|
|
|
ULONG refcount = InterlockedIncrement(&layout->refcount);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
TRACE("%p increasing refcount to %u.\n", layout, refcount);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-09-23 10:05:52 +02:00
|
|
|
if (refcount == 1)
|
|
|
|
{
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_lock();
|
2015-09-15 01:37:43 +02:00
|
|
|
wined3d_vertex_declaration_incref(layout->wined3d_decl);
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_unlock();
|
2009-09-23 10:05:52 +02:00
|
|
|
}
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *iface)
|
2009-03-04 07:07:38 +01:00
|
|
|
{
|
2015-09-15 01:37:43 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
|
|
|
ULONG refcount = InterlockedDecrement(&layout->refcount);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", layout, refcount);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
if (!refcount)
|
|
|
|
{
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_lock();
|
2015-09-15 01:37:43 +02:00
|
|
|
wined3d_vertex_declaration_decref(layout->wined3d_decl);
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_unlock();
|
2009-03-04 07:07:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d11_input_layout_GetDevice(ID3D11InputLayout *iface,
|
|
|
|
ID3D11Device **device)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, device %p stub!\n", iface, device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d11_input_layout_GetPrivateData(ID3D11InputLayout *iface,
|
|
|
|
REFGUID guid, UINT *data_size, void *data)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
|
|
|
|
|
|
|
|
return d3d_get_private_data(&layout->private_store, guid, data_size, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d11_input_layout_SetPrivateData(ID3D11InputLayout *iface,
|
|
|
|
REFGUID guid, UINT data_size, const void *data)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
|
|
|
|
|
|
|
|
return d3d_set_private_data(&layout->private_store, guid, data_size, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d11_input_layout_SetPrivateDataInterface(ID3D11InputLayout *iface,
|
|
|
|
REFGUID guid, const IUnknown *data)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
|
|
|
|
|
|
|
|
return d3d_set_private_data_interface(&layout->private_store, guid, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct ID3D11InputLayoutVtbl d3d11_input_layout_vtbl =
|
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
d3d11_input_layout_QueryInterface,
|
|
|
|
d3d11_input_layout_AddRef,
|
|
|
|
d3d11_input_layout_Release,
|
|
|
|
/* ID3D11DeviceChild methods */
|
|
|
|
d3d11_input_layout_GetDevice,
|
|
|
|
d3d11_input_layout_GetPrivateData,
|
|
|
|
d3d11_input_layout_SetPrivateData,
|
|
|
|
d3d11_input_layout_SetPrivateDataInterface,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ID3D10InputLayout methods */
|
|
|
|
|
|
|
|
static inline struct d3d_input_layout *impl_from_ID3D10InputLayout(ID3D10InputLayout *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct d3d_input_layout, ID3D10InputLayout_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IUnknown methods */
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_input_layout_QueryInterface(ID3D10InputLayout *iface,
|
|
|
|
REFIID riid, void **object)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
|
|
|
|
|
|
|
|
return d3d11_input_layout_QueryInterface(&layout->ID3D11InputLayout_iface, riid, object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_input_layout_AddRef(ID3D10InputLayout *iface)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3d11_input_layout_AddRef(&layout->ID3D11InputLayout_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_input_layout_Release(ID3D10InputLayout *iface)
|
|
|
|
{
|
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3d11_input_layout_Release(&layout->ID3D11InputLayout_iface);
|
|
|
|
}
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
/* ID3D10DeviceChild methods */
|
|
|
|
|
|
|
|
static void STDMETHODCALLTYPE d3d10_input_layout_GetDevice(ID3D10InputLayout *iface, ID3D10Device **device)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, device %p stub!\n", iface, device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_input_layout_GetPrivateData(ID3D10InputLayout *iface,
|
|
|
|
REFGUID guid, UINT *data_size, void *data)
|
|
|
|
{
|
2015-09-15 01:37:42 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
2015-02-25 09:34:10 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data_size %p, data %p.\n",
|
2009-03-04 07:07:38 +01:00
|
|
|
iface, debugstr_guid(guid), data_size, data);
|
|
|
|
|
2015-09-03 00:06:50 +02:00
|
|
|
return d3d_get_private_data(&layout->private_store, guid, data_size, data);
|
2009-03-04 07:07:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_input_layout_SetPrivateData(ID3D10InputLayout *iface,
|
|
|
|
REFGUID guid, UINT data_size, const void *data)
|
|
|
|
{
|
2015-09-15 01:37:42 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
2015-02-25 09:34:08 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data_size %u, data %p.\n",
|
2009-03-04 07:07:38 +01:00
|
|
|
iface, debugstr_guid(guid), data_size, data);
|
|
|
|
|
2015-09-03 00:06:50 +02:00
|
|
|
return d3d_set_private_data(&layout->private_store, guid, data_size, data);
|
2009-03-04 07:07:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_input_layout_SetPrivateDataInterface(ID3D10InputLayout *iface,
|
|
|
|
REFGUID guid, const IUnknown *data)
|
|
|
|
{
|
2015-09-15 01:37:42 +02:00
|
|
|
struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2015-02-25 09:34:09 +01:00
|
|
|
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
|
|
|
|
|
2015-09-03 00:06:50 +02:00
|
|
|
return d3d_set_private_data_interface(&layout->private_store, guid, data);
|
2009-03-04 07:07:38 +01:00
|
|
|
}
|
|
|
|
|
2009-09-23 10:05:48 +02:00
|
|
|
static const struct ID3D10InputLayoutVtbl d3d10_input_layout_vtbl =
|
2009-03-04 07:07:38 +01:00
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
d3d10_input_layout_QueryInterface,
|
|
|
|
d3d10_input_layout_AddRef,
|
|
|
|
d3d10_input_layout_Release,
|
|
|
|
/* ID3D10DeviceChild methods */
|
|
|
|
d3d10_input_layout_GetDevice,
|
|
|
|
d3d10_input_layout_GetPrivateData,
|
|
|
|
d3d10_input_layout_SetPrivateData,
|
|
|
|
d3d10_input_layout_SetPrivateDataInterface,
|
|
|
|
};
|
2009-09-23 10:05:48 +02:00
|
|
|
|
2015-09-15 01:37:42 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d_input_layout_wined3d_object_destroyed(void *parent)
|
2009-09-23 10:05:52 +02:00
|
|
|
{
|
2015-09-15 01:37:42 +02:00
|
|
|
struct d3d_input_layout *layout = parent;
|
2015-02-25 09:34:08 +01:00
|
|
|
|
|
|
|
wined3d_private_store_cleanup(&layout->private_store);
|
2009-09-23 10:05:52 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, parent);
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:42 +02:00
|
|
|
static const struct wined3d_parent_ops d3d_input_layout_wined3d_parent_ops =
|
2009-09-23 10:05:52 +02:00
|
|
|
{
|
2015-09-15 01:37:42 +02:00
|
|
|
d3d_input_layout_wined3d_object_destroyed,
|
2009-09-23 10:05:52 +02:00
|
|
|
};
|
|
|
|
|
2015-09-15 01:37:44 +02:00
|
|
|
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,
|
2009-09-23 10:05:48 +02:00
|
|
|
const void *shader_byte_code, SIZE_T shader_byte_code_length)
|
|
|
|
{
|
2011-11-24 22:52:36 +01:00
|
|
|
struct wined3d_vertex_element *wined3d_elements;
|
2009-09-23 10:05:48 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2015-09-15 01:37:43 +02:00
|
|
|
layout->ID3D11InputLayout_iface.lpVtbl = &d3d11_input_layout_vtbl;
|
2011-07-12 12:51:54 +02:00
|
|
|
layout->ID3D10InputLayout_iface.lpVtbl = &d3d10_input_layout_vtbl;
|
2009-09-23 10:05:48 +02:00
|
|
|
layout->refcount = 1;
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_lock();
|
2015-02-25 09:34:08 +01:00
|
|
|
wined3d_private_store_init(&layout->private_store);
|
2009-09-23 10:05:48 +02:00
|
|
|
|
2015-09-15 01:37:44 +02:00
|
|
|
if (FAILED(hr = d3d11_input_layout_to_wined3d_declaration(element_descs, element_count,
|
2015-03-23 09:17:16 +01:00
|
|
|
shader_byte_code, shader_byte_code_length, &wined3d_elements)))
|
2009-09-23 10:05:48 +02:00
|
|
|
{
|
|
|
|
WARN("Failed to create wined3d vertex declaration elements, hr %#x.\n", hr);
|
2015-02-25 09:34:08 +01:00
|
|
|
wined3d_private_store_cleanup(&layout->private_store);
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_unlock();
|
2009-09-23 10:05:48 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2015-03-23 09:17:16 +01:00
|
|
|
hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, element_count,
|
2015-09-15 01:37:42 +02:00
|
|
|
layout, &d3d_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
|
2009-09-23 10:05:48 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, wined3d_elements);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
|
2015-02-25 09:34:08 +01:00
|
|
|
wined3d_private_store_cleanup(&layout->private_store);
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_unlock();
|
2009-09-23 10:05:48 +02:00
|
|
|
return hr;
|
|
|
|
}
|
2015-08-12 17:37:08 +02:00
|
|
|
wined3d_mutex_unlock();
|
2009-09-23 10:05:48 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2011-07-12 12:50:41 +02:00
|
|
|
|
2015-09-15 01:37:44 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-10-14 02:08:12 +02:00
|
|
|
struct d3d_input_layout *unsafe_impl_from_ID3D11InputLayout(ID3D11InputLayout *iface)
|
|
|
|
{
|
|
|
|
if (!iface)
|
|
|
|
return NULL;
|
|
|
|
assert(iface->lpVtbl == &d3d11_input_layout_vtbl);
|
|
|
|
|
|
|
|
return impl_from_ID3D11InputLayout(iface);
|
|
|
|
}
|
|
|
|
|
2015-09-15 01:37:42 +02:00
|
|
|
struct d3d_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface)
|
2011-07-12 12:50:41 +02:00
|
|
|
{
|
|
|
|
if (!iface)
|
|
|
|
return NULL;
|
|
|
|
assert(iface->lpVtbl == &d3d10_input_layout_vtbl);
|
|
|
|
|
|
|
|
return impl_from_ID3D10InputLayout(iface);
|
|
|
|
}
|