wined3d: Introduce wined3d_device_set_cs_resource_view().

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-22 13:19:30 +01:00 committed by Alexandre Julliard
parent 87bf26c344
commit a16a4931b6
9 changed files with 53 additions and 15 deletions

View File

@ -1065,7 +1065,9 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons
InterlockedDecrement(&prev->resource->bind_count);
if (op->type != WINED3D_SHADER_TYPE_COMPUTE)
device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING);
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type,
@ -1117,7 +1119,10 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
const struct wined3d_cs_set_sampler *op = data;
cs->state.sampler[op->type][op->sampler_idx] = op->sampler;
device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING);
if (op->type != WINED3D_SHADER_TYPE_COMPUTE)
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
@ -1141,7 +1146,9 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *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_RESOURCE_BINDING);
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)

View File

@ -2745,6 +2745,14 @@ void CDECL wined3d_device_set_cs_cb(struct wined3d_device *device, unsigned int
wined3d_device_set_constant_buffer(device, WINED3D_SHADER_TYPE_COMPUTE, idx, buffer);
}
void CDECL wined3d_device_set_cs_resource_view(struct wined3d_device *device,
unsigned int idx, struct wined3d_shader_resource_view *view)
{
TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_COMPUTE, idx, view);
}
static void wined3d_device_set_pipeline_unordered_access_view(struct wined3d_device *device,
enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav)
{

View File

@ -4983,6 +4983,13 @@ static void state_shader_resource_binding(struct wined3d_context *context,
context->update_shader_resource_bindings = 1;
}
static void state_cs_resource_binding(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id)
{
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
context->update_compute_shader_resource_bindings = 1;
}
static void state_uav_binding(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id)
{
@ -5012,9 +5019,10 @@ const struct StateEntryTemplate misc_state_template[] =
{ STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL), { STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL), state_cb_warn, }, WINED3D_GL_EXT_NONE },
{ STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), { STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), state_cb, }, ARB_UNIFORM_BUFFER_OBJECT },
{ STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), { STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), state_cb_warn, }, WINED3D_GL_EXT_NONE },
{ STATE_SHADER_RESOURCE_BINDING, { STATE_SHADER_RESOURCE_BINDING, state_shader_resource_binding}, WINED3D_GL_EXT_NONE },
{ STATE_GRAPHICS_SHADER_RESOURCE_BINDING, { STATE_GRAPHICS_SHADER_RESOURCE_BINDING, state_shader_resource_binding}, WINED3D_GL_EXT_NONE },
{ STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, { STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, state_uav_binding }, ARB_SHADER_IMAGE_LOAD_STORE },
{ STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, { STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, state_uav_warn }, WINED3D_GL_EXT_NONE },
{ STATE_COMPUTE_SHADER_RESOURCE_BINDING, { STATE_COMPUTE_SHADER_RESOURCE_BINDING, state_cs_resource_binding}, WINED3D_GL_EXT_NONE },
{ STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, { STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, state_cs_uav_binding}, ARB_SHADER_IMAGE_LOAD_STORE },
{ STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, { STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, state_uav_warn }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_SRCBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
@ -5994,7 +6002,10 @@ static void validate_state_table(struct StateEntry *state_table)
STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY),
STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL),
STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE),
STATE_SHADER_RESOURCE_BINDING,
STATE_COMPUTE_SHADER_RESOURCE_BINDING,
STATE_GRAPHICS_SHADER_RESOURCE_BINDING,
STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING,
STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING,
STATE_VIEWPORT,
STATE_LIGHT_TYPE,
STATE_SCISSORRECT,

View File

@ -823,7 +823,8 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
}
/* FIXME: Ideally we'd only do this when touching a binding that's used by
* a shader. */
context_invalidate_state(context, STATE_SHADER_RESOURCE_BINDING);
context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
wined3d_texture_bind(texture, context, srgb);
}

View File

@ -4374,8 +4374,10 @@ const char *debug_d3dstate(DWORD state)
return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(WINED3D_SHADER_TYPE_COMPUTE));
if (STATE_IS_GRAPHICS_CONSTANT_BUFFER(state))
return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(state - STATE_CONSTANT_BUFFER(0)));
if (STATE_IS_SHADER_RESOURCE_BINDING(state))
return "STATE_SHADER_RESOURCE_BINDING";
if (STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(state))
return "STATE_COMPUTE_SHADER_RESOURCE_BINDING";
if (STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(state))
return "STATE_GRAPHICS_SHADER_RESOURCE_BINDING";
if (STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(state))
return "STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING";
if (STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(state))

