d3d11: Implement d3d11_buffer_GetDesc().
This commit is contained in:
parent
ca32deb0d2
commit
378bec23ef
|
@ -163,7 +163,11 @@ static UINT STDMETHODCALLTYPE d3d11_buffer_GetEvictionPriority(ID3D11Buffer *ifa
|
|||
|
||||
static void STDMETHODCALLTYPE d3d11_buffer_GetDesc(ID3D11Buffer *iface, D3D11_BUFFER_DESC *desc)
|
||||
{
|
||||
FIXME("iface %p, desc %p stub!\n", iface, desc);
|
||||
struct d3d_buffer *buffer = impl_from_ID3D11Buffer(iface);
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
*desc = buffer->desc;
|
||||
}
|
||||
|
||||
static const struct ID3D11BufferVtbl d3d11_buffer_vtbl =
|
||||
|
@ -364,7 +368,7 @@ static const struct wined3d_parent_ops d3d10_buffer_wined3d_parent_ops =
|
|||
};
|
||||
|
||||
HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *device,
|
||||
const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
|
||||
const D3D11_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
|
||||
{
|
||||
struct wined3d_buffer_desc wined3d_desc;
|
||||
HRESULT hr;
|
||||
|
@ -374,13 +378,17 @@ HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *device,
|
|||
buffer->refcount = 1;
|
||||
wined3d_mutex_lock();
|
||||
wined3d_private_store_init(&buffer->private_store);
|
||||
buffer->desc = *desc;
|
||||
|
||||
wined3d_desc.byte_width = desc->ByteWidth;
|
||||
wined3d_desc.usage = wined3d_usage_from_d3d10core(0, desc->Usage);
|
||||
wined3d_desc.usage = wined3d_usage_from_d3d11(0, desc->Usage);
|
||||
wined3d_desc.bind_flags = desc->BindFlags;
|
||||
wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
|
||||
wined3d_desc.misc_flags = desc->MiscFlags;
|
||||
|
||||
if (desc->StructureByteStride)
|
||||
FIXME("Ignoring structure byte stride %u.\n", desc->StructureByteStride);
|
||||
|
||||
if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &wined3d_desc,
|
||||
(const struct wined3d_sub_resource_data *)data, buffer,
|
||||
&d3d10_buffer_wined3d_parent_ops, &buffer->wined3d_buffer)))
|
||||
|
|
|
@ -63,7 +63,6 @@ const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
|||
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
|
||||
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_usage_from_d3d10core(UINT bind_flags, enum D3D10_USAGE usage) DECLSPEC_HIDDEN;
|
||||
struct wined3d_resource *wined3d_resource_from_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;
|
||||
DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -142,11 +141,12 @@ struct d3d_buffer
|
|||
|
||||
struct wined3d_private_store private_store;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
D3D11_BUFFER_DESC desc;
|
||||
ID3D11Device *device;
|
||||
};
|
||||
|
||||
HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *device,
|
||||
const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
|
||||
const D3D11_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
|
||||
struct d3d_buffer *unsafe_impl_from_ID3D10Buffer(ID3D10Buffer *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* ID3D10DepthStencilView */
|
||||
|
|
|
@ -1986,16 +1986,24 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device1 *iface,
|
|||
const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
|
||||
{
|
||||
struct d3d_device *This = impl_from_ID3D10Device(iface);
|
||||
D3D11_BUFFER_DESC d3d11_desc;
|
||||
struct d3d_buffer *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, desc %p, data %p, buffer %p.\n", iface, desc, data, buffer);
|
||||
|
||||
d3d11_desc.ByteWidth = desc->ByteWidth;
|
||||
d3d11_desc.Usage = d3d11_usage_from_d3d10_usage(desc->Usage);
|
||||
d3d11_desc.BindFlags = d3d11_bind_flags_from_d3d10_bind_flags(desc->BindFlags);
|
||||
d3d11_desc.CPUAccessFlags = d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(desc->CPUAccessFlags);
|
||||
d3d11_desc.MiscFlags = d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(desc->MiscFlags);
|
||||
d3d11_desc.StructureByteStride = 0;
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = d3d_buffer_init(object, This, desc, data);
|
||||
hr = d3d_buffer_init(object, This, &d3d11_desc, data);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize buffer, hr %#x.\n", hr);
|
||||
|
|
|
@ -367,13 +367,6 @@ DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage)
|
|||
return wined3d_usage;
|
||||
}
|
||||
|
||||
DWORD wined3d_usage_from_d3d10core(UINT bind_flags, enum D3D10_USAGE usage)
|
||||
{
|
||||
UINT d3d11_bind_flags = d3d11_bind_flags_from_d3d10_bind_flags(bind_flags);
|
||||
enum D3D11_USAGE d3d11_usage = d3d11_usage_from_d3d10_usage(usage);
|
||||
return wined3d_usage_from_d3d11(d3d11_bind_flags, d3d11_usage);
|
||||
}
|
||||
|
||||
enum D3D11_USAGE d3d11_usage_from_d3d10_usage(enum D3D10_USAGE usage)
|
||||
{
|
||||
switch (usage)
|
||||
|
|
Loading…
Reference in New Issue