svga: Check if Stencil buffer is NULL

Fixes a nullptr dereference on older HW versions.

Fixes: f29d939824 ("svga: rework framebuffer state")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38623>
(cherry picked from commit 4e16a5b68b)
This commit is contained in:
Ian Forbes 2025-11-24 10:12:25 -06:00 committed by Eric Engestrom
parent e05a6d7628
commit a8388e6eb2
2 changed files with 2 additions and 2 deletions

View file

@ -3494,7 +3494,7 @@
"description": "svga: Check if Stencil buffer is NULL",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f29d93982420f26c25b78e65fad78b09dc71f187",
"notes": null

View file

@ -84,7 +84,7 @@ emit_fb_vgpu9(struct svga_context *svga)
if (svga_surface_needs_propagation(hwfb->zsbuf))
svga_propagate_surface(svga, hwfb->zsbuf, true);
if (currfb->zsbuf->base.texture &&
if (currfb->zsbuf && currfb->zsbuf->base.texture &&
util_format_is_depth_and_stencil(currfb->zsbuf->base.format)) {
ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL,
currfb->zsbuf);