wined3d: Invalidate sub-levels in wined3d_texture_add_dirty_region().

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-10 23:47:36 +02:00 committed by Alexandre Julliard
parent 2310378042
commit 6a307598b1
3 changed files with 12 additions and 9 deletions

View File

@ -5518,7 +5518,7 @@ static void add_dirty_rect_test(void)
ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
todo_wine ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);

View File

@ -17618,7 +17618,7 @@ static void add_dirty_rect_test(void)
ok(SUCCEEDED(hr), "Failed to set sampler state, hr %#x.\n", hr);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
todo_wine ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);

View File

@ -1639,8 +1639,8 @@ static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(str
HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region)
{
unsigned int sub_resource_idx, i;
struct wined3d_context *context;
unsigned int sub_resource_idx;
TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region));
@ -1649,19 +1649,22 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
WARN("Invalid layer %u specified.\n", layer);
return WINED3DERR_INVALIDCALL;
}
sub_resource_idx = layer * texture->level_count;
if (dirty_region)
FIXME("Ignoring dirty_region %s.\n", debug_box(dirty_region));
context = context_acquire(texture->resource.device, NULL, 0);
if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding))
sub_resource_idx = layer * texture->level_count;
for (i = 0; i < texture->level_count; ++i, ++sub_resource_idx)
{
ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
context_release(context);
return E_OUTOFMEMORY;
if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding))
{
ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
context_release(context);
return E_OUTOFMEMORY;
}
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
}
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
context_release(context);
return WINED3D_OK;