Commit d9c369c7 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Load and invalidate every mipmap level when mapping the top mipmap level.

parent 798b23d9
......@@ -12187,7 +12187,7 @@ static void test_mipmap_upload(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
draw_textured_quad(&context, texture);
check_rt_color_todo_if(context.backbuffer, 0x00111111 * (j + 1), j > 0);
check_rt_color(context.backbuffer, 0x00111111 * (j + 1));
winetest_pop_context();
}
......
......@@ -27983,7 +27983,7 @@ static void test_mipmap_upload(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
draw_textured_quad(&context, texture);
check_rt_color_todo_if(context.backbuffer, 0x00111111 * (j + 1), j > 0);
check_rt_color(context.backbuffer, 0x00111111 * (j + 1));
winetest_pop_context();
}
......@@ -3697,7 +3697,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
struct wined3d_bo_address data;
unsigned int texture_level;
BYTE *base_memory;
BOOL ret;
BOOL ret = TRUE;
TRACE("resource %p, sub_resource_idx %u, map_ptr %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_ptr, debug_box(box), flags);
......@@ -3732,8 +3732,21 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
{
if (resource->usage & WINED3DUSAGE_DYNAMIC)
WARN_(d3d_perf)("Mapping a dynamic texture without WINED3D_MAP_DISCARD.\n");
if (!texture_level)
{
unsigned int i;
for (i = 0; i < texture->level_count; ++i)
{
if (!(ret = wined3d_texture_load_location(texture, sub_resource_idx + i, context, resource->map_binding)))
break;
}
}
else
{
ret = wined3d_texture_load_location(texture, sub_resource_idx, context, resource->map_binding);
}
}
if (!ret)
{
......@@ -3748,7 +3761,19 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
wined3d_texture_dirty_region_add(texture, sub_resource_idx / texture->level_count, box);
if (flags & WINED3D_MAP_WRITE)
{
if (!texture_level)
{
unsigned int i;
for (i = 0; i < texture->level_count; ++i)
wined3d_texture_invalidate_location(texture, sub_resource_idx + i, ~resource->map_binding);
}
else
{
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~resource->map_binding);
}
}
wined3d_texture_get_bo_address(texture, sub_resource_idx, &data, resource->map_binding);
base_memory = wined3d_context_map_bo_address(context, &data, sub_resource->size, flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment