[PATCH 3/5] wined3d: Explicitly initialise sRGB format info.

Henri Verbeet hverbeet at codeweavers.com
Fri Sep 20 08:38:28 CDT 2019


For the GL adapter this already happens implicitly in
init_format_texture_info().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 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;
 
-- 
2.11.0




More information about the wine-devel mailing list