wined3d: Pass a texture and sub-resource index to surface_load_sysmem().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c1f5b9ac67
commit
3b47e108a9
|
@ -2060,12 +2060,10 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
||||
BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD dst_location)
|
||||
{
|
||||
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
struct wined3d_texture *texture = surface->container;
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
|
||||
sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
|
@ -2075,7 +2073,7 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
|||
if (is_multisample_location(texture, WINED3D_LOCATION_TEXTURE_RGB))
|
||||
{
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_RB_RESOLVED);
|
||||
read_from_framebuffer(surface, context, WINED3D_LOCATION_RB_RESOLVED, dst_location);
|
||||
read_from_framebuffer(sub_resource->u.surface, context, WINED3D_LOCATION_RB_RESOLVED, dst_location);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -2083,12 +2081,12 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
|||
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
|
||||
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
|
||||
/* Download the surface to system memory. */
|
||||
/* Download the sub-resource to system memory. */
|
||||
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
{
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
!(sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB));
|
||||
surface_download_data(surface, gl_info, dst_location);
|
||||
surface_download_data(sub_resource->u.surface, gl_info, dst_location);
|
||||
++texture->download_count;
|
||||
|
||||
return TRUE;
|
||||
|
@ -2098,12 +2096,12 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
|||
if (!(texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
&& (sub_resource->locations & WINED3D_LOCATION_DRAWABLE))
|
||||
{
|
||||
read_from_framebuffer(surface, context, texture->resource.draw_binding, dst_location);
|
||||
read_from_framebuffer(sub_resource->u.surface, context, texture->resource.draw_binding, dst_location);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FIXME("Can't load surface %p with location flags %s into sysmem.\n",
|
||||
surface, wined3d_debug_location(sub_resource->locations));
|
||||
FIXME("Can't load texture %p, %u with location flags %s into sysmem.\n",
|
||||
texture, sub_resource_idx, wined3d_debug_location(sub_resource->locations));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1803,7 +1803,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
case WINED3D_LOCATION_USER_MEMORY:
|
||||
case WINED3D_LOCATION_SYSMEM:
|
||||
case WINED3D_LOCATION_BUFFER:
|
||||
return surface_load_sysmem(surface, context, location);
|
||||
return texture2d_load_sysmem(texture, sub_resource_idx, context, location);
|
||||
|
||||
case WINED3D_LOCATION_DRAWABLE:
|
||||
return surface_load_drawable(surface, context);
|
||||
|
|
|
@ -3234,6 +3234,9 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
|
|||
return max(1, texture->pow2_height >> level);
|
||||
}
|
||||
|
||||
BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
|
||||
|
||||
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
|
||||
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_bind(struct wined3d_texture *texture,
|
||||
|
@ -3343,8 +3346,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
|
|||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
|
||||
BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
|
||||
BOOL surface_load_texture(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
|
|
Loading…
Reference in New Issue