Commit 77088e3f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 85ba92c3
...@@ -488,7 +488,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win ...@@ -488,7 +488,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
} }
if (location & WINED3D_LOCATION_USER_MEMORY) if (location & WINED3D_LOCATION_USER_MEMORY)
{ {
data->addr = surface->user_memory; data->addr = surface->container->user_memory;
data->buffer_object = 0; data->buffer_object = 0;
return; return;
} }
...@@ -567,7 +567,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface) ...@@ -567,7 +567,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
break; break;
case WINED3D_LOCATION_USER_MEMORY: 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"); ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
break; break;
...@@ -1910,7 +1910,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) ...@@ -1910,7 +1910,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
} }
HRESULT wined3d_surface_update_desc(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; struct wined3d_resource *texture_resource = &surface->container->resource;
unsigned int width, height; unsigned int width, height;
...@@ -1954,7 +1954,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, ...@@ -1954,7 +1954,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
else else
surface->flags &= ~SFLAG_NONPOW2; surface->flags &= ~SFLAG_NONPOW2;
if ((surface->user_memory = mem)) if (surface->container->user_memory)
{ {
surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY; surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
valid_location = 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_ ...@@ -2414,7 +2414,7 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
break; break;
case WINED3D_LOCATION_USER_MEMORY: case WINED3D_LOCATION_USER_MEMORY:
base_memory = surface->user_memory; base_memory = surface->container->user_memory;
break; break;
case WINED3D_LOCATION_DIB: case WINED3D_LOCATION_DIB:
......
...@@ -644,7 +644,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT ...@@ -644,7 +644,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
texture->resource.width = width; texture->resource.width = width;
texture->resource.height = height; 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) void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
......
...@@ -2364,6 +2364,8 @@ struct wined3d_texture ...@@ -2364,6 +2364,8 @@ struct wined3d_texture
DWORD flags; DWORD flags;
GLenum target; GLenum target;
void *user_memory;
/* May only be accessed from the command stream worker thread. */ /* May only be accessed from the command stream worker thread. */
struct wined3d_texture_async struct wined3d_texture_async
{ {
...@@ -2486,7 +2488,6 @@ struct wined3d_surface ...@@ -2486,7 +2488,6 @@ struct wined3d_surface
struct wined3d_resource resource; struct wined3d_resource resource;
const struct wined3d_surface_ops *surface_ops; const struct wined3d_surface_ops *surface_ops;
struct wined3d_texture *container; struct wined3d_texture *container;
void *user_memory;
DWORD locations; DWORD locations;
DWORD flags; DWORD flags;
...@@ -2569,7 +2570,7 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, ...@@ -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; 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_unmap(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
HRESULT wined3d_surface_update_desc(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) 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, 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; struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN; void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment