wined3d: Merge surface_load_location() into texture2d_load_location().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3d21ea0807
commit
c1f5b9ac67
|
@ -2060,7 +2060,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
||||
BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD dst_location)
|
||||
{
|
||||
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
|
@ -2108,7 +2108,7 @@ static BOOL surface_load_sysmem(struct wined3d_surface *surface,
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static BOOL surface_load_drawable(struct wined3d_surface *surface,
|
||||
BOOL surface_load_drawable(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context)
|
||||
{
|
||||
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
|
@ -2155,7 +2155,7 @@ static BOOL surface_load_drawable(struct wined3d_surface *surface,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL surface_load_texture(struct wined3d_surface *surface,
|
||||
BOOL surface_load_texture(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, BOOL srgb)
|
||||
{
|
||||
unsigned int width, height, level, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch;
|
||||
|
@ -2326,8 +2326,8 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static BOOL surface_load_renderbuffer(struct wined3d_surface *surface, struct wined3d_context *context,
|
||||
DWORD dst_location)
|
||||
BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD dst_location)
|
||||
{
|
||||
struct wined3d_texture *texture = surface->container;
|
||||
unsigned int level = surface_get_sub_resource_idx(surface) % texture->level_count;
|
||||
|
@ -2359,36 +2359,6 @@ static BOOL surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
|
||||
BOOL surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
|
||||
|
||||
switch (location)
|
||||
{
|
||||
case WINED3D_LOCATION_USER_MEMORY:
|
||||
case WINED3D_LOCATION_SYSMEM:
|
||||
case WINED3D_LOCATION_BUFFER:
|
||||
return surface_load_sysmem(surface, context, location);
|
||||
|
||||
case WINED3D_LOCATION_DRAWABLE:
|
||||
return surface_load_drawable(surface, context);
|
||||
|
||||
case WINED3D_LOCATION_RB_RESOLVED:
|
||||
case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
return surface_load_renderbuffer(surface, context, location);
|
||||
|
||||
case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
return surface_load_texture(surface, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
|
||||
default:
|
||||
ERR("Don't know how to handle location %#x.\n", location);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
|
||||
{
|
||||
|
|
|
@ -1788,10 +1788,39 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int
|
|||
texture->resource.format, &src_rect, row_pitch, &dst_point, FALSE, data);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
|
||||
static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
return surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location);
|
||||
struct wined3d_surface *surface;
|
||||
|
||||
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
|
||||
texture, sub_resource_idx, context, wined3d_debug_location(location));
|
||||
|
||||
surface = texture->sub_resources[sub_resource_idx].u.surface;
|
||||
switch (location)
|
||||
{
|
||||
case WINED3D_LOCATION_USER_MEMORY:
|
||||
case WINED3D_LOCATION_SYSMEM:
|
||||
case WINED3D_LOCATION_BUFFER:
|
||||
return surface_load_sysmem(surface, context, location);
|
||||
|
||||
case WINED3D_LOCATION_DRAWABLE:
|
||||
return surface_load_drawable(surface, context);
|
||||
|
||||
case WINED3D_LOCATION_RB_RESOLVED:
|
||||
case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
return surface_load_renderbuffer(surface, context, location);
|
||||
|
||||
case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
return surface_load_texture(surface, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
|
||||
default:
|
||||
ERR("Don't know how to handle location %#x.\n", location);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
|
|
|
@ -3337,10 +3337,16 @@ static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(stru
|
|||
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
|
||||
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
|
||||
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
|
||||
BOOL surface_load_drawable(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
|
||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
BOOL surface_load_location(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD location) 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,
|
||||
const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect,
|
||||
unsigned int src_pitch, const POINT *dst_point, BOOL srgb,
|
||||
|
|
Loading…
Reference in New Issue