[PATCH 3/3] wined3d: Factor out wined3d_texture_get_gl_internal_format().
Józef Kucia
jkucia at codeweavers.com
Fri Sep 14 07:00:58 CDT 2018
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/texture.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 8f499d4ada60..61439d7f03c7 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1706,6 +1706,25 @@ static void wined3d_texture_force_reload(struct wined3d_texture *texture)
}
}
+static GLenum wined3d_texture_get_gl_internal_format(struct wined3d_texture *texture, BOOL srgb)
+{
+ const struct wined3d_format *format = texture->resource.format;
+ GLenum internal;
+
+ if (srgb)
+ internal = format->glGammaInternal;
+ else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
+ && wined3d_resource_is_offscreen(&texture->resource))
+ internal = format->rtInternal;
+ else
+ internal = format->glInternal;
+
+ if (!internal)
+ FIXME("No GL internal format for format %s.\n", debug_d3dformat(format->id));
+
+ return internal;
+}
+
/* Context activation is done by the caller. */
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
{
@@ -1751,16 +1770,7 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
wined3d_texture_bind_and_dirtify(texture, context, srgb);
- if (srgb)
- internal = format->glGammaInternal;
- else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
- && wined3d_resource_is_offscreen(&texture->resource))
- internal = format->rtInternal;
- else
- internal = format->glInternal;
-
- if (!internal)
- FIXME("No GL internal format for format %s.\n", debug_d3dformat(format->id));
+ internal = wined3d_texture_get_gl_internal_format(texture, srgb);
TRACE("internal %#x, format %#x, type %#x.\n", internal, format->glFormat, format->glType);
@@ -2019,13 +2029,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
const BYTE *addr = bo.addr;
GLenum internal;
- if (srgb)
- internal = format->glGammaInternal;
- else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
- && wined3d_resource_is_offscreen(&texture->resource))
- internal = format->rtInternal;
- else
- internal = format->glInternal;
+ internal = wined3d_texture_get_gl_internal_format(texture, srgb);
wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
--
2.16.4
More information about the wine-devel
mailing list