Module: Mesa
Branch: main
Commit: 421d3e3c8e88d94fccb7883e41bb1d2c87e4981c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=421d3e3c8e88d94fccb7883e41bb1d2c87e4981c

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>

---

 src/gallium/frontends/nine/nine_pipe.h | 8 ++++++++
 1 file changed, 8 insertions(+)

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