Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/texture.c | 18 ++---------------- dlls/wined3d/wined3d_private.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 727eb1e7e36..af3aa003f1d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1999,13 +1999,7 @@ void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl *texture_gl,
wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb);
- if (srgb) - internal = format_gl->srgb_internal; - else if (resource->bind_flags & WINED3D_BIND_RENDER_TARGET && wined3d_resource_is_offscreen(resource)) - internal = format_gl->rt_internal; - else - internal = format_gl->internal; - + internal = wined3d_gl_get_internal_format(resource, format_gl, srgb); if (!internal) FIXME("No GL internal format for format %s.\n", debug_d3dformat(format->id));
@@ -2146,16 +2140,8 @@ static void wined3d_texture_gl_upload_bo(const struct wined3d_format *src_format
if (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) { + GLenum internal = wined3d_gl_get_internal_format(&dst_texture->resource, format_gl, srgb); unsigned int dst_row_pitch, dst_slice_pitch; - GLenum internal; - - if (srgb) - internal = format_gl->srgb_internal; - else if (dst_texture->resource.bind_flags & WINED3D_BIND_RENDER_TARGET - && wined3d_resource_is_offscreen(&dst_texture->resource)) - internal = format_gl->rt_internal; - else - internal = format_gl->internal;
wined3d_format_calculate_pitch(src_format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 21941afbd82..e9e73da9f25 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5930,6 +5930,17 @@ static inline GLuint wined3d_texture_gl_get_texture_name(const struct wined3d_te ? texture_gl->texture_srgb.name : texture_gl->texture_rgb.name; }
+static inline GLuint wined3d_gl_get_internal_format(struct wined3d_resource *resource, + const struct wined3d_format_gl *format_gl, bool srgb) +{ + if (srgb) + return format_gl->srgb_internal; + else if (resource->bind_flags & WINED3D_BIND_RENDER_TARGET && wined3d_resource_is_offscreen(resource)) + return format_gl->rt_internal; + else + return format_gl->internal; +} + static inline BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_info, const struct wined3d_format *format) { return d3d_info->texture_swizzle && !is_complex_fixup(format->color_fixup) && !is_scaling_fixup(format->color_fixup);