[PATCH v2] wined3d: Pass a wined3d_device pointer to wined3d_from_cs().
Zebediah Figura
zfigura at codeweavers.com
Fri Jul 2 11:06:20 CDT 2021
From: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
v2: Remove an assertion from wined3d_cs_queue_is_empty().
dlls/wined3d/adapter_vk.c | 2 +-
dlls/wined3d/context_gl.c | 4 ++--
dlls/wined3d/cs.c | 1 -
dlls/wined3d/device.c | 2 +-
dlls/wined3d/directx.c | 2 +-
dlls/wined3d/swapchain.c | 2 +-
dlls/wined3d/wined3d_private.h | 8 ++++----
7 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index 850e2a6dfdb..d5001c1296b 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -541,7 +541,7 @@ static struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device
{
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
if (!device->context_count)
return NULL;
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 474003d7553..33cb76343cd 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -2295,7 +2295,7 @@ void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl)
TRACE("Destroying context %p.\n", context_gl);
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
/* We delay destroying a context when it is active. The context_release()
* function invokes wined3d_context_gl_destroy() again while leaving the
@@ -4229,7 +4229,7 @@ struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_g
return NULL;
device = context_gl->c.device;
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
if (context_gl->c.current_rt.texture)
{
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ce0417c9f71..c5fc8fbb7a6 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3047,7 +3047,6 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops =
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue)
{
- wined3d_from_cs(cs);
return *(volatile LONG *)&queue->head == queue->tail;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5a2a95ebe96..55879e546f2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5765,7 +5765,7 @@ void device_invalidate_state(const struct wined3d_device *device, unsigned int s
unsigned int representative, i, idx, shift;
struct wined3d_context *context;
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
if (STATE_IS_COMPUTE(state_id))
{
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a39c6d75750..b87efaddaff 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2694,7 +2694,7 @@ static struct wined3d_context *adapter_no3d_acquire_context(struct wined3d_devic
{
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
if (!device->context_count)
return NULL;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 693557448fe..fe1bcb3824a 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1783,7 +1783,7 @@ static struct wined3d_context_gl *wined3d_swapchain_gl_create_context(struct win
TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain_gl, GetCurrentThreadId());
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
if (!(context_gl = heap_alloc_zero(sizeof(*context_gl))))
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 80e03ad9212..36e1fa4ec7a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -6034,10 +6034,10 @@ static inline void wined3d_insert_bits(DWORD *bitstream,
}
}
-static inline void wined3d_from_cs(const struct wined3d_cs *cs)
+static inline void wined3d_from_cs(const struct wined3d_device *device)
{
- if (cs->thread)
- assert(cs->thread_id == GetCurrentThreadId());
+ if (device->cs->thread)
+ assert(device->cs->thread_id == GetCurrentThreadId());
}
static inline void wined3d_not_from_cs(const struct wined3d_device *device)
@@ -6103,7 +6103,7 @@ void compute_normal_matrix(float *normal_matrix, BOOL legacy_lighting,
static inline struct wined3d_context *context_acquire(struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx)
{
- wined3d_from_cs(device->cs);
+ wined3d_from_cs(device);
return device->adapter->adapter_ops->adapter_acquire_context(device, texture, sub_resource_idx);
}
--
2.30.2
More information about the wine-devel
mailing list