wined3d: Assume identical source and destination formats in surface_upload_from_surface().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-04-06 23:44:32 +02:00 committed by Alexandre Julliard
parent c2c1ffe416
commit 26d7f99125
2 changed files with 7 additions and 18 deletions

View File

@ -3551,12 +3551,6 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
TRACE("device %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n",
device, src_texture, src_level, dst_texture, level_count);
if (src_texture->resource.format != dst_texture->resource.format)
{
WARN("Source and destination formats do not match.\n");
return WINED3DERR_INVALIDCALL;
}
if (wined3d_texture_get_level_width(src_texture, src_level) != dst_texture->resource.width
|| wined3d_texture_get_level_height(src_texture, src_level) != dst_texture->resource.height
|| wined3d_texture_get_level_depth(src_texture, src_level) != dst_texture->resource.depth)
@ -3636,6 +3630,12 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
if (src_texture->resource.format != dst_texture->resource.format)
{
WARN("Source and destination formats do not match.\n");
return WINED3DERR_INVALIDCALL;
}
level_count = min(wined3d_texture_get_level_count(src_texture),
wined3d_texture_get_level_count(dst_texture));

View File

@ -874,8 +874,6 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
unsigned int src_row_pitch, src_slice_pitch;
const struct wined3d_format *src_format;
const struct wined3d_format *dst_format;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct wined3d_bo_address data;
@ -887,15 +885,6 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
dst_surface, wine_dbgstr_point(dst_point),
src_surface, wine_dbgstr_rect(src_rect));
src_format = src_texture->resource.format;
dst_format = dst_texture->resource.format;
if (src_format->id != dst_format->id)
{
WARN("Source and destination surfaces should have the same format.\n");
return WINED3DERR_INVALIDCALL;
}
if (!dst_point)
{
p.x = 0;
@ -947,7 +936,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
src_texture->sub_resources[src_sub_resource_idx].locations);
wined3d_texture_get_pitch(src_texture, src_surface->texture_level, &src_row_pitch, &src_slice_pitch);
wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect,
wined3d_surface_upload_data(dst_surface, gl_info, src_texture->resource.format, src_rect,
src_row_pitch, dst_point, FALSE, wined3d_const_bo_address(&data));
context_release(context);