wined3d: Send render target binding updates through the command stream.
This commit is contained in:
parent
0cc1c22d16
commit
438b672660
|
@ -30,6 +30,7 @@ enum wined3d_cs_op
|
||||||
WINED3D_CS_OP_DRAW,
|
WINED3D_CS_OP_DRAW,
|
||||||
WINED3D_CS_OP_SET_VIEWPORT,
|
WINED3D_CS_OP_SET_VIEWPORT,
|
||||||
WINED3D_CS_OP_SET_SCISSOR_RECT,
|
WINED3D_CS_OP_SET_SCISSOR_RECT,
|
||||||
|
WINED3D_CS_OP_SET_RENDER_TARGET,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wined3d_cs_present
|
struct wined3d_cs_present
|
||||||
|
@ -76,6 +77,13 @@ struct wined3d_cs_set_scissor_rect
|
||||||
const RECT *rect;
|
const RECT *rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wined3d_cs_set_render_target
|
||||||
|
{
|
||||||
|
enum wined3d_cs_op opcode;
|
||||||
|
UINT render_target_idx;
|
||||||
|
struct wined3d_surface *render_target;
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
@ -198,6 +206,27 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
|
||||||
cs->ops->submit(cs);
|
cs->ops->submit(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wined3d_cs_exec_set_render_target(struct wined3d_cs *cs, const void *data)
|
||||||
|
{
|
||||||
|
const struct wined3d_cs_set_render_target *op = data;
|
||||||
|
|
||||||
|
cs->state.fb->render_targets[op->render_target_idx] = op->render_target;
|
||||||
|
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx,
|
||||||
|
struct wined3d_surface *render_target)
|
||||||
|
{
|
||||||
|
struct wined3d_cs_set_render_target *op;
|
||||||
|
|
||||||
|
op = cs->ops->require_space(cs, sizeof(*op));
|
||||||
|
op->opcode = WINED3D_CS_OP_SET_RENDER_TARGET;
|
||||||
|
op->render_target_idx = render_target_idx;
|
||||||
|
op->render_target = render_target;
|
||||||
|
|
||||||
|
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,
|
||||||
|
@ -205,6 +234,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||||
/* 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,
|
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
|
||||||
|
/* WINED3D_CS_OP_SET_RENDER_TARGET */ wined3d_cs_exec_set_render_target,
|
||||||
};
|
};
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -4032,13 +4032,12 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device,
|
||||||
if (render_target)
|
if (render_target)
|
||||||
wined3d_surface_incref(render_target);
|
wined3d_surface_incref(render_target);
|
||||||
device->fb.render_targets[render_target_idx] = render_target;
|
device->fb.render_targets[render_target_idx] = render_target;
|
||||||
|
wined3d_cs_emit_set_render_target(device->cs, render_target_idx, render_target);
|
||||||
/* Release after the assignment, to prevent device_resource_released()
|
/* Release after the assignment, to prevent device_resource_released()
|
||||||
* from seeing the surface as still in use. */
|
* from seeing the surface as still in use. */
|
||||||
if (prev)
|
if (prev)
|
||||||
wined3d_surface_decref(prev);
|
wined3d_surface_decref(prev);
|
||||||
|
|
||||||
device_invalidate_state(device, STATE_FRAMEBUFFER);
|
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2486,6 +2486,8 @@ 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_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;
|
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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue