=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Store additional flags directly in wined3d_format_block_info.

Alexandre Julliard julliard at winehq.org
Mon Sep 17 15:02:25 CDT 2018


Module: wine
Branch: master
Commit: 15e594ae4734546e886af37670a48c8e49bc637a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=15e594ae4734546e886af37670a48c8e49bc637a

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Sep 17 11:06:24 2018 +0200

wined3d: Store additional flags directly in wined3d_format_block_info.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/utils.c | 51 ++++++++++++++++++++++-----------------------------
 1 file changed, 22 insertions(+), 29 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 904baef..eb4001d 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -570,31 +570,30 @@ struct wined3d_format_block_info
     UINT block_width;
     UINT block_height;
     UINT block_byte_count;
-    BOOL verify;
-    BOOL compressed;
+    unsigned int flags;
 };
 
 static const struct wined3d_format_block_info format_block_info[] =
 {
-    {WINED3DFMT_DXT1,      4,  4,  8,  TRUE,  TRUE},
-    {WINED3DFMT_DXT2,      4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_DXT3,      4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_DXT4,      4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_DXT5,      4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC1_UNORM, 4,  4,  8,  TRUE,  TRUE},
-    {WINED3DFMT_BC2_UNORM, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC3_UNORM, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC4_UNORM, 4,  4,  8,  TRUE,  TRUE},
-    {WINED3DFMT_BC4_SNORM, 4,  4,  8,  TRUE,  TRUE},
-    {WINED3DFMT_BC5_UNORM, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC5_SNORM, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC6H_UF16, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC6H_SF16, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_BC7_UNORM, 4,  4,  16, TRUE,  TRUE},
-    {WINED3DFMT_ATI1N,     4,  4,  8,  FALSE, TRUE},
-    {WINED3DFMT_ATI2N,     4,  4,  16, FALSE, TRUE},
-    {WINED3DFMT_YUY2,      2,  1,  4,  FALSE, FALSE},
-    {WINED3DFMT_UYVY,      2,  1,  4,  FALSE, FALSE},
+    {WINED3DFMT_DXT1,      4,  4,  8,  WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_DXT2,      4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_DXT3,      4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_DXT4,      4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_DXT5,      4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC1_UNORM, 4,  4,  8,  WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC2_UNORM, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC3_UNORM, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC4_UNORM, 4,  4,  8,  WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC4_SNORM, 4,  4,  8,  WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC5_UNORM, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC5_SNORM, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC6H_UF16, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC6H_SF16, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_BC7_UNORM, 4,  4,  16, WINED3DFMT_FLAG_COMPRESSED},
+    {WINED3DFMT_ATI1N,     4,  4,  8,  WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
+    {WINED3DFMT_ATI2N,     4,  4,  16, WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
+    {WINED3DFMT_YUY2,      2,  1,  4,  WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
+    {WINED3DFMT_UYVY,      2,  1,  4,  WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
 };
 
 struct wined3d_format_vertex_info
@@ -2103,23 +2102,17 @@ fail:
 static BOOL init_format_block_info(struct wined3d_adapter *adapter)
 {
     struct wined3d_format *format;
-    unsigned int flags, i;
+    unsigned int i;
 
     for (i = 0; i < ARRAY_SIZE(format_block_info); ++i)
     {
         if (!(format = get_format_internal(adapter, format_block_info[i].id)))
             return FALSE;
 
-        flags = WINED3DFMT_FLAG_BLOCKS;
-        if (!format_block_info[i].verify)
-            flags |= WINED3DFMT_FLAG_BLOCKS_NO_VERIFY;
-        if (format_block_info[i].compressed)
-            flags |= WINED3DFMT_FLAG_COMPRESSED;
-
         format->block_width = format_block_info[i].block_width;
         format->block_height = format_block_info[i].block_height;
         format->block_byte_count = format_block_info[i].block_byte_count;
-        format_set_flag(format, flags);
+        format_set_flag(format, WINED3DFMT_FLAG_BLOCKS | format_block_info[i].flags);
     }
 
     return TRUE;




More information about the wine-cvs mailing list