wined3d: Send vertex shader binding updates through the command stream.
This commit is contained in:
parent
4732b2f4ea
commit
368fcab2e8
|
@ -38,6 +38,7 @@ enum wined3d_cs_op
|
|||
WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ,
|
||||
WINED3D_CS_OP_SET_INDEX_BUFFER,
|
||||
WINED3D_CS_OP_SET_TEXTURE,
|
||||
WINED3D_CS_OP_SET_VERTEX_SHADER,
|
||||
};
|
||||
|
||||
struct wined3d_cs_present
|
||||
|
@ -134,6 +135,12 @@ struct wined3d_cs_set_texture
|
|||
struct wined3d_texture *texture;
|
||||
};
|
||||
|
||||
struct wined3d_cs_set_shader
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
struct wined3d_shader *shader;
|
||||
};
|
||||
|
||||
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_present *op = data;
|
||||
|
@ -505,6 +512,25 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
|
|||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_set_vertex_shader(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_set_shader *op = data;
|
||||
|
||||
cs->state.vertex_shader = op->shader;
|
||||
device_invalidate_state(cs->device, STATE_VSHADER);
|
||||
}
|
||||
|
||||
void wined3d_cs_emit_set_vertex_shader(struct wined3d_cs *cs, struct wined3d_shader *shader)
|
||||
{
|
||||
struct wined3d_cs_set_shader *op;
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op));
|
||||
op->opcode = WINED3D_CS_OP_SET_VERTEX_SHADER;
|
||||
op->shader = shader;
|
||||
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||
{
|
||||
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
|
||||
|
@ -519,6 +545,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
|||
/* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq,
|
||||
/* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer,
|
||||
/* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture,
|
||||
/* WINED3D_CS_OP_SET_VERTEX_SHADER */ wined3d_cs_exec_set_vertex_shader,
|
||||
};
|
||||
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
|
||||
|
|
|
@ -2077,27 +2077,19 @@ void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struc
|
|||
|
||||
TRACE("device %p, shader %p.\n", device, shader);
|
||||
|
||||
if (shader)
|
||||
wined3d_shader_incref(shader);
|
||||
if (prev)
|
||||
wined3d_shader_decref(prev);
|
||||
|
||||
device->update_state->vertex_shader = shader;
|
||||
|
||||
if (device->recording)
|
||||
{
|
||||
TRACE("Recording... not performing anything.\n");
|
||||
device->recording->changed.vertexShader = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (shader == prev)
|
||||
{
|
||||
TRACE("Application is setting the old shader over, nothing to do.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
device_invalidate_state(device, STATE_VSHADER);
|
||||
if (shader)
|
||||
wined3d_shader_incref(shader);
|
||||
device->update_state->vertex_shader = shader;
|
||||
if (!device->recording)
|
||||
wined3d_cs_emit_set_vertex_shader(device->cs, shader);
|
||||
if (prev)
|
||||
wined3d_shader_decref(prev);
|
||||
}
|
||||
|
||||
struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device)
|
||||
|
|
|
@ -2499,6 +2499,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
|
|||
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
|
||||
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_vertex_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Direct3D terminology with little modifications. We do not have an issued state
|
||||
|
|
Loading…
Reference in New Issue