st/nine: Return error when setting invalid depth buffer
authorAxel Davy <davyaxel0@gmail.com>
Tue, 28 May 2019 20:47:44 +0000 (22:47 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 May 2020 15:43:57 +0000 (15:43 +0000)
Prevents a crash with the trace of
https://github.com/iXit/wine-nine-standalone/issues/40

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5015>

src/gallium/frontends/nine/device9.c

index 0d73965f2c41f07f2266a35045eaa2bfba4fe70d..841d62bc6cecb11f0254cd19e0f820ec402c3ab5 100644 (file)
@@ -1929,6 +1929,9 @@ NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
     struct NineSurface9 *ds = NineSurface9(pNewZStencil);
     DBG("This=%p pNewZStencil=%p\n", This, pNewZStencil);
 
+    user_assert(!ds || util_format_is_depth_or_stencil(ds->base.info.format),
+                D3DERR_INVALIDCALL);
+
     if (This->state.ds != ds) {
         nine_bind(&This->state.ds, ds);
         nine_context_set_depth_stencil(This, ds);