=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Allow passing compute states to device_invalidate_state().
Alexandre Julliard
julliard at winehq.org
Tue Feb 7 16:02:29 CST 2017
Module: wine
Branch: master
Commit: 8ac7c1faf20208e2e71fac9e8e17c824fd1e8285
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8ac7c1faf20208e2e71fac9e8e17c824fd1e8285
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Mon Feb 6 14:12:16 2017 +0100
wined3d: Allow passing compute states to device_invalidate_state().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 d575159..422f3f1 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 71bb929..03d4069 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 ca992b9..3a0de2a 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)
More information about the wine-cvs
mailing list