wined3d: Always pass a valid source box to texture3d_upload_data().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dc5b22963b
commit
15d3155e59
|
@ -2549,8 +2549,6 @@ static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int
|
||||||
texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
|
texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
|
||||||
data->buffer_object, data->addr, row_pitch, slice_pitch, dst_x, dst_y, dst_z, srgb);
|
data->buffer_object, data->addr, row_pitch, slice_pitch, dst_x, dst_y, dst_z, srgb);
|
||||||
|
|
||||||
if (src_box)
|
|
||||||
{
|
|
||||||
addr += src_box->front * slice_pitch;
|
addr += src_box->front * slice_pitch;
|
||||||
addr += src_box->top * row_pitch;
|
addr += src_box->top * row_pitch;
|
||||||
addr += src_box->left * format->byte_count;
|
addr += src_box->left * format->byte_count;
|
||||||
|
@ -2558,13 +2556,6 @@ static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int
|
||||||
update_w = src_box->right - src_box->left;
|
update_w = src_box->right - src_box->left;
|
||||||
update_h = src_box->bottom - src_box->top;
|
update_h = src_box->bottom - src_box->top;
|
||||||
update_d = src_box->back - src_box->front;
|
update_d = src_box->back - src_box->front;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
update_w = wined3d_texture_get_level_width(texture, level);
|
|
||||||
update_h = wined3d_texture_get_level_height(texture, level);
|
|
||||||
update_d = wined3d_texture_get_level_depth(texture, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (format->conv_byte_count)
|
if (format->conv_byte_count)
|
||||||
{
|
{
|
||||||
|
@ -2646,6 +2637,7 @@ static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned in
|
||||||
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
|
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||||
unsigned int row_pitch, slice_pitch;
|
unsigned int row_pitch, slice_pitch;
|
||||||
struct wined3d_bo_address data;
|
struct wined3d_bo_address data;
|
||||||
|
struct wined3d_box src_box;
|
||||||
|
|
||||||
/* Optimisations are possible, but the effort should be put into either
|
/* Optimisations are possible, but the effort should be put into either
|
||||||
* implementing EXT_SRGB_DECODE in the driver or finding out why we
|
* implementing EXT_SRGB_DECODE in the driver or finding out why we
|
||||||
|
@ -2659,11 +2651,12 @@ static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned in
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||||
|
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||||
wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
|
wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
|
||||||
texture3d_download_data(texture, sub_resource_idx, context, &data);
|
texture3d_download_data(texture, sub_resource_idx, context, &data);
|
||||||
wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
|
wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
|
||||||
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||||
NULL, wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
&src_box, wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
||||||
|
|
||||||
heap_free(data.addr);
|
heap_free(data.addr);
|
||||||
}
|
}
|
||||||
|
@ -2685,21 +2678,27 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
|
||||||
if (sub_resource->locations & WINED3D_LOCATION_SYSMEM)
|
if (sub_resource->locations & WINED3D_LOCATION_SYSMEM)
|
||||||
{
|
{
|
||||||
struct wined3d_const_bo_address data = {0, texture->resource.heap_memory};
|
struct wined3d_const_bo_address data = {0, texture->resource.heap_memory};
|
||||||
|
struct wined3d_box src_box;
|
||||||
|
|
||||||
data.addr += sub_resource->offset;
|
data.addr += sub_resource->offset;
|
||||||
wined3d_texture_bind_and_dirtify(texture, context,
|
wined3d_texture_bind_and_dirtify(texture, context,
|
||||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||||
|
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||||
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||||
NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
&src_box, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
||||||
}
|
}
|
||||||
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
|
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
|
||||||
{
|
{
|
||||||
struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
|
struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
|
||||||
|
struct wined3d_box src_box;
|
||||||
|
|
||||||
wined3d_texture_bind_and_dirtify(texture, context,
|
wined3d_texture_bind_and_dirtify(texture, context,
|
||||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||||
|
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||||
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
texture3d_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||||
NULL, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
&src_box, &data, row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
||||||
}
|
}
|
||||||
else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3241,6 +3241,15 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
|
||||||
return max(1, texture->pow2_height >> level);
|
return max(1, texture->pow2_height >> level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void wined3d_texture_get_level_box(const struct wined3d_texture *texture,
|
||||||
|
unsigned int level, struct wined3d_box *box)
|
||||||
|
{
|
||||||
|
wined3d_box_set(box, 0, 0,
|
||||||
|
wined3d_texture_get_level_width(texture, level),
|
||||||
|
wined3d_texture_get_level_height(texture, level),
|
||||||
|
0, wined3d_texture_get_level_depth(texture, level));
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||||
const struct wined3d_box *dst_box, struct wined3d_texture *src_texture,
|
const struct wined3d_box *dst_box, struct wined3d_texture *src_texture,
|
||||||
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags,
|
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags,
|
||||||
|
|
Loading…
Reference in New Issue