wined3d: Require a valid rectangle pointer if rect_count is non-zero in device_clear_render_targets().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb9704a979
commit
198042e1d8
|
@ -1332,6 +1332,12 @@ static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_coun
|
|||
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
|
||||
iface, rect_count, rects, flags, color, z, stencil);
|
||||
|
||||
if (rect_count && !rects)
|
||||
{
|
||||
WARN("count %u with NULL rects.\n", rect_count);
|
||||
rect_count = 0;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -1660,6 +1660,12 @@ static HRESULT WINAPI d3d9_device_Clear(IDirect3DDevice9Ex *iface, DWORD rect_co
|
|||
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
|
||||
iface, rect_count, rects, flags, color, z, stencil);
|
||||
|
||||
if (rect_count && !rects)
|
||||
{
|
||||
WARN("count %u with NULL rects.\n", rect_count);
|
||||
rect_count = 0;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -5157,6 +5157,12 @@ static HRESULT d3d_device7_Clear(IDirect3DDevice7 *iface, DWORD count,
|
|||
TRACE("iface %p, count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %#x.\n",
|
||||
iface, count, rects, flags, color, z, stencil);
|
||||
|
||||
if (count && !rects)
|
||||
{
|
||||
WARN("count %u with NULL rects.\n", count);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_clear(This->wined3d_device, count, (RECT *)rects, flags, &c, z, stencil);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -263,7 +263,7 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
|
|||
{
|
||||
/* draw_rect ⊇ current_rect, test if we're doing a full clear. */
|
||||
|
||||
if (!clear_rect)
|
||||
if (!rect_count)
|
||||
{
|
||||
/* Full clear, modify only. */
|
||||
*out_rect = *draw_rect;
|
||||
|
@ -285,13 +285,12 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
|
|||
}
|
||||
|
||||
void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
|
||||
UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
|
||||
UINT rect_count, const RECT *clear_rect, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
|
||||
float depth, DWORD stencil)
|
||||
{
|
||||
struct wined3d_surface *target = rt_count ? wined3d_rendertarget_view_get_surface(fb->render_targets[0]) : NULL;
|
||||
struct wined3d_surface *depth_stencil = fb->depth_stencil
|
||||
? wined3d_rendertarget_view_get_surface(fb->depth_stencil) : NULL;
|
||||
const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
UINT drawable_width, drawable_height;
|
||||
struct wined3d_color corrected_color;
|
||||
|
@ -325,7 +324,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
|
|||
|
||||
if (rt && rtv->format->id != WINED3DFMT_NULL)
|
||||
{
|
||||
if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect))
|
||||
if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, rect_count ? clear_rect : NULL))
|
||||
surface_load_location(rt, context, rtv->resource->draw_binding);
|
||||
else
|
||||
wined3d_surface_prepare(rt, context, rtv->resource->draw_binding);
|
||||
|
@ -440,7 +439,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
|
|||
clear_mask = clear_mask | GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
if (!clear_rect)
|
||||
if (!rect_count)
|
||||
{
|
||||
if (render_offscreen)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue