From 1e221e8da9456d2878b4e8328b6ffc9ead4cf122 Mon Sep 17 00:00:00 2001 From: Erik Abair Date: Thu, 30 Jun 2022 18:22:46 -0700 Subject: [PATCH] nv2a: Fallback to recreating texture on surface size mismatch. There is no requirement that a surface and texture using the same VRAM address match with respect to size (in particular pitch). This change prevents incorrect reuse of a surface binding in the event that the texture size does not match. Fixes #1127 --- hw/xbox/nv2a/pgraph.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xbox/nv2a/pgraph.c b/hw/xbox/nv2a/pgraph.c index d4b17bbecf..7d0e7e460d 100644 --- a/hw/xbox/nv2a/pgraph.c +++ b/hw/xbox/nv2a/pgraph.c @@ -5354,6 +5354,12 @@ static bool pgraph_check_surface_to_texture_compatibility( { // FIXME: Better checks/handling on formats and surface-texture compat + if (surface->pitch != shape->pitch || + surface->width != shape->width || + surface->height != shape->height) { + return false; + } + int surface_fmt = surface->shape.color_format; int texture_fmt = shape->color_format;