wined3d: Send material updates through the command stream.

This commit is contained in:
Henri Verbeet 2013-10-09 10:39:37 +02:00 committed by Alexandre Julliard
parent db68c43678
commit 1f22246b84
3 changed files with 30 additions and 7 deletions

View File

@ -46,6 +46,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_SAMPLER_STATE,
WINED3D_CS_OP_SET_TRANSFORM,
WINED3D_CS_OP_SET_CLIP_PLANE,
WINED3D_CS_OP_SET_MATERIAL,
};
struct wined3d_cs_present
@ -185,6 +186,12 @@ struct wined3d_cs_set_clip_plane
const struct wined3d_vec4 *plane;
};
struct wined3d_cs_set_material
{
enum wined3d_cs_op opcode;
const struct wined3d_material *material;
};
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@ -719,6 +726,25 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_material *op = data;
cs->state.material = *op->material;
device_invalidate_state(cs->device, STATE_MATERIAL);
}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
{
struct wined3d_cs_set_material *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = material;
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,
@ -741,6 +767,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state,
/* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform,
/* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane,
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)

View File

@ -1785,15 +1785,10 @@ void CDECL wined3d_device_set_material(struct wined3d_device *device, const stru
device->update_state->material = *material;
/* Handle recording of state blocks */
if (device->recording)
{
device->recording->changed.material = TRUE;
TRACE("Recording... not performing anything.\n");
return;
}
device_invalidate_state(device, STATE_MATERIAL);
else
wined3d_cs_emit_set_material(device->cs, material);
}
void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material)

View File

@ -2491,6 +2491,7 @@ void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_sur
void wined3d_cs_emit_set_geometry_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_pixel_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
enum wined3d_render_state state, DWORD value) DECLSPEC_HIDDEN;