wined3d: Check the source rectangle is a multiple of the format block size in wined3d_device_update_surface().
This commit is contained in:
parent
410a8e86f5
commit
c19c26e4be
|
@ -4741,6 +4741,7 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
|
|||
UINT update_w, update_h;
|
||||
CONVERT_TYPES convert;
|
||||
UINT dst_w, dst_h;
|
||||
UINT src_w, src_h;
|
||||
DWORD sampler;
|
||||
POINT p;
|
||||
RECT r;
|
||||
|
@ -4792,6 +4793,9 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
src_w = src_surface->resource.width;
|
||||
src_h = src_surface->resource.height;
|
||||
|
||||
dst_w = dst_surface->resource.width;
|
||||
dst_h = dst_surface->resource.height;
|
||||
|
||||
|
@ -4805,6 +4809,14 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* NPOT block sizes would be silly. */
|
||||
if ((update_w & (src_format->block_width - 1) || update_h & (src_format->block_height - 1))
|
||||
&& (src_w != update_w || dst_w != update_w || src_h != update_h || dst_h != update_h))
|
||||
{
|
||||
WARN("Update rect not block-aligned.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* This call loads the OpenGL surface directly, instead of copying the
|
||||
* surface to the destination's sysmem copy. If surface conversion is
|
||||
* needed, use BltFast instead to copy in sysmem and use regular surface
|
||||
|
@ -4831,8 +4843,7 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
|
|||
if (!data.addr)
|
||||
ERR("Source surface has no allocated memory, but should be a sysmem surface.\n");
|
||||
|
||||
surface_upload_data(dst_surface, gl_info, src_format, src_rect,
|
||||
src_surface->resource.width, dst_point, FALSE, &data);
|
||||
surface_upload_data(dst_surface, gl_info, src_format, src_rect, src_w, dst_point, FALSE, &data);
|
||||
|
||||
context_release(context);
|
||||
|
||||
|
|
Loading…
Reference in New Issue