From 882ad3fa3e73556ae8260cc3267a0dcb36534854 Mon Sep 17 00:00:00 2001 From: Maaz Mombasawala Date: Mon, 11 Nov 2024 19:02:28 -0800 Subject: [PATCH] svga: Add all tgsi double instructions for shader codegen checks During translation of tgsi shaders to vgpu10 shader code that is sent to svga device, we may get as input a double instruction with incorrect swizzles such as xzxz. In this case we have a workaround to move the value in that register to a temporary register with an xyzw swizzle. However the functions that check if the instruction has double source or destination did not check for all instructions, such as DDIV, so if incorrect swizzles are sent in the shader tgsi code then the same incorrect swizzle is also emitted in the vgpu10 shader code. Fix this by adding all the double instructions in double checking functions. Signed-off-by: Maaz Mombasawala Part-of: --- src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index a251f7e5e9f..41e7f9dd7e5 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2024 Broadcom. All Rights Reserved. + * Copyright (c) 1998-2025 Broadcom. All Rights Reserved. * The term “Broadcom” refers to Broadcom Inc. * and/or its subsidiaries. * SPDX-License-Identifier: MIT @@ -9292,7 +9292,16 @@ opcode_has_dbl_dst(unsigned opcode) case TGSI_OPCODE_I2D: case TGSI_OPCODE_U2D: case TGSI_OPCODE_DFMA: - // XXX more TBD + case TGSI_OPCODE_DTRUNC: + case TGSI_OPCODE_DCEIL: + case TGSI_OPCODE_DROUND: + case TGSI_OPCODE_DSSG: + case TGSI_OPCODE_DLDEXP: + case TGSI_OPCODE_DMAD: + case TGSI_OPCODE_DDIV: + case TGSI_OPCODE_DRCP: + case TGSI_OPCODE_DSQRT: + case TGSI_OPCODE_DRSQ: return true; default: return false; @@ -9332,6 +9341,7 @@ opcode_has_dbl_src(unsigned opcode) case TGSI_OPCODE_DFLR: case TGSI_OPCODE_DROUND: case TGSI_OPCODE_DSSG: + case TGSI_OPCODE_DDIV: return true; default: return false;