Mesa (master): st/nine: Do not allow depth buffer render targets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 2 19:23:45 UTC 2021


Module: Mesa
Branch: master
Commit: f85f025a05cb7267b5f2c0932b46218f21576819
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f85f025a05cb7267b5f2c0932b46218f21576819

Author: Axel Davy <davyaxel0 at gmail.com>
Date:   Tue Aug  4 22:09:56 2020 +0200

st/nine: Do not allow depth buffer render targets

Without the proposed check, some apps will decide to use depth buffers
as render targets.

Bug found investigating:
https://github.com/iXit/wine-nine-standalone/issues/82

Signed-off-by: Axel Davy <davyaxel0 at gmail.com>
Acked-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9177>

---

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

diff --git a/src/gallium/frontends/nine/nine_pipe.h b/src/gallium/frontends/nine/nine_pipe.h
index 6a85c042db7..b5c4f0a3474 100644
--- a/src/gallium/frontends/nine/nine_pipe.h
+++ b/src/gallium/frontends/nine/nine_pipe.h
@@ -301,6 +301,10 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen,
 {
     enum pipe_format result;
 
+    /* We cannot render to depth textures as a render target */
+    if (depth_stencil_format(format) && (bindings & PIPE_BIND_RENDER_TARGET))
+        return PIPE_FORMAT_NONE;
+
     result = d3d9_to_pipe_format_internal(format);
     if (result == PIPE_FORMAT_NONE)
         return PIPE_FORMAT_NONE;



More information about the mesa-commit mailing list