Module: wine Branch: master Commit: 6a307598b19813bd5a65982eb2e8d4df43e08207 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6a307598b19813bd5a65982eb2...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Apr 10 23:47:36 2017 +0200
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
---
dlls/d3d8/tests/visual.c | 2 +- dlls/d3d9/tests/visual.c | 2 +- dlls/wined3d/texture.c | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index d97f467..88667b4 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -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);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 6fe7c8b..65bc8fc 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -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);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 6997378..3219305 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -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;