Module: Mesa
Branch: staging/23.0
Commit: acda85f0b0dbd55ae0a3f949ac11d67e559361c7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=acda85f0b0dbd55ae0a3f949ac11d67e559361c7

Author: Filip Gawin <[email protected]>
Date:   Fri Dec  2 03:48:16 2022 +0100

nine: add fallback for D3DFMT_D16 in d3d9_to_pipe_format_checked

Helps with avoing crash in winetests on crocus.

Cc: mesa-stable

Reviewed-by: Axel Davy <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20121>
(cherry picked from commit 421d3e3c8e88d94fccb7883e41bb1d2c87e4981c)

---

 .pick_status.json                      | 2 +-
 src/gallium/frontends/nine/nine_pipe.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 157b559e60b..0cad213e42f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2964,7 +2964,7 @@
         "description": "nine: add fallback for D3DFMT_D16 in 
d3d9_to_pipe_format_checked",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/frontends/nine/nine_pipe.h 
b/src/gallium/frontends/nine/nine_pipe.h
index f237a8b6b2a..00401362473 100644
--- a/src/gallium/frontends/nine/nine_pipe.h
+++ b/src/gallium/frontends/nine/nine_pipe.h
@@ -346,6 +346,14 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen,
          * is precised in the name), so it is ok to match to another similar
          * format. In all cases, if the app reads the texture with a shader,
          * it gets depth on r and doesn't get stencil.*/
+        case D3DFMT_D16:
+            /* D16 support is a requirement, but as it cannot be locked,
+             * it is ok to revert to D24 */
+            if (format_check_internal(PIPE_FORMAT_Z24X8_UNORM))
+                return PIPE_FORMAT_Z24X8_UNORM;
+            if (format_check_internal(PIPE_FORMAT_X8Z24_UNORM))
+                return PIPE_FORMAT_X8Z24_UNORM;
+            break;
         case D3DFMT_INTZ:
         case D3DFMT_D24S8:
             if (format_check_internal(PIPE_FORMAT_Z24_UNORM_S8_UINT))

Reply via email to