wined3d: Send scissor rect updates through the command stream.

This commit is contained in:
Henri Verbeet 2013-09-30 09:40:41 +02:00 committed by Alexandre Julliard
parent 8a7744b06e
commit 0776060439
3 changed files with 31 additions and 3 deletions

View File

@ -29,6 +29,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DRAW, WINED3D_CS_OP_DRAW,
WINED3D_CS_OP_SET_VIEWPORT, WINED3D_CS_OP_SET_VIEWPORT,
WINED3D_CS_OP_SET_SCISSOR_RECT,
}; };
struct wined3d_cs_present struct wined3d_cs_present
@ -69,6 +70,12 @@ struct wined3d_cs_set_viewport
const struct wined3d_viewport *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) static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{ {
const struct wined3d_cs_present *op = 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); 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) = 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_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport, /* 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) static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)

View File

@ -2060,7 +2060,7 @@ void CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const
return; 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) 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.left = 0;
state->scissor_rect.right = render_target->resource.width; state->scissor_rect.right = render_target->resource.width;
state->scissor_rect.bottom = render_target->resource.height; 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.left = 0;
state->scissor_rect.right = rt->resource.width; state->scissor_rect.right = rt->resource.width;
state->scissor_rect.bottom = rt->resource.height; 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); swapchain_update_render_to_fbo(swapchain);

View File

@ -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, 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 RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags) DECLSPEC_HIDDEN; 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; 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 /* Direct3D terminology with little modifications. We do not have an issued state