Commit 053071e3 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Pass a struct wined3d_fb_state to device_clear_render_targets.

parent cd96c59d
...@@ -649,12 +649,12 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context ...@@ -649,12 +649,12 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
} }
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts, HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect, UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const WINED3DCOLORVALUE *color,
DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) float depth, DWORD stencil)
{ {
const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL; const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL;
struct wined3d_surface *target = rt_count ? rts[0] : NULL; struct wined3d_surface *target = rt_count ? fb->render_targets[0] : NULL;
UINT drawable_width, drawable_height; UINT drawable_width, drawable_height;
struct wined3d_context *context; struct wined3d_context *context;
GLbitfield clear_mask = 0; GLbitfield clear_mask = 0;
...@@ -673,7 +673,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count ...@@ -673,7 +673,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
{ {
for (i = 0; i < rt_count; ++i) for (i = 0; i < rt_count; ++i)
{ {
if (rts[i]) surface_load_location(rts[i], SFLAG_INDRAWABLE, NULL); if (fb->render_targets[i]) surface_load_location(fb->render_targets[i], SFLAG_INDRAWABLE, NULL);
} }
} }
...@@ -685,7 +685,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count ...@@ -685,7 +685,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
return WINED3D_OK; return WINED3D_OK;
} }
if (!context_apply_clear_state(context, device, rt_count, rts, depth_stencil)) if (!context_apply_clear_state(context, device, rt_count, fb->render_targets, fb->depth_stencil))
{ {
context_release(context); context_release(context);
WARN("Failed to apply clear state, skipping clear.\n"); WARN("Failed to apply clear state, skipping clear.\n");
...@@ -700,8 +700,8 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count ...@@ -700,8 +700,8 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
else else
{ {
render_offscreen = TRUE; render_offscreen = TRUE;
drawable_width = depth_stencil->pow2Width; drawable_width = fb->depth_stencil->pow2Width;
drawable_height = depth_stencil->pow2Height; drawable_height = fb->depth_stencil->pow2Height;
} }
ENTER_GL(); ENTER_GL();
...@@ -725,14 +725,14 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count ...@@ -725,14 +725,14 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
{ {
DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN; DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
if (location == SFLAG_DS_ONSCREEN && depth_stencil != device->onscreen_depth_stencil) if (location == SFLAG_DS_ONSCREEN && fb->depth_stencil != device->onscreen_depth_stencil)
{ {
LEAVE_GL(); LEAVE_GL();
device_switch_onscreen_ds(device, context, depth_stencil); device_switch_onscreen_ds(device, context, fb->depth_stencil);
ENTER_GL(); ENTER_GL();
} }
prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect); prepare_ds_clear(fb->depth_stencil, context, location, draw_rect, rect_count, clear_rect);
surface_modify_location(depth_stencil, SFLAG_INDRAWABLE, TRUE); surface_modify_location(fb->depth_stencil, SFLAG_INDRAWABLE, TRUE);
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
device_invalidate_state(device, STATE_RENDER(WINED3DRS_ZWRITEENABLE)); device_invalidate_state(device, STATE_RENDER(WINED3DRS_ZWRITEENABLE));
...@@ -745,7 +745,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count ...@@ -745,7 +745,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
{ {
for (i = 0; i < rt_count; ++i) for (i = 0; i < rt_count; ++i)
{ {
if (rts[i]) surface_modify_location(rts[i], SFLAG_INDRAWABLE, TRUE); if (fb->render_targets[i]) surface_modify_location(fb->render_targets[i], SFLAG_INDRAWABLE, TRUE);
} }
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
...@@ -4043,7 +4043,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou ...@@ -4043,7 +4043,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
device_get_draw_rect(device, &draw_rect); device_get_draw_rect(device, &draw_rect);
return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
device->fb.render_targets, device->fb.depth_stencil, rect_count, rects, &device->fb, rect_count, rects,
&draw_rect, flags, &c, depth, stencil); &draw_rect, flags, &c, depth, stencil);
} }
......
...@@ -6392,8 +6392,9 @@ static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d ...@@ -6392,8 +6392,9 @@ static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d
const RECT *dst_rect, const WINED3DCOLORVALUE *color) const RECT *dst_rect, const WINED3DCOLORVALUE *color)
{ {
const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
struct wined3d_fb_state fb = {&dst_surface, NULL};
return device_clear_render_targets(device, 1, &dst_surface, NULL, return device_clear_render_targets(device, 1, &fb,
1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0); 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
} }
...@@ -6402,8 +6403,9 @@ static HRESULT ffp_blit_depth_fill(struct wined3d_device *device, ...@@ -6402,8 +6403,9 @@ static HRESULT ffp_blit_depth_fill(struct wined3d_device *device,
struct wined3d_surface *surface, const RECT *rect, float depth) struct wined3d_surface *surface, const RECT *rect, float depth)
{ {
const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height}; const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height};
struct wined3d_fb_state fb = {NULL, surface};
return device_clear_render_targets(device, 0, NULL, surface, return device_clear_render_targets(device, 0, &fb,
1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0); 1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0);
} }
......
...@@ -1745,9 +1745,9 @@ struct wined3d_device ...@@ -1745,9 +1745,9 @@ struct wined3d_device
struct WineD3DRectPatch *currentPatch; struct WineD3DRectPatch *currentPatch;
}; };
HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts, HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect, UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags,
DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN; void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN;
......
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