From 3f6d45bf14f46002061d20722a53b6f49e1b1076 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 6 Oct 2013 17:33:04 +0200 Subject: [PATCH] wined3d: Send render state updates through the command stream. --- dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++ dlls/wined3d/device.c | 2 +- dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 7f54ac9f4f5..f295aa75d7c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -41,6 +41,7 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_VERTEX_SHADER, WINED3D_CS_OP_SET_GEOMETRY_SHADER, WINED3D_CS_OP_SET_PIXEL_SHADER, + WINED3D_CS_OP_SET_RENDER_STATE, }; struct wined3d_cs_present @@ -143,6 +144,13 @@ struct wined3d_cs_set_shader struct wined3d_shader *shader; }; +struct wined3d_cs_set_render_state +{ + enum wined3d_cs_op opcode; + enum wined3d_render_state state; + DWORD value; +}; + static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_present *op = data; @@ -571,6 +579,26 @@ void wined3d_cs_emit_set_pixel_shader(struct wined3d_cs *cs, struct wined3d_shad cs->ops->submit(cs); } +static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_set_render_state *op = data; + + cs->state.render_states[op->state] = op->value; + device_invalidate_state(cs->device, STATE_RENDER(op->state)); +} + +void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) +{ + struct wined3d_cs_set_render_state *op; + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_RENDER_STATE; + 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, @@ -588,6 +616,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_VERTEX_SHADER */ wined3d_cs_exec_set_vertex_shader, /* 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, }; 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 49f39d7b25e..705ffb35065 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1940,7 +1940,7 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device, if (value == old_value) TRACE("Application is setting the old value over, nothing to do.\n"); else - device_invalidate_state(device, STATE_RENDER(state)); + wined3d_cs_emit_set_render_state(device->cs, state, value); if (state == WINED3D_RS_POINTSIZE && value == WINED3D_RESZ_CODE) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a1112ef9f68..328d8641d00 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2491,6 +2491,8 @@ void wined3d_cs_emit_set_geometry_shader(struct wined3d_cs *cs, struct wined3d_s 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_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; 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_scissor_rect(struct wined3d_cs *cs, const RECT *rect) DECLSPEC_HIDDEN;