From ae777b1836715d8a775208f49048440ce17e76d4 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 18 May 2023 13:20:12 -0700 Subject: [PATCH] r300: Drop RADEON_DEBUG=use_tgsi. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The NIR path is default, and well-trodden at this point. By dropping support for input as TGSI, we get rely on the NIR trig lowering. Reviewed-by: Alyssa Rosenzweig Acked-by: Marek Olšák Reviewed-by: Pavel Ondračka Part-of: --- docs/envvars.rst | 2 -- src/gallium/drivers/r300/compiler/r3xx_fragprog.c | 1 - .../drivers/r300/compiler/radeon_compiler.h | 1 - .../drivers/r300/compiler/radeon_program_alu.c | 37 ---------------------- .../drivers/r300/compiler/radeon_program_alu.h | 5 --- src/gallium/drivers/r300/r300_debug.c | 1 - src/gallium/drivers/r300/r300_fs.c | 1 - src/gallium/drivers/r300/r300_screen.c | 2 +- src/gallium/drivers/r300/r300_screen.h | 1 - 9 files changed, 1 insertion(+), 50 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 6e6be37..21b87db 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1615,8 +1615,6 @@ r300 driver environment variables Disable hierarchical zbuffer ``nocmask`` Disable AA compression and fast AA clear - ``use_tgsi`` - Request TGSI shaders from the state tracker ``notcl`` Disable hardware accelerated Transform/Clip/Lighting diff --git a/src/gallium/drivers/r300/compiler/r3xx_fragprog.c b/src/gallium/drivers/r300/compiler/r3xx_fragprog.c index 9f058e7..d9046be 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_fragprog.c +++ b/src/gallium/drivers/r300/compiler/r3xx_fragprog.c @@ -85,7 +85,6 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) struct radeon_program_transformation native_rewrite_r500[] = { { &radeonTransformALU, NULL }, { &radeonTransformDeriv, NULL }, - { &radeonTransformTrigScale, NULL }, { NULL, NULL } }; diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h index 100f434..cbedabb 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.h +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h @@ -56,7 +56,6 @@ struct radeon_compiler { unsigned has_presub:1; unsigned has_omod:1; unsigned disable_optimizations:1; - unsigned needs_trig_input_transform:1; unsigned max_temp_regs; unsigned max_constants; int max_alu_insts; diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c index 637a07b..2f933d9 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c +++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c @@ -1036,43 +1036,6 @@ static void r300_transform_SIN_COS(struct radeon_compiler *c, rc_remove_instruction(inst); } - -/** - * Transform the trigonometric functions COS and SIN - * to include pre-scaling by 1/(2*PI) and taking the fractional - * part, so that the input to COS and SIN is always in the range [0,1). - * - * @warning This transformation implicitly changes the semantics of SIN and COS! - */ -int radeonTransformTrigScale(struct radeon_compiler* c, - struct rc_instruction* inst, - void* unused) -{ - static const float RCP_2PI = 0.15915494309189535; - unsigned int temp; - unsigned int constant; - unsigned int constant_swizzle; - - if (inst->U.I.Opcode != RC_OPCODE_COS && - inst->U.I.Opcode != RC_OPCODE_SIN) - return 0; - - if (!c->needs_trig_input_transform) - return 1; - - temp = rc_find_free_temporary(c); - constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle); - - emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, dstregtmpmask(temp, RC_MASK_W), - swizzle_xxxx(inst->U.I.SrcReg[0]), - srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)); - emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W), - srcreg(RC_FILE_TEMPORARY, temp)); - - r300_transform_SIN_COS(c, inst, temp); - return 1; -} - /** * Replaces DDX/DDY instructions with MOV 0 to avoid using dummy shaders on r300/r400. * diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.h b/src/gallium/drivers/r300/compiler/radeon_program_alu.h index eb522b2..05e8014 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_alu.h +++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.h @@ -45,11 +45,6 @@ int r300_transform_trig_simple( struct rc_instruction * inst, void*); -int radeonTransformTrigScale( - struct radeon_compiler * c, - struct rc_instruction * inst, - void*); - int r300_transform_trig_scale_vertex( struct radeon_compiler *c, struct rc_instruction *inst, diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index dc5568d..1061bdb 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -50,7 +50,6 @@ static const struct debug_named_value r300_debug_options[] = { { "nozmask", DBG_NO_ZMASK, "Disable zbuffer compression" }, { "nohiz", DBG_NO_HIZ, "Disable hierarchical zbuffer" }, { "nocmask", DBG_NO_CMASK, "Disable AA compression and fast AA clear" }, - { "use_tgsi", DBG_USE_TGSI, "Request TGSI shaders from the state tracker" }, { "notcl", DBG_NO_TCL, "Disable hardware accelerated Transform/Clip/Lighting" }, /* must be last */ diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 201949c..75b164a 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -456,7 +456,6 @@ static void r300_translate_fragment_shader( compiler.Base.has_half_swizzles = TRUE; compiler.Base.has_presub = TRUE; compiler.Base.has_omod = TRUE; - compiler.Base.needs_trig_input_transform = DBG_ON(r300, DBG_USE_TGSI); compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : (compiler.Base.is_r400 ? 64 : 32); compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index cbe6f04..b6ef2f1 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -256,7 +256,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, switch (param) { case PIPE_SHADER_CAP_PREFERRED_IR: - return (r300screen->debug & DBG_USE_TGSI) ? PIPE_SHADER_IR_TGSI : PIPE_SHADER_IR_NIR; + return PIPE_SHADER_IR_NIR; case PIPE_SHADER_CAP_SUPPORTED_IRS: return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI); default: diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index bcaea3c..c25e49e 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -103,7 +103,6 @@ radeon_winsys(struct pipe_screen *screen) { #define DBG_NO_ZMASK (1 << 21) #define DBG_NO_HIZ (1 << 22) #define DBG_NO_CMASK (1 << 23) -#define DBG_USE_TGSI (1 << 24) #define DBG_NO_TCL (1 << 25) /*@}*/ static inline boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags) -- 2.7.4