nvk: Fix scissor bounds

This code is old, copied from the old nouveau GL driver.  As of Pascal,
we have have 32k images so we need 32k scissors as well.  Use the
max_image_dimension() helper instead of hard-coding it.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33478>
This commit is contained in:
Faith Ekstrand 2025-02-10 10:24:14 -06:00 committed by Marge Bot
parent 18f0807408
commit 6f64962f27

View file

@ -1782,7 +1782,8 @@ nvk_flush_ts_state(struct nvk_cmd_buffer *cmd)
static void
nvk_flush_vp_state(struct nvk_cmd_buffer *cmd)
{
const struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct vk_dynamic_graphics_state *dyn =
&cmd->vk.dynamic_graphics_state;
@ -1891,13 +1892,16 @@ nvk_flush_vp_state(struct nvk_cmd_buffer *cmd)
}
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_SCISSORS)) {
const uint32_t sr_max =
nvk_image_max_dimension(&pdev->info, VK_IMAGE_TYPE_2D);
for (unsigned i = 0; i < dyn->vp.scissor_count; i++) {
const VkRect2D *s = &dyn->vp.scissors[i];
const uint32_t xmin = MIN2(16384, s->offset.x);
const uint32_t xmax = MIN2(16384, s->offset.x + s->extent.width);
const uint32_t ymin = MIN2(16384, s->offset.y);
const uint32_t ymax = MIN2(16384, s->offset.y + s->extent.height);
const uint32_t xmin = MIN2(sr_max, s->offset.x);
const uint32_t xmax = MIN2(sr_max, s->offset.x + s->extent.width);
const uint32_t ymin = MIN2(sr_max, s->offset.y);
const uint32_t ymax = MIN2(sr_max, s->offset.y + s->extent.height);
P_MTHD(p, NV9097, SET_SCISSOR_ENABLE(i));
P_NV9097_SET_SCISSOR_ENABLE(p, i, V_TRUE);