[PATCH 03/11] wined3d: Move WINED3DFMT_FLAG_NORMALISED to the base flags group.

Chip Davis wine at gitlab.winehq.org
Mon May 16 20:26:47 CDT 2022


From: Chip Davis <cdavis5x at gmail.com>

---
 dlls/wined3d/context_gl.c      |  5 ++---
 dlls/wined3d/device.c          |  3 +--
 dlls/wined3d/utils.c           | 27 +++++++++++++--------------
 dlls/wined3d/wined3d_private.h |  2 +-
 4 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 004a293a715..0bc7d8e23ce 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -5733,8 +5733,7 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
 
         if (element->stride)
         {
-            DWORD format_flags = format_gl->f.flags[WINED3D_GL_RES_TYPE_BUFFER];
-            unsigned int format_base_flags = format_gl->f.base_flags;
+            unsigned int format_flags = format_gl->f.base_flags;
 
             bo = wined3d_bo_gl_id(element->data.buffer_object);
             if (current_bo != bo)
@@ -5748,7 +5747,7 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
              * current_bo will be 0. If there is a vertex buffer but no vbo we
              * won't be load converted attributes anyway. */
             if (vs && vs->reg_maps.shader_version.major >= 4
-                    && (format_base_flags & WINED3DFMT_FLAG_INTEGER))
+                    && (format_flags & WINED3DFMT_FLAG_INTEGER))
             {
                 GL_EXTCALL(glVertexAttribIPointer(i, format_gl->vtx_format,
                         format_gl->vtx_type, element->stride, offset));
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3d4ebabcc60..bebd52ebb86 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5120,8 +5120,7 @@ void CDECL wined3d_device_context_clear_uav_float(struct wined3d_device_context
 {
     TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_vec4(clear_value));
 
-    if (!((view->format->base_flags & WINED3DFMT_FLAG_FLOAT) ||
-            (view->format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_NORMALISED)))
+    if (!(view->format->base_flags & (WINED3DFMT_FLAG_FLOAT | WINED3DFMT_FLAG_NORMALISED)))
     {
         WARN("Not supported for view format %s.\n", debug_d3dformat(view->format->id));
         return;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 0fcabd59e64..e064f2c2cc7 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -347,16 +347,16 @@ static const struct wined3d_format_base_flags format_base_flags[] =
     {WINED3DFMT_R32_UINT,              0, WINED3DFMT_FLAG_CAST_TO_BLOCK | WINED3DFMT_FLAG_INDEX_BUFFER},
     {WINED3DFMT_R32_SINT,              0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
     {WINED3DFMT_R16_UINT,              0, WINED3DFMT_FLAG_INDEX_BUFFER},
-    {WINED3DFMT_A8_UNORM,              0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B10G10R10A2_UNORM,     0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B2G3R3_UNORM,          0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B4G4R4A4_UNORM,        0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B4G4R4X4_UNORM,        0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B5G5R5A1_UNORM,        0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B5G5R5X1_UNORM,        0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B5G6R5_UNORM,          0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_B8G8R8_UNORM,          0, WINED3DFMT_FLAG_NORMALISED},
-    {WINED3DFMT_R10G10B10A2_UNORM,     0, WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_A8_UNORM,              WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B10G10R10A2_UNORM,     WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B2G3R3_UNORM,          WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B4G4R4A4_UNORM,        WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B4G4R4X4_UNORM,        WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B5G5R5A1_UNORM,        WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B5G5R5X1_UNORM,        WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B5G6R5_UNORM,          WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_B8G8R8_UNORM,          WINED3DFMT_FLAG_NORMALISED},
+    {WINED3DFMT_R10G10B10A2_UNORM,     WINED3DFMT_FLAG_NORMALISED},
 };
 
 static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
@@ -2082,8 +2082,8 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter)
     for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
     {
         struct wined3d_format *typeless_format;
-        unsigned int flags = 0, base_flags = 0;
         unsigned int component_count = 0;
+        unsigned int base_flags = 0;
 
         if (!(format = get_format_internal(adapter, typed_formats[i].id)))
             return FALSE;
@@ -2115,7 +2115,7 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter)
             enum wined3d_channel_type channel_type = map_channel_type(typed_formats[i].channels[j]);
 
             if (channel_type == WINED3D_CHANNEL_TYPE_UNORM || channel_type == WINED3D_CHANNEL_TYPE_SNORM)
-                flags |= WINED3DFMT_FLAG_NORMALISED;
+                base_flags |= WINED3DFMT_FLAG_NORMALISED;
             if (channel_type == WINED3D_CHANNEL_TYPE_UINT || channel_type == WINED3D_CHANNEL_TYPE_SINT)
                 base_flags |= WINED3DFMT_FLAG_INTEGER;
             if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT)
@@ -2138,7 +2138,6 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter)
 
         format->component_count = component_count;
         format->base_flags |= base_flags;
-        format_set_flag(format, flags);
     }
 
     for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
@@ -6117,7 +6116,7 @@ void wined3d_format_convert_from_float(const struct wined3d_format *format,
         return;
     }
 
-    if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_NORMALISED)
+    if (format->base_flags & WINED3DFMT_FLAG_NORMALISED)
     {
         uint32_t *ret_i = ret;
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e5d1f93692f..49558ad4c8f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -6108,6 +6108,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
 /* WineD3D pixel format flags */
 #define WINED3DFMT_FLAG_FLOAT                       0x00000001
 #define WINED3DFMT_FLAG_INTEGER                     0x00000002
+#define WINED3DFMT_FLAG_NORMALISED                  0x00000004
 
 #define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING    0x00000001
 #define WINED3DFMT_FLAG_FILTERING                   0x00000002
@@ -6130,7 +6131,6 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
 #define WINED3DFMT_FLAG_TEXTURE                     0x00080000
 #define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY            0x00100000
 #define WINED3DFMT_FLAG_GEN_MIPMAP                  0x00400000
-#define WINED3DFMT_FLAG_NORMALISED                  0x00800000
 #define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE            0x01000000
 #define WINED3DFMT_FLAG_BLIT                        0x02000000
 #define WINED3DFMT_FLAG_MAPPABLE                    0x04000000
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/79



More information about the wine-devel mailing list