Commit 07760604 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Send scissor rect updates through the command stream.

parent 8a7744b0
......@@ -29,6 +29,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DRAW,
WINED3D_CS_OP_SET_VIEWPORT,
WINED3D_CS_OP_SET_SCISSOR_RECT,
};
struct wined3d_cs_present
......@@ -69,6 +70,12 @@ struct wined3d_cs_set_viewport
const struct wined3d_viewport *viewport;
};
struct wined3d_cs_set_scissor_rect
{
enum wined3d_cs_op opcode;
const RECT *rect;
};
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
......@@ -172,12 +179,32 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_scissor_rect *op = data;
cs->state.scissor_rect = *op->rect;
device_invalidate_state(cs->device, STATE_SCISSORRECT);
}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
{
struct wined3d_cs_set_scissor_rect *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = rect;
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,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
......
......@@ -2060,7 +2060,7 @@ void CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const
return;
}
device_invalidate_state(device, STATE_SCISSORRECT);
wined3d_cs_emit_set_scissor_rect(device->cs, rect);
}
void CDECL wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect)
......@@ -4021,7 +4021,7 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device,
state->scissor_rect.left = 0;
state->scissor_rect.right = render_target->resource.width;
state->scissor_rect.bottom = render_target->resource.height;
device_invalidate_state(device, STATE_SCISSORRECT);
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
......@@ -4728,7 +4728,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
state->scissor_rect.left = 0;
state->scissor_rect.right = rt->resource.width;
state->scissor_rect.bottom = rt->resource.height;
device_invalidate_state(device, STATE_SCISSORRECT);
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
swapchain_update_render_to_fbo(swapchain);
......
......@@ -2486,6 +2486,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment