wined3d: Store custom pitches 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:05 +01:00 committed by Alexandre Julliard
parent 77088e3faa
commit 195d16c826
3 changed files with 10 additions and 11 deletions

View File

@ -1897,8 +1897,8 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
TRACE("surface %p.\n", surface);
if (surface->pitch)
return surface->pitch;
if (surface->container->row_pitch)
return surface->container->row_pitch;
alignment = surface->resource.device->surface_alignment;
pitch = wined3d_format_calculate_pitch(surface->resource.format, surface->resource.width);
@ -1909,8 +1909,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
return pitch;
}
HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, unsigned int pitch)
HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
struct wined3d_resource *texture_resource = &surface->container->resource;
unsigned int width, height;
@ -1959,20 +1958,19 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
valid_location = WINED3D_LOCATION_USER_MEMORY;
}
surface->pitch = pitch;
surface->resource.format = texture_resource->format;
surface->resource.multisample_type = texture_resource->multisample_type;
surface->resource.multisample_quality = texture_resource->multisample_quality;
if (surface->pitch)
if (surface->container->row_pitch)
{
surface->resource.size = height * surface->pitch;
surface->resource.size = height * surface->container->row_pitch;
}
else
{
/* User memory surfaces don't have the regular surface alignment. */
surface->resource.size = wined3d_format_calculate_size(texture_resource->format,
1, width, height, 1);
surface->pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
surface->container->row_pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
}
/* The format might be changed to a format that needs conversion.

View File

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

View File

@ -2365,6 +2365,7 @@ struct wined3d_texture
GLenum target;
void *user_memory;
unsigned int row_pitch;
/* May only be accessed from the command stream worker thread. */
struct wined3d_texture_async
@ -2492,7 +2493,6 @@ struct wined3d_surface
DWORD flags;
UINT pitch;
UINT pow2Width;
UINT pow2Height;
@ -2570,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, unsigned int pitch) DECLSPEC_HIDDEN;
const struct wined3d_gl_info *gl_info) 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;