wined3d-Accounting: Do not use context on the main thread.

This commit is contained in:
Sebastian Lackner 2017-04-17 00:43:21 +02:00
parent c9b2336f64
commit 10837badd4

View File

@ -1,17 +1,19 @@
From 2a8c68c26efe1070dec94a6a5ccba281311756b7 Mon Sep 17 00:00:00 2001
From 6b03eab427e44e8cc3dde2b2cb5f84a515039e59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 6 Jun 2015 06:53:34 +0200
Subject: wined3d: Use real values for memory accounting on NVIDIA cards.
FIXME: Reimplement wined3d_device_get_available_texture_mem
without using the context on the main thread.
---
dlls/d3d9/tests/device.c | 11 +++++++----
dlls/wined3d/device.c | 23 +++++++++++++++++++++++
dlls/wined3d/device.c | 25 +++++++++++++++++++++++++
dlls/wined3d/directx.c | 10 ++++++++++
dlls/wined3d/wined3d_gl.h | 1 +
4 files changed, 41 insertions(+), 4 deletions(-)
4 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 5aba575cc38..894b3324f90 100644
index 4da1653e9b..c50ada88e4 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -9063,10 +9063,13 @@ static void test_vidmem_accounting(void)
@ -33,18 +35,19 @@ index 5aba575cc38..894b3324f90 100644
for (i = 0; i < sizeof(textures) / sizeof(*textures); i++)
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a7ee5bc099d..5b74a2b7b6c 100644
index 7e90be55c4..eb66f06307 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1258,8 +1258,31 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
@@ -1271,8 +1271,33 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
{
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+ /* const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; */
+
TRACE("device %p.\n", device);
+ /* We can not acquire the context unless there is a swapchain. */
+ /*
+ if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] &&
+ !wined3d_settings.emulated_textureram)
+ {
@ -64,15 +67,16 @@ index a7ee5bc099d..5b74a2b7b6c 100644
+ vram_free = min(vram_free, device->adapter->vram_bytes - device->adapter->vram_bytes_used);
+ return min(UINT_MAX, vram_free);
+ }
+ */
+
TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n",
wine_dbgstr_longlong(device->adapter->vram_bytes),
wine_dbgstr_longlong(device->adapter->vram_bytes_used),
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 0f44e09e839..a213e2a5327 100644
index b5a8e47a6a..0de69aaa84 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -250,6 +250,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
@@ -258,6 +258,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2 },
{"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION },
{"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3 },
@ -80,7 +84,7 @@ index 0f44e09e839..a213e2a5327 100644
/* SGI */
{"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP },
@@ -1516,6 +1517,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_
@@ -1568,6 +1569,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_
TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
vendor, device, wine_dbgstr_longlong(*vram_bytes));
}
@ -97,10 +101,10 @@ index 0f44e09e839..a213e2a5327 100644
if (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE)
{
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index e500df65635..06252d5711f 100644
index 6e92552edd..ea38628c3c 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -180,6 +180,7 @@ enum wined3d_gl_extension
@@ -188,6 +188,7 @@ enum wined3d_gl_extension
NV_VERTEX_PROGRAM2,
NV_VERTEX_PROGRAM2_OPTION,
NV_VERTEX_PROGRAM3,
@ -109,5 +113,5 @@ index e500df65635..06252d5711f 100644
SGIS_GENERATE_MIPMAP,
/* WGL extensions */
--
2.11.0
2.12.2