diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index f295aa75d7c..3ddfeb127ea 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -42,6 +42,7 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_GEOMETRY_SHADER, WINED3D_CS_OP_SET_PIXEL_SHADER, WINED3D_CS_OP_SET_RENDER_STATE, + WINED3D_CS_OP_SET_TEXTURE_STATE, }; struct wined3d_cs_present @@ -151,6 +152,14 @@ struct wined3d_cs_set_render_state DWORD value; }; +struct wined3d_cs_set_texture_state +{ + enum wined3d_cs_op opcode; + UINT stage; + enum wined3d_texture_stage_state state; + DWORD value; +}; + static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_present *op = data; @@ -599,6 +608,28 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } +static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_set_texture_state *op = data; + + cs->state.texture_states[op->stage][op->state] = op->value; + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); +} + +void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, + enum wined3d_texture_stage_state state, DWORD value) +{ + struct wined3d_cs_set_texture_state *op; + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; + op->stage = stage; + op->state = state; + op->value = value; + + 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, @@ -617,6 +648,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_GEOMETRY_SHADER */ wined3d_cs_exec_set_geometry_shader, /* WINED3D_CS_OP_SET_PIXEL_SHADER */ wined3d_cs_exec_set_pixel_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, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9b050cde093..73231dad5cd 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3074,7 +3074,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, return; } - device_invalidate_state(device, STATE_TEXTURESTAGE(stage, state)); + wined3d_cs_emit_set_texture_state(device->cs, stage, state, value); } DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b31908d3d6d..96e5d3b5b81 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2501,6 +2501,8 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, + enum wined3d_texture_stage_state state, DWORD value) 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;