wined3d: Introduce wined3d_texture_load_location().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-08-01 12:49:07 +02:00 committed by Alexandre Julliard
parent 9b7ff40d7e
commit 3b61af6306
1 changed files with 14 additions and 8 deletions

View File

@ -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)