From 32b8d0c19d2bb19896b230d1c312aaedde1e44f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 20 Feb 2023 00:25:01 -0500 Subject: [PATCH] radeonsi: correct and clean up obsolete vs_state_bits comments Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader.h | 9 ++++++++- .../drivers/radeonsi/si_shader_internal.h | 17 +---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 91786572033..2dfcb170443 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -260,12 +260,19 @@ enum */ /* bit gap */ #define VS_STATE_LS_OUT_VERTEX_SIZE__SHIFT 24 -#define VS_STATE_LS_OUT_VERTEX_SIZE__MASK 0xff +#define VS_STATE_LS_OUT_VERTEX_SIZE__MASK 0xff /* max 32 * 4 + 1 */ /* These fields are only set in current_gs_state in si_context, and they are accessible * in the shader via vs_state_bits in legacy GS, the GS copy shader, and any NGG shader. */ /* bit gap */ +/* Small prim filter precision = num_samples / quant_mode, which can only be equal to 1/2^n + * where n is between 4 and 12. Knowing that, we only need to store 4 bits of the FP32 exponent. + * Set it like this: value = (fui(num_samples / quant_mode) >> 23) & 0xf; + * Expand to FP32 like this: ((0x70 | value) << 23); + * With 0x70 = 112, we get 2^(112 + value - 127) = 2^(value - 15), which is always a negative + * exponent and it's equal to 1/2^(15 - value). + */ #define GS_STATE_SMALL_PRIM_PRECISION_NO_AA__SHIFT 18 #define GS_STATE_SMALL_PRIM_PRECISION_NO_AA__MASK 0xf #define GS_STATE_SMALL_PRIM_PRECISION__SHIFT 22 diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index c7aab664abc..98fa3c2d8af 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -50,22 +50,7 @@ struct si_shader_args { /* API VS */ struct ac_arg vb_descriptors[5]; struct ac_arg vertex_index0; - /* VS states and layout of LS outputs / TCS inputs at the end - * [0] = clamp vertex color - * [1] = indexed - * [2:3] = NGG: output primitive type - * [4:5] = NGG: provoking vertex index - * [6] = NGG: streamout queries enabled - * [7:10] = NGG: small prim filter precision = num_samples / quant_mode, - * but in reality it's: 1/2^n, from 1/16 to 1/4096 = 1/2^4 to 1/2^12 - * Only the first 4 bits of the exponent are stored. - * Set it like this: (fui(num_samples / quant_mode) >> 23) - * Expand to FP32 like this: ((0x70 | value) << 23); - * With 0x70 = 112, we get 2^(112 + value - 127) = 2^(value - 15) - * = 1/2^(15 - value) in FP32 - * [24:31] = stride between vertices in DW = num_inputs * 4 - * max = 32*4 - */ + /* VS state bits. See the VS_STATE_* and GS_STATE_* definitions. */ struct ac_arg vs_state_bits; struct ac_arg vs_blit_inputs;