[PATCH 3/6] d3d11: Implement d3d11_immediate_context_GetData().
Józef Kucia
jkucia at codeweavers.com
Wed Jul 6 05:02:31 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/d3d11/d3d11_private.h | 1 +
dlls/d3d11/device.c | 22 ++++++++++++++++++++--
dlls/d3d11/utils.c | 11 +++++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 6fd5210..cdada42 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -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;
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;
struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 8bf8f0c..e0e12a1 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -520,10 +520,28 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_End(ID3D11DeviceContext *i
static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_GetData(ID3D11DeviceContext *iface,
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);
- 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,
diff --git a/dlls/d3d11/utils.c b/dlls/d3d11/utils.c
index 7b08d13..36cad41 100644
--- a/dlls/d3d11/utils.c
+++ b/dlls/d3d11/utils.c
@@ -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)
{
static const DWORD handled = D3D11_BIND_SHADER_RESOURCE
--
2.7.3
More information about the wine-patches
mailing list