wined3d: Handle DISCARDED and CLEARED locations in wined3d_texture_get_memory().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3a67b7f2fb
commit
f4e65025b6
|
@ -864,14 +864,24 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
static void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||||
struct wined3d_bo_address *data)
|
struct wined3d_context *context, struct wined3d_bo_address *data)
|
||||||
{
|
{
|
||||||
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];
|
||||||
DWORD locations = sub_resource->locations;
|
DWORD locations = sub_resource->locations;
|
||||||
|
|
||||||
TRACE("texture %p, sub_resource_idx %u, data %p, locations %s.\n",
|
TRACE("texture %p, context %p, sub_resource_idx %u, data %p, locations %s.\n",
|
||||||
texture, sub_resource_idx, data, wined3d_debug_location(locations));
|
texture, context, sub_resource_idx, data, wined3d_debug_location(locations));
|
||||||
|
|
||||||
|
if (locations & (WINED3D_LOCATION_DISCARDED | WINED3D_LOCATION_CLEARED))
|
||||||
|
{
|
||||||
|
locations = (wined3d_texture_use_pbo(texture, context->d3d_info) ? WINED3D_LOCATION_BUFFER : WINED3D_LOCATION_SYSMEM);
|
||||||
|
if (!wined3d_texture_load_location(texture, sub_resource_idx, context, locations))
|
||||||
|
{
|
||||||
|
data->buffer_object = 0;
|
||||||
|
data->addr = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (locations & WINED3D_LOCATION_BUFFER)
|
if (locations & WINED3D_LOCATION_BUFFER)
|
||||||
{
|
{
|
||||||
wined3d_texture_get_bo_address(texture, sub_resource_idx, data, WINED3D_LOCATION_BUFFER);
|
wined3d_texture_get_bo_address(texture, sub_resource_idx, data, WINED3D_LOCATION_BUFFER);
|
||||||
|
@ -3247,7 +3257,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
|
||||||
wined3d_texture_set_map_binding(&texture_gl->t, WINED3D_LOCATION_SYSMEM);
|
wined3d_texture_set_map_binding(&texture_gl->t, WINED3D_LOCATION_SYSMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
wined3d_texture_get_memory(&texture_gl->t, sub_resource_idx, &data);
|
wined3d_texture_get_memory(&texture_gl->t, sub_resource_idx, &context_gl->c, &data);
|
||||||
if (conversion)
|
if (conversion)
|
||||||
{
|
{
|
||||||
width = src_box.right - src_box.left;
|
width = src_box.right - src_box.left;
|
||||||
|
@ -4517,7 +4527,7 @@ void wined3d_texture_upload_from_texture(struct wined3d_texture *dst_texture, un
|
||||||
wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||||
|
|
||||||
src_level = src_sub_resource_idx % src_texture->level_count;
|
src_level = src_sub_resource_idx % src_texture->level_count;
|
||||||
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &data);
|
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, context, &data);
|
||||||
wined3d_texture_get_pitch(src_texture, src_level, &src_row_pitch, &src_slice_pitch);
|
wined3d_texture_get_pitch(src_texture, src_level, &src_row_pitch, &src_slice_pitch);
|
||||||
|
|
||||||
dst_texture->texture_ops->texture_upload_data(context, wined3d_const_bo_address(&data),
|
dst_texture->texture_ops->texture_upload_data(context, wined3d_const_bo_address(&data),
|
||||||
|
@ -5145,7 +5155,7 @@ static BOOL wined3d_texture_vk_load_texture(struct wined3d_texture_vk *texture_v
|
||||||
}
|
}
|
||||||
|
|
||||||
level = sub_resource_idx % texture_vk->t.level_count;
|
level = sub_resource_idx % texture_vk->t.level_count;
|
||||||
wined3d_texture_get_memory(&texture_vk->t, sub_resource_idx, &data);
|
wined3d_texture_get_memory(&texture_vk->t, sub_resource_idx, context, &data);
|
||||||
wined3d_texture_get_level_box(&texture_vk->t, level, &src_box);
|
wined3d_texture_get_level_box(&texture_vk->t, level, &src_box);
|
||||||
wined3d_texture_get_pitch(&texture_vk->t, level, &row_pitch, &slice_pitch);
|
wined3d_texture_get_pitch(&texture_vk->t, level, &row_pitch, &slice_pitch);
|
||||||
wined3d_texture_vk_upload_data(context, wined3d_const_bo_address(&data), texture_vk->t.resource.format,
|
wined3d_texture_vk_upload_data(context, wined3d_const_bo_address(&data), texture_vk->t.resource.format,
|
||||||
|
|
Loading…
Reference in New Issue