Stefan Dösinger : wined3d: Add support for sysmem-clearing float32 formats.

Alexandre Julliard julliard at winehq.org
Mon May 16 15:37:58 CDT 2022


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon May 16 12:58:04 2022 -0500

wined3d: Add support for sysmem-clearing float32 formats.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/resource.c |  7 +++++++
 dlls/wined3d/utils.c    | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 073bc5b5834..7fefd516908 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -669,6 +669,13 @@ void wined3d_resource_memory_colour_fill(struct wined3d_resource *resource,
             }
             break;
 
+        case 8:
+        case 12:
+        case 16:
+            for (x = 0; x < w; ++x)
+                memcpy(((uint8_t *)map->data) + x * bpp, c, bpp);
+            break;
+
         default:
             FIXME("Not implemented for bpp %u.\n", bpp);
             return;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 6fe792c015f..6d785c461d4 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -6116,6 +6116,27 @@ void wined3d_format_convert_from_float(const struct wined3d_format *format,
         return;
     }
 
+    /* 32 bit float formats. We don't handle D32_FLOAT and D32_FLOAT_S8X24_UINT for now. */
+    if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT) && format->red_size == 32)
+    {
+        float *ret_f = ret;
+
+        switch (format->byte_count)
+        {
+            case 16: ret_f[3] = color->a;
+            case 12: ret_f[2] = color->b;
+            case  8: ret_f[1] = color->g;
+            case  4: ret_f[0] = color->r;
+                break;
+
+            default:
+                ERR("Unexpected byte count %u, format %s.\n", format->byte_count, debug_d3dformat(format_id));
+                break;
+        }
+
+        return;
+    }
+
     FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format_id));
 }
 




More information about the wine-cvs mailing list