View File

@ -123,7 +123,8 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
gl_info->gl_ops.gl.p_glTexParameteri(view->target, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_STENCIL_INDEX);
checkGLcall("Initialize stencil view");
context_invalidate_state(context, STATE_SHADER_RESOURCE_BINDING);
context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
}
context_release(context);
@ -172,7 +173,8 @@ static void create_buffer_texture(struct wined3d_gl_view *view,
}
checkGLcall("Create buffer texture");
context_invalidate_state(context, STATE_SHADER_RESOURCE_BINDING);
context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
context_release(context);
}

View File

@ -112,6 +112,7 @@
@ cdecl wined3d_device_set_clip_status(ptr ptr)
@ cdecl wined3d_device_set_compute_shader(ptr ptr)
@ cdecl wined3d_device_set_cs_cb(ptr long ptr)
@ cdecl wined3d_device_set_cs_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_cs_uav(ptr long ptr)
@ cdecl wined3d_device_set_cursor_position(ptr long long long)
@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr long)

View File

@ -1393,10 +1393,10 @@ enum wined3d_pipeline
((a) >= STATE_GRAPHICS_CONSTANT_BUFFER(0) \
&& (a) < STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
#define STATE_SHADER_RESOURCE_BINDING (STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
#define STATE_IS_SHADER_RESOURCE_BINDING(a) ((a) == STATE_SHADER_RESOURCE_BINDING)
#define STATE_GRAPHICS_SHADER_RESOURCE_BINDING (STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
#define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a) ((a) == STATE_GRAPHICS_SHADER_RESOURCE_BINDING)
#define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING (STATE_SHADER_RESOURCE_BINDING + 1)
#define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING (STATE_GRAPHICS_SHADER_RESOURCE_BINDING + 1)
#define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING)
#define STATE_TRANSFORM(a) (STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING + (a))
@ -1453,7 +1453,10 @@ enum wined3d_pipeline
#define STATE_COMPUTE_CONSTANT_BUFFER (STATE_COMPUTE_SHADER + 1)
#define STATE_IS_COMPUTE_CONSTANT_BUFFER(a) ((a) == STATE_COMPUTE_CONSTANT_BUFFER)
#define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING (STATE_COMPUTE_CONSTANT_BUFFER + 1)
#define STATE_COMPUTE_SHADER_RESOURCE_BINDING (STATE_COMPUTE_CONSTANT_BUFFER + 1)
#define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a) ((a) == STATE_COMPUTE_SHADER_RESOURCE_BINDING)
#define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING (STATE_COMPUTE_SHADER_RESOURCE_BINDING + 1)
#define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
#define STATE_COMPUTE_HIGHEST (STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
@ -1608,11 +1611,12 @@ struct wined3d_context
DWORD hdc_is_private : 1;
DWORD hdc_has_format : 1; /* only meaningful if hdc_is_private */
DWORD update_shader_resource_bindings : 1;
DWORD update_compute_shader_resource_bindings : 1;
DWORD update_unordered_access_view_bindings : 1;
DWORD update_compute_unordered_access_view_bindings : 1;
DWORD uses_uavs : 1;
DWORD destroy_delayed : 1;
DWORD padding : 10;
DWORD padding : 9;
DWORD last_swizzle_map; /* MAX_ATTRIBS, 16 */
DWORD shader_update_mask;
DWORD constant_update_mask;

View File

@ -2254,6 +2254,8 @@ HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device,
const struct wined3d_clip_status *clip_status);
void __cdecl wined3d_device_set_compute_shader(struct wined3d_device *device, struct wined3d_shader *shader);
void __cdecl wined3d_device_set_cs_cb(struct wined3d_device *device, unsigned int idx, struct wined3d_buffer *buffer);
void __cdecl wined3d_device_set_cs_resource_view(struct wined3d_device *device,
unsigned int idx, struct wined3d_shader_resource_view *view);
void __cdecl wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned int idx,
struct wined3d_unordered_access_view *uav);
void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device,