wined3d: Send sampler binding updates through the command stream.
This commit is contained in:
parent
738de80d0c
commit
f699b6da0b
|
@ -39,6 +39,7 @@ enum wined3d_cs_op
|
|||
WINED3D_CS_OP_SET_INDEX_BUFFER,
|
||||
WINED3D_CS_OP_SET_CONSTANT_BUFFER,
|
||||
WINED3D_CS_OP_SET_TEXTURE,
|
||||
WINED3D_CS_OP_SET_SAMPLER,
|
||||
WINED3D_CS_OP_SET_SHADER,
|
||||
WINED3D_CS_OP_SET_RENDER_STATE,
|
||||
WINED3D_CS_OP_SET_TEXTURE_STATE,
|
||||
|
@ -150,6 +151,14 @@ struct wined3d_cs_set_texture
|
|||
struct wined3d_texture *texture;
|
||||
};
|
||||
|
||||
struct wined3d_cs_set_sampler
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
enum wined3d_shader_type type;
|
||||
UINT sampler_idx;
|
||||
struct wined3d_sampler *sampler;
|
||||
};
|
||||
|
||||
struct wined3d_cs_set_shader
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
|
@ -599,6 +608,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
|
|||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
|
||||
UINT sampler_idx, struct wined3d_sampler *sampler)
|
||||
{
|
||||
struct wined3d_cs_set_sampler *op;
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op));
|
||||
op->opcode = WINED3D_CS_OP_SET_SAMPLER;
|
||||
op->type = type;
|
||||
op->sampler_idx = sampler_idx;
|
||||
op->sampler = sampler;
|
||||
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_set_shader *op = data;
|
||||
|
@ -759,6 +789,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
|||
/* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer,
|
||||
/* WINED3D_CS_OP_SET_CONSTANT_BUFFER */ wined3d_cs_exec_set_constant_buffer,
|
||||
/* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture,
|
||||
/* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler,
|
||||
/* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader,
|
||||
/* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state,
|
||||
/* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state,
|
||||
|
|
|
@ -2142,10 +2142,14 @@ static void wined3d_device_set_sampler(struct wined3d_device *device,
|
|||
}
|
||||
|
||||
prev = device->update_state->sampler[type][idx];
|
||||
device->update_state->sampler[type][idx] = sampler;
|
||||
if (sampler == prev)
|
||||
return;
|
||||
|
||||
if (sampler)
|
||||
wined3d_sampler_incref(sampler);
|
||||
device->update_state->sampler[type][idx] = sampler;
|
||||
if (!device->recording)
|
||||
wined3d_cs_emit_set_sampler(device->cs, type, idx, sampler);
|
||||
if (prev)
|
||||
wined3d_sampler_decref(prev);
|
||||
}
|
||||
|
|
|
@ -2485,6 +2485,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
|
|||
enum wined3d_render_state state, DWORD value) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx,
|
||||
struct wined3d_surface *render_target) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
|
||||
UINT sampler_idx, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
|
||||
enum wined3d_sampler_state state, DWORD value) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue