wined3d: Store the "user_memory" pointer in the texture instead of the surface.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-02-08 18:32:04 +01:00 committed by Alexandre Julliard
parent 85ba92c33a
commit 77088e3faa
3 changed files with 11 additions and 8 deletions

View File

@ -488,7 +488,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
}
if (location & WINED3D_LOCATION_USER_MEMORY)
{
data->addr = surface->user_memory;
data->addr = surface->container->user_memory;
data->buffer_object = 0;
return;
}
@ -567,7 +567,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
break;
case WINED3D_LOCATION_USER_MEMORY:
if (!surface->user_memory)
if (!surface->container->user_memory)
ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
break;
@ -1910,7 +1910,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
}
HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch)
const struct wined3d_gl_info *gl_info, unsigned int pitch)
{
struct wined3d_resource *texture_resource = &surface->container->resource;
unsigned int width, height;
@ -1954,7 +1954,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
else
surface->flags &= ~SFLAG_NONPOW2;
if ((surface->user_memory = mem))
if (surface->container->user_memory)
{
surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
valid_location = WINED3D_LOCATION_USER_MEMORY;
@ -2414,7 +2414,7 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
break;
case WINED3D_LOCATION_USER_MEMORY:
base_memory = surface->user_memory;
base_memory = surface->container->user_memory;
break;
case WINED3D_LOCATION_DIB:

View File

@ -644,7 +644,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
texture->resource.width = width;
texture->resource.height = height;
return wined3d_surface_update_desc(surface, gl_info, mem, pitch);
texture->user_memory = mem;
return wined3d_surface_update_desc(surface, gl_info, pitch);
}
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)

View File

@ -2364,6 +2364,8 @@ struct wined3d_texture
DWORD flags;
GLenum target;
void *user_memory;
/* May only be accessed from the command stream worker thread. */
struct wined3d_texture_async
{
@ -2486,7 +2488,6 @@ struct wined3d_surface
struct wined3d_resource resource;
const struct wined3d_surface_ops *surface_ops;
struct wined3d_texture *container;
void *user_memory;
DWORD locations;
DWORD flags;
@ -2569,7 +2570,7 @@ 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 wined3d_surface_unmap(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN;
const struct wined3d_gl_info *gl_info, unsigned int pitch) 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;