d3d11: Implement d3d11_immediate_context_GetData().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-07-06 12:02:31 +02:00 committed by Alexandre Julliard
parent 0f6c5444c5
commit 882a8f2b18
3 changed files with 32 additions and 2 deletions

View file

@ -57,6 +57,7 @@ const char *debug_float4(const float *values) DECLSPEC_HIDDEN;
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id 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; enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags) DECLSPEC_HIDDEN;
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN; DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;

View file

@ -520,10 +520,28 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_End(ID3D11DeviceContext *i
static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_GetData(ID3D11DeviceContext *iface, static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_GetData(ID3D11DeviceContext *iface,
ID3D11Asynchronous *asynchronous, void *data, UINT data_size, UINT data_flags) ID3D11Asynchronous *asynchronous, void *data, UINT data_size, UINT data_flags)
{ {
FIXME("iface %p, asynchronous %p, data %p, data_size %u, data_flags %#x stub!\n", struct d3d_query *query = unsafe_impl_from_ID3D11Asynchronous(asynchronous);
unsigned int wined3d_flags;
HRESULT hr;
TRACE("iface %p, asynchronous %p, data %p, data_size %u, data_flags %#x.\n",
iface, asynchronous, data, data_size, data_flags); iface, asynchronous, data, data_size, data_flags);
return E_NOTIMPL; wined3d_flags = wined3d_getdata_flags_from_d3d11_async_getdata_flags(data_flags);
wined3d_mutex_lock();
if (!data_size || wined3d_query_get_data_size(query->wined3d_query) == data_size)
{
hr = wined3d_query_get_data(query->wined3d_query, data, data_size, wined3d_flags);
}
else
{
WARN("Invalid data size %u.\n", data_size);
hr = E_INVALIDARG;
}
wined3d_mutex_unlock();
return hr;
} }
static void STDMETHODCALLTYPE d3d11_immediate_context_SetPredication(ID3D11DeviceContext *iface, static void STDMETHODCALLTYPE d3d11_immediate_context_SetPredication(ID3D11DeviceContext *iface,

View file

@ -374,6 +374,17 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format)
} }
} }
unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags)
{
if (d3d11_flags & ~D3D11_ASYNC_GETDATA_DONOTFLUSH)
FIXME("Unhandled async getdata flags %#x.\n", d3d11_flags);
if (d3d11_flags & D3D11_ASYNC_GETDATA_DONOTFLUSH)
return 0;
return WINED3DGETDATA_FLUSH;
}
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage)
{ {
static const DWORD handled = D3D11_BIND_SHADER_RESOURCE static const DWORD handled = D3D11_BIND_SHADER_RESOURCE