From c3a8b9569f616c4c0a89b265fd5ff25c04e565b2 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Mon, 17 Mar 2025 14:25:46 -0700 Subject: [PATCH] nv2a: Simplify surface clip to scissor size calculation --- hw/xbox/nv2a/pgraph/gl/draw.c | 7 +++---- hw/xbox/nv2a/pgraph/vk/draw.c | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/xbox/nv2a/pgraph/gl/draw.c b/hw/xbox/nv2a/pgraph/gl/draw.c index d9a0d4f91b..bfa92662e7 100644 --- a/hw/xbox/nv2a/pgraph/gl/draw.c +++ b/hw/xbox/nv2a/pgraph/gl/draw.c @@ -334,11 +334,10 @@ void pgraph_gl_draw_begin(NV2AState *d) /* FIXME: Consider moving to PSH w/ window clip */ unsigned int xmin = pg->surface_shape.clip_x, ymin = pg->surface_shape.clip_y; - unsigned int xmax = xmin + pg->surface_shape.clip_width - 1, - ymax = ymin + pg->surface_shape.clip_height - 1; - unsigned int scissor_width = xmax - xmin + 1, - scissor_height = ymax - ymin + 1; + unsigned int scissor_width = pg->surface_shape.clip_width, + scissor_height = pg->surface_shape.clip_height; + pgraph_apply_anti_aliasing_factor(pg, &xmin, &ymin); pgraph_apply_anti_aliasing_factor(pg, &scissor_width, &scissor_height); ymin = pg->surface_binding_dim.height - (ymin + scissor_height); diff --git a/hw/xbox/nv2a/pgraph/vk/draw.c b/hw/xbox/nv2a/pgraph/vk/draw.c index 8327f9c529..c082c5cfb4 100644 --- a/hw/xbox/nv2a/pgraph/vk/draw.c +++ b/hw/xbox/nv2a/pgraph/vk/draw.c @@ -1475,11 +1475,8 @@ static void begin_draw(PGRAPHState *pg) unsigned int xmin = pg->surface_shape.clip_x, ymin = pg->surface_shape.clip_y; - unsigned int xmax = xmin + pg->surface_shape.clip_width - 1, - ymax = ymin + pg->surface_shape.clip_height - 1; - - unsigned int scissor_width = xmax - xmin + 1, - scissor_height = ymax - ymin + 1; + unsigned int scissor_width = pg->surface_shape.clip_width, + scissor_height = pg->surface_shape.clip_height; pgraph_apply_anti_aliasing_factor(pg, &xmin, &ymin); pgraph_apply_anti_aliasing_factor(pg, &scissor_width, &scissor_height);