From 59ef897514cf72ec374c6738da910b43aec1256a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 20 Sep 2019 18:08:28 +0430 Subject: [PATCH] wined3d: Explicitly initialise sRGB format info. For the GL adapter this already happens implicitly in init_format_texture_info(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index e10d617b4e9..82027bf19c1 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2171,6 +2171,24 @@ static BOOL init_format_decompress_info(struct wined3d_adapter *adapter) return TRUE; } +static BOOL init_srgb_formats(struct wined3d_adapter *adapter) +{ + struct wined3d_format *format, *srgb_format; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i) + { + if (!(srgb_format = get_format_internal(adapter, format_srgb_info[i].srgb_format_id))) + return FALSE; + if (!(format = get_format_internal(adapter, format_srgb_info[i].base_format_id))) + return FALSE; + + copy_format(adapter, srgb_format, format); + } + + return TRUE; +} + static GLenum wined3d_gl_type_to_enum(enum wined3d_gl_resource_type type) { switch (type) @@ -3990,6 +4008,8 @@ static BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, si goto fail; if (!init_format_decompress_info(adapter)) goto fail; + if (!init_srgb_formats(adapter)) + goto fail; return TRUE;