From 955444e0686a551500a3bb22c8a081c8ec84ac22 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 6 Apr 2024 23:14:43 -0400 Subject: [PATCH] svga: Fix instanced draw detection The new GTK+ GL renderer is extensively using instanced rendering. SVGA driver was incorrectly detecting the instanced draws by only checking whether the instance count was greater than 1. Base instance has to be also checked to make sure that the draw correctly offsets the vertex buffer. Fix instanced draw detection by checking both the instance count and the base instance. Fixes the new GTK+ 4 GL renderer. Signed-off-by: Zack Rusin Fixes: ccb4ea5a43e ("svga: Add GL4.1(compatibility profile) support in svga driver") Reviewed-by: Neha Bhende Part-of: --- src/gallium/drivers/svga/svga_draw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index ebdcca3df7f..d945d8b4269 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -1006,6 +1006,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, struct svga_context *svga = hwtnl->svga; struct svga_winsys_surface *indirect_handle; enum pipe_error ret; + bool is_instanced_draw = instance_count > 1 || start_instance > 0; assert(svga_have_vgpu10(svga)); assert(hwtnl->cmd.prim_count == 0); @@ -1096,7 +1097,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, indirect_handle, indirect->offset); } - else if (instance_count > 1) { + else if (is_instanced_draw) { ret = SVGA3D_vgpu10_DrawIndexedInstanced(svga->swc, vcount, instance_count, @@ -1139,7 +1140,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, indirect_handle, indirect->offset); } - else if (instance_count > 1) { + else if (is_instanced_draw) { ret = SVGA3D_vgpu10_DrawInstanced(svga->swc, vcount, instance_count,