From 8ac7c1faf20208e2e71fac9e8e17c824fd1e8285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 6 Feb 2017 14:12:16 +0100 Subject: [PATCH] wined3d: Allow passing compute states to device_invalidate_state(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/cs.c | 13 ++----------- dlls/wined3d/device.c | 16 +++++++--------- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index d57515944e2..422f3f1e5df 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -907,10 +907,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi if (prev) InterlockedDecrement(&prev->resource.bind_count); - if (op->type != WINED3D_SHADER_TYPE_COMPUTE) - device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); - else - device_invalidate_compute_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); + device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, @@ -1097,15 +1094,9 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) const struct wined3d_cs_set_shader *op = data; cs->state.shader[op->type] = op->shader; + device_invalidate_state(cs->device, STATE_SHADER(op->type)); if (op->type != WINED3D_SHADER_TYPE_COMPUTE) - { - device_invalidate_state(cs->device, STATE_SHADER(op->type)); device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); - } - else - { - device_invalidate_compute_state(cs->device, STATE_SHADER(op->type)); - } } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 71bb9299b45..03d4069857f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5092,7 +5092,6 @@ err: return hr; } - void device_invalidate_state(const struct wined3d_device *device, DWORD state) { DWORD rep = device->StateTable[state].representative; @@ -5101,6 +5100,13 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) BYTE shift; UINT i; + if (STATE_IS_COMPUTE(state)) + { + for (i = 0; i < device->context_count; ++i) + context_invalidate_compute_state(device->contexts[i], state); + return; + } + for (i = 0; i < device->context_count; ++i) { context = device->contexts[i]; @@ -5113,14 +5119,6 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) } } -void device_invalidate_compute_state(const struct wined3d_device *device, DWORD state_id) -{ - unsigned int i; - - for (i = 0; i < device->context_count; ++i) - context_invalidate_compute_state(device->contexts[i], state_id); -} - LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ca992b94081..3a0de2a9fbb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1443,6 +1443,7 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN; #define STATE_COMPUTE_HIGHEST (STATE_COMPUTE_CONSTANT_BUFFER) #define STATE_HIGHEST (STATE_COMPUTE_CONSTANT_BUFFER) +#define STATE_IS_COMPUTE(a) ((a) >= STATE_COMPUTE_OFFSET && (a) <= STATE_COMPUTE_HIGHEST) #define STATE_COMPUTE_COUNT (STATE_COMPUTE_HIGHEST - STATE_COMPUTE_OFFSET + 1) #define STATE_SHADER(a) ((a) != WINED3D_SHADER_TYPE_COMPUTE ? STATE_GRAPHICS_SHADER(a) : STATE_COMPUTE_SHADER) @@ -2651,7 +2652,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; -void device_invalidate_compute_state(const struct wined3d_device *device, DWORD state_id) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)