From 3b61af6306361953d6fff924078c9017db397b13 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 1 Aug 2016 12:49:07 +0200 Subject: [PATCH] wined3d: Introduce wined3d_texture_load_location(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/texture.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 5a59f17668c..1f0a97aae08 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -174,6 +174,14 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture, sub_resource_idx, texture); } +/* Context activation is done by the caller. Context may be NULL in + * WINED3D_NO3D mode. */ +static BOOL wined3d_texture_load_location(struct wined3d_texture *texture, + unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) +{ + return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); +} + /* Context activation is done by the caller. */ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size_t size, const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) @@ -352,7 +360,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) for (i = 0; i < sub_count; ++i) { if (texture->sub_resources[i].locations == texture->resource.map_binding - && !texture->texture_ops->texture_load_location(texture, i, context, map_binding)) + && !wined3d_texture_load_location(texture, i, context, map_binding)) ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) wined3d_texture_remove_buffer_object(texture, i, context->gl_info); @@ -914,7 +922,7 @@ void wined3d_texture_load(struct wined3d_texture *texture, TRACE("Reloading because of color key value change.\n"); for (i = 0; i < sub_count; i++) { - if (!texture->texture_ops->texture_load_location(texture, i, context, texture->resource.map_binding)) + if (!wined3d_texture_load_location(texture, i, context, texture->resource.map_binding)) ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); else wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding); @@ -932,7 +940,7 @@ void wined3d_texture_load(struct wined3d_texture *texture, /* Reload the surfaces if the texture is marked dirty. */ for (i = 0; i < sub_count; ++i) { - if (!texture->texture_ops->texture_load_location(texture, i, context, + if (!wined3d_texture_load_location(texture, i, context, srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB)) ERR("Failed to load location (srgb %#x).\n", srgb); } @@ -1413,8 +1421,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, FIXME("Ignoring dirty_region %s.\n", debug_box(dirty_region)); context = context_acquire(texture->resource.device, NULL); - if (!texture->texture_ops->texture_load_location(texture, sub_resource_idx, - context, texture->resource.map_binding)) + 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); @@ -1591,7 +1598,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i]; if (resource->pool != WINED3D_POOL_DEFAULT - && texture->texture_ops->texture_load_location(texture, i, context, resource->map_binding)) + && wined3d_texture_load_location(texture, i, context, resource->map_binding)) { wined3d_texture_invalidate_location(texture, i, ~resource->map_binding); } @@ -1710,8 +1717,7 @@ 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"); - ret = texture->texture_ops->texture_load_location(texture, - sub_resource_idx, context, texture->resource.map_binding); + ret = wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); } if (!ret)