wined3d: Allow passing compute states to device_invalidate_state().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-02-06 14:12:16 +01:00 committed by Alexandre Julliard
parent 5a093509d0
commit 8ac7c1faf2
3 changed files with 10 additions and 21 deletions

View file

@ -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)

View file

@ -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)
{

View file

@ -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)