From: Aida JonikienÄ— aidas957@gmail.com
--- dlls/wined3d/context_gl.c | 2 +- dlls/wined3d/device.c | 2 +- dlls/wined3d/directx.c | 4 +--- dlls/wined3d/swapchain.c | 2 +- dlls/wined3d/wined3d_private.h | 13 ++++++++++--- 5 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 6b606617f3d..af3d4326608 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2297,7 +2297,7 @@ void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl)
TRACE("Destroying context %p.\n", context_gl);
- wined3d_from_cs(device->cs); + if (!wined3d_from_cs(device->cs)) return;
/* We delay destroying a context when it is active. The context_release() * function invokes wined3d_context_gl_destroy() again while leaving the diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0fb71108b27..770e3cfd53a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5563,7 +5563,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); + if (!wined3d_from_cs(device->cs)) return;
if (STATE_IS_COMPUTE(state_id)) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index f236a59f963..75644133ace 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2908,9 +2908,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); - - if (!device->context_count) + if (!wined3d_from_cs(device->cs) || !device->context_count) return NULL;
return &wined3d_device_no3d(device)->context_no3d; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 6b2ad8d6954..78abf283a22 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1766,7 +1766,7 @@ static struct wined3d_context_gl *wined3d_swapchain_gl_create_context(struct win
TRACE("Creating a new context for swapchain %p, thread %lu.\n", swapchain_gl, GetCurrentThreadId());
- wined3d_from_cs(device->cs); + if (!wined3d_from_cs(device->cs)) return NULL;
if (!(context_gl = calloc(1, sizeof(*context_gl)))) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index eff2400fd8f..9b2b354b5d1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4660,10 +4660,17 @@ static inline void wined3d_insert_bits(uint32_t *bitstream, } }
-static inline void wined3d_from_cs(const struct wined3d_cs *cs) +static inline BOOL wined3d_from_cs(const struct wined3d_cs *cs) { if (cs->thread) - assert(cs->thread_id == GetCurrentThreadId()); + { + if (cs->thread_id == GetCurrentThreadId()) + return TRUE; + else + return FALSE; + } + + return TRUE; }
static inline void wined3d_not_from_cs(const struct wined3d_cs *cs) @@ -4730,7 +4737,7 @@ void compute_normal_matrix(struct wined3d_matrix *normal_matrix, BOOL legacy_lig 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); + if (!wined3d_from_cs(device->cs)) return NULL;
return device->adapter->adapter_ops->adapter_acquire_context(device, texture, sub_resource_idx); }