wined3d: Introduce wined3d_texture_validate_location().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-03-29 16:45:36 +02:00 committed by Alexandre Julliard
parent 97f4034e58
commit 5a29cc8787
7 changed files with 69 additions and 79 deletions

View File

@ -7878,6 +7878,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
const struct wined3d_color_key *color_key)
{
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_context *context;
@ -7935,7 +7936,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
context_release(context);
surface_validate_location(dst_surface, dst_texture->resource.draw_binding);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, dst_texture->resource.draw_binding);
surface_invalidate_location(dst_surface, ~dst_texture->resource.draw_binding);
}

View File

@ -401,7 +401,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
if (rt)
{
surface_validate_location(rt, rtv->resource->draw_binding);
wined3d_texture_validate_location(rt->container, rtv->sub_resource_idx, rtv->resource->draw_binding);
surface_invalidate_location(rt, ~rtv->resource->draw_binding);
}
}
@ -4117,7 +4117,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
context_release(context);
surface_validate_location(surface, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
surface_invalidate_location(surface, ~WINED3D_LOCATION_TEXTURE_RGB);
}

View File

@ -899,6 +899,8 @@ static ULONG surface_resource_decref(struct wined3d_resource *resource)
static void surface_unload(struct wined3d_resource *resource)
{
struct wined3d_surface *surface = surface_from_resource(resource);
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
struct wined3d_texture *texture = surface->container;
struct wined3d_renderbuffer_entry *entry, *entry2;
struct wined3d_device *device = resource->device;
const struct wined3d_gl_info *gl_info;
@ -922,14 +924,14 @@ static void surface_unload(struct wined3d_resource *resource)
* and all flags get lost */
if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL)
{
surface_validate_location(surface, WINED3D_LOCATION_DISCARDED);
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
surface_invalidate_location(surface, ~WINED3D_LOCATION_DISCARDED);
}
else
{
surface_prepare_system_memory(surface);
memset(surface->resource.heap_memory, 0, surface->resource.size);
surface_validate_location(surface, WINED3D_LOCATION_SYSMEM);
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_SYSMEM);
surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM);
}
}
@ -1265,6 +1267,7 @@ static BOOL surface_check_block_align_rect(struct wined3d_surface *surface, cons
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
struct wined3d_surface *src_surface, const RECT *src_rect)
{
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
unsigned int src_row_pitch, src_slice_pitch;
@ -1368,7 +1371,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
context_release(context);
surface_validate_location(dst_surface, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
return WINED3D_OK;
@ -2058,6 +2061,7 @@ static void surface_prepare_rb(struct wined3d_surface *surface, const struct win
static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
const RECT *src_rect, const RECT *dst_rect_in, enum wined3d_texture_filter_type filter)
{
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
@ -2161,7 +2165,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
/* The texture is now most up to date - If the surface is a render target
* and has a drawable, this path is never entered. */
surface_validate_location(dst_surface, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
}
@ -2169,6 +2173,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
const RECT *src_rect, const RECT *dst_rect_in, enum wined3d_texture_filter_type filter)
{
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
@ -2438,7 +2443,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
/* The texture is now most up to date - If the surface is a render target
* and has a drawable, this path is never entered. */
surface_validate_location(dst_surface, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
}
@ -2912,13 +2917,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
}
}
void surface_validate_location(struct wined3d_surface *surface, DWORD location)
{
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
surface_get_sub_resource(surface)->locations |= location;
}
void surface_invalidate_location(struct wined3d_surface *surface, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource;
@ -3247,12 +3245,14 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource = surface_get_sub_resource(surface);
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
struct wined3d_texture *texture = surface->container;
struct wined3d_texture_sub_resource *sub_resource;
HRESULT hr;
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
sub_resource = &texture->sub_resources[sub_resource_idx];
if (sub_resource->locations & location && (!(texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|| (surface->ds_current_size.cx == surface->resource.width
&& surface->ds_current_size.cy == surface->resource.height)))
@ -3273,7 +3273,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
{
TRACE("Surface previously discarded, nothing to do.\n");
wined3d_surface_prepare(surface, context, location);
surface_validate_location(surface, location);
wined3d_texture_validate_location(texture, sub_resource_idx, location);
surface_invalidate_location(surface, WINED3D_LOCATION_DISCARDED);
goto done;
}
@ -3281,7 +3281,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
if (!sub_resource->locations)
{
ERR("Surface %p does not have any up to date location.\n", surface);
surface_validate_location(surface, WINED3D_LOCATION_DISCARDED);
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
return surface_load_location(surface, context, location);
}
@ -3331,7 +3331,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
}
done:
surface_validate_location(surface, location);
wined3d_texture_validate_location(texture, sub_resource_idx, location);
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
@ -3475,15 +3475,18 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
struct wined3d_surface *dst_surface, const RECT *dst_rect,
const struct wined3d_color_key *color_key)
{
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_context *context;
/* Blit from offscreen surface to render target */
struct wined3d_color_key old_blt_key = src_surface->container->async.src_blt_color_key;
DWORD old_color_key_flags = src_surface->container->async.color_key_flags;
struct wined3d_color_key old_blt_key = src_texture->async.src_blt_color_key;
DWORD old_color_key_flags = src_texture->async.color_key_flags;
TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface);
wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, color_key);
wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT, color_key);
context = context_acquire(device, dst_surface);
@ -3499,11 +3502,11 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
context_release(context);
/* Restore the color key parameters */
wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT,
wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT,
(old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding);
surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, dst_texture->resource.draw_binding);
surface_invalidate_location(dst_surface, ~dst_texture->resource.draw_binding);
}
const struct blit_shader ffp_blit = {
@ -4186,6 +4189,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
{
struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
@ -4469,7 +4473,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
dst_surface, dst_texture->resource.draw_binding, dst_rect);
context_release(context);
surface_validate_location(dst_surface, dst_texture->resource.draw_binding);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx,
dst_texture->resource.draw_binding);
surface_invalidate_location(dst_surface, ~dst_texture->resource.draw_binding);
return WINED3D_OK;
@ -4500,6 +4505,7 @@ cpu:
HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags)
{
unsigned int sub_resource_idx = layer * container->level_count + level;
struct wined3d_device *device = container->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, desc->format);
@ -4584,9 +4590,9 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
if (lockable || desc->format == WINED3DFMT_D16_LOCKABLE)
surface->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
surface_validate_location(surface, WINED3D_LOCATION_SYSMEM);
wined3d_texture_validate_location(container, sub_resource_idx, WINED3D_LOCATION_SYSMEM);
if (container->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
surface_get_sub_resource(surface)->locations = WINED3D_LOCATION_DISCARDED;
container->sub_resources[sub_resource_idx].locations = WINED3D_LOCATION_DISCARDED;
if (wined3d_texture_use_pbo(container, gl_info))
surface->resource.map_binding = WINED3D_LOCATION_BUFFER;
@ -4607,7 +4613,7 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
if (surface->resource.map_binding == WINED3D_LOCATION_DIB)
{
wined3d_resource_free_sysmem(&surface->resource);
surface_validate_location(surface, WINED3D_LOCATION_DIB);
wined3d_texture_validate_location(container, sub_resource_idx, WINED3D_LOCATION_DIB);
surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM);
}

