Commit 11c94a2e authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Simplify wined3d_cs_emit_clear() slightly.

parent f667e651
...@@ -600,22 +600,20 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) ...@@ -600,22 +600,20 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{ {
unsigned int rt_count = cs->device->adapter->d3d_info.limits.max_rt_count;
const struct wined3d_state *state = &cs->device->state; const struct wined3d_state *state = &cs->device->state;
const struct wined3d_viewport *vp = &state->viewports[0]; const struct wined3d_viewport *vp = &state->viewports[0];
struct wined3d_rendertarget_view *view; struct wined3d_rendertarget_view *view;
struct wined3d_cs_clear *op; struct wined3d_cs_clear *op;
unsigned int rt_count, i;
RECT view_rect; RECT view_rect;
unsigned int i;
rt_count = flags & WINED3DCLEAR_TARGET ? cs->device->adapter->d3d_info.limits.max_rt_count : 0;
op = wined3d_cs_require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]), op = wined3d_cs_require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]),
WINED3D_CS_QUEUE_DEFAULT); WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_CLEAR; op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags; op->flags = flags;
if (flags & WINED3DCLEAR_TARGET)
op->rt_count = rt_count; op->rt_count = rt_count;
else
op->rt_count = 0;
op->fb = &cs->fb; op->fb = &cs->fb;
SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height); SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
if (state->render_states[WINED3D_RS_SCISSORTESTENABLE]) if (state->render_states[WINED3D_RS_SCISSORTESTENABLE])
...@@ -626,8 +624,6 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * ...@@ -626,8 +624,6 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->rect_count = rect_count; op->rect_count = rect_count;
memcpy(op->rects, rects, sizeof(*rects) * rect_count); memcpy(op->rects, rects, sizeof(*rects) * rect_count);
if (flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < rt_count; ++i) for (i = 0; i < rt_count; ++i)
{ {
if ((view = state->fb->render_targets[i])) if ((view = state->fb->render_targets[i]))
...@@ -637,7 +633,6 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * ...@@ -637,7 +633,6 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
wined3d_resource_acquire(view->resource); wined3d_resource_acquire(view->resource);
} }
} }
}
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{ {
view = state->fb->depth_stencil; view = state->fb->depth_stencil;
......
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