View File

@ -458,7 +458,8 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
swapchain->back_buffers[i - 1]->texture_rgb = swapchain->back_buffers[i]->texture_rgb;
surface_prev->rb_multisample = surface->rb_multisample;
surface_validate_location(surface_prev, sub_resource->locations & supported_locations);
wined3d_texture_validate_location(swapchain->back_buffers[i - 1], 0,
sub_resource->locations & supported_locations);
surface_invalidate_location(surface_prev, ~(sub_resource->locations & supported_locations));
surface_prev = surface;
@ -467,7 +468,7 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
swapchain->back_buffers[i - 1]->texture_rgb = tex0;
surface_prev->rb_multisample = rb0;
surface_validate_location(surface_prev, locations0 & supported_locations);
wined3d_texture_validate_location(swapchain->back_buffers[i - 1], 0, locations0 & supported_locations);
surface_invalidate_location(surface_prev, ~(locations0 & supported_locations));
device_invalidate_state(swapchain->device, STATE_FRAMEBUFFER);
@ -482,7 +483,6 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
const struct wined3d_gl_info *gl_info;
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
struct wined3d_surface *front;
BOOL render_to_fbo;
context = context_acquire(swapchain->device, back_buffer);
@ -599,10 +599,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
}
}
front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
surface_validate_location(front, WINED3D_LOCATION_DRAWABLE);
surface_invalidate_location(front, ~WINED3D_LOCATION_DRAWABLE);
wined3d_texture_validate_location(swapchain->front_buffer, 0, WINED3D_LOCATION_DRAWABLE);
surface_invalidate_location(swapchain->front_buffer->sub_resources[0].u.surface, ~WINED3D_LOCATION_DRAWABLE);
/* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM
* and INTEXTURE copies can keep their old content if they have any defined content.
* If the swapeffect is COPY, the content remains the same.
@ -827,7 +825,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
{
const struct wined3d_adapter *adapter = device->adapter;
struct wined3d_resource_desc texture_desc;
struct wined3d_surface *front_buffer;
BOOL displaymode_set = FALSE;
RECT client_rect;
HWND window;
@ -911,11 +908,10 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
}
wined3d_texture_set_swapchain(swapchain->front_buffer, swapchain);
front_buffer = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
if (!(device->wined3d->flags & WINED3D_NO3D))
{
surface_validate_location(front_buffer, WINED3D_LOCATION_DRAWABLE);
surface_invalidate_location(front_buffer, ~WINED3D_LOCATION_DRAWABLE);
wined3d_texture_validate_location(swapchain->front_buffer, 0, WINED3D_LOCATION_DRAWABLE);
surface_invalidate_location(swapchain->front_buffer->sub_resources[0].u.surface, ~WINED3D_LOCATION_DRAWABLE);
}
/* MSDN says we're only allowed a single fullscreen swapchain per device,

View File

@ -69,6 +69,20 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
return GL_BACK;
}
void wined3d_texture_validate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource;
TRACE("texture %p, sub_resource_idx %u, location %s.\n",
texture, sub_resource_idx, wined3d_debug_location(location));
sub_resource = &texture->sub_resources[sub_resource_idx];
sub_resource->locations |= location;
TRACE("New locations flags are %s.\n", wined3d_debug_location(sub_resource->locations));
}
static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops,
UINT layer_count, UINT level_count, const struct wined3d_resource_desc *desc, DWORD flags,
struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops,
@ -857,7 +871,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
if (sub_resource->resource->map_binding == WINED3D_LOCATION_BUFFER && !wined3d_texture_use_pbo(texture, gl_info))
sub_resource->resource->map_binding = surface->dib.DIBsection ? WINED3D_LOCATION_DIB : WINED3D_LOCATION_SYSMEM;
surface_validate_location(surface, valid_location);
wined3d_texture_validate_location(texture, 0, valid_location);
return WINED3D_OK;
}
@ -1000,7 +1014,7 @@ static HRESULT wined3d_texture_upload_data(struct wined3d_texture *texture,
struct wined3d_resource *sub_resource = texture->sub_resources[i].resource;
texture->texture_ops->texture_sub_resource_upload_data(sub_resource, context, &data[i]);
texture->texture_ops->texture_sub_resource_validate_location(sub_resource, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_validate_location(texture, i, WINED3D_LOCATION_TEXTURE_RGB);
texture->texture_ops->texture_sub_resource_invalidate_location(sub_resource, ~WINED3D_LOCATION_TEXTURE_RGB);
}
@ -1022,13 +1036,6 @@ static void texture2d_sub_resource_invalidate_location(struct wined3d_resource *
surface_invalidate_location(surface, location);
}
static void texture2d_sub_resource_validate_location(struct wined3d_resource *sub_resource, DWORD location)
{
struct wined3d_surface *surface = surface_from_resource(sub_resource);
surface_validate_location(surface, location);
}
static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_resource,
const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
{
@ -1141,7 +1148,6 @@ static const struct wined3d_texture_ops texture2d_ops =
{
texture2d_sub_resource_load,
texture2d_sub_resource_invalidate_location,
texture2d_sub_resource_validate_location,
texture2d_sub_resource_upload_data,
texture2d_load_location,
texture2d_prepare_location,
@ -1253,7 +1259,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
wined3d_debug_location(sub_resource->map_binding));
if ((ret = texture->texture_ops->texture_prepare_location(texture,
sub_resource_idx, context, sub_resource->map_binding)))
texture->texture_ops->texture_sub_resource_validate_location(sub_resource, sub_resource->map_binding);
wined3d_texture_validate_location(texture, sub_resource_idx, sub_resource->map_binding);
}
else
{
@ -1656,13 +1662,6 @@ static void texture3d_sub_resource_invalidate_location(struct wined3d_resource *
wined3d_volume_invalidate_location(volume, location);
}
static void texture3d_sub_resource_validate_location(struct wined3d_resource *sub_resource, DWORD location)
{
struct wined3d_volume *volume = volume_from_resource(sub_resource);
wined3d_volume_validate_location(volume, location);
}
static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_resource,
const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
{
@ -1736,7 +1735,6 @@ static const struct wined3d_texture_ops texture3d_ops =
{
texture3d_sub_resource_load,
texture3d_sub_resource_invalidate_location,
texture3d_sub_resource_validate_location,
texture3d_sub_resource_upload_data,
texture3d_load_location,
texture3d_prepare_location,

View File

@ -130,18 +130,6 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
HeapFree(GetProcessHeap(), 0, converted_mem);
}
void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource;
TRACE("Volume %p, setting %s.\n", volume, wined3d_debug_location(location));
sub_resource = &volume->container->sub_resources[volume->texture_level];
sub_resource->locations |= location;
TRACE("new location flags are %s.\n", wined3d_debug_location(sub_resource->locations));
}
void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource;
@ -260,10 +248,11 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
struct wined3d_context *context, DWORD location)
{
DWORD required_access = volume_access_from_location(location);
unsigned int sub_resource_idx = volume->texture_level;
struct wined3d_texture *texture = volume->container;
struct wined3d_texture_sub_resource *sub_resource;
sub_resource = &texture->sub_resources[volume->texture_level];
sub_resource = &texture->sub_resources[sub_resource_idx];
TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
wined3d_debug_location(sub_resource->locations));
@ -371,7 +360,7 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
}
done:
wined3d_volume_validate_location(volume, location);
wined3d_texture_validate_location(texture, sub_resource_idx, location);
if (location != WINED3D_LOCATION_SYSMEM && wined3d_volume_can_evict(volume))
wined3d_volume_evict_sysmem(volume);
@ -397,10 +386,11 @@ void wined3d_volume_cleanup(struct wined3d_volume *volume)
static void volume_unload(struct wined3d_resource *resource)
{
struct wined3d_volume *volume = volume_from_resource(resource);
struct wined3d_device *device = volume->resource.device;
struct wined3d_texture *texture = volume->container;
struct wined3d_device *device = texture->resource.device;
struct wined3d_context *context;
if (volume->resource.pool == WINED3D_POOL_DEFAULT)
if (texture->resource.pool == WINED3D_POOL_DEFAULT)
ERR("Unloading DEFAULT pool volume.\n");
TRACE("texture %p.\n", resource);
@ -413,7 +403,7 @@ static void volume_unload(struct wined3d_resource *resource)
else
{
ERR("Out of memory when unloading volume %p.\n", volume);
wined3d_volume_validate_location(volume, WINED3D_LOCATION_DISCARDED);
wined3d_texture_validate_location(texture, volume->texture_level, WINED3D_LOCATION_DISCARDED);
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
}
context_release(context);

View File

@ -2369,7 +2369,6 @@ struct wined3d_texture_ops
void (*texture_sub_resource_load)(struct wined3d_resource *sub_resource,
struct wined3d_context *context, BOOL srgb);
void (*texture_sub_resource_invalidate_location)(struct wined3d_resource *sub_resource, DWORD location);
void (*texture_sub_resource_validate_location)(struct wined3d_resource *sub_resource, DWORD location);
void (*texture_sub_resource_upload_data)(struct wined3d_resource *sub_resource,
const struct wined3d_context *context, const struct wined3d_sub_resource_data *data);
BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
@ -2496,6 +2495,8 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void wined3d_texture_validate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
#define WINED3D_LOCATION_DISCARDED 0x00000001
#define WINED3D_LOCATION_SYSMEM 0x00000002
@ -2533,7 +2534,6 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
BOOL wined3d_volume_prepare_location(struct wined3d_volume *volume,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN;
void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wined3d_context *context,
const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN;
@ -2662,7 +2662,6 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target,
void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point,
BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN;