r300: Drop RADEON_DEBUG=use_tgsi.
authorEmma Anholt <emma@anholt.net>
Thu, 18 May 2023 20:20:12 +0000 (13:20 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Jun 2023 17:37:54 +0000 (17:37 +0000)
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 <alyssa@rosenzweig.io>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23114>

docs/envvars.rst
src/gallium/drivers/r300/compiler/r3xx_fragprog.c
src/gallium/drivers/r300/compiler/radeon_compiler.h
src/gallium/drivers/r300/compiler/radeon_program_alu.c
src/gallium/drivers/r300/compiler/radeon_program_alu.h
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_screen.h

index 6e6be37..21b87db 100644 (file)
@@ -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
 
index 9f058e7..d9046be 100644 (file)
@@ -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 }
        };
 
index 100f434..cbedabb 100644 (file)
@@ -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;
index 637a07b..2f933d9 100644 (file)
@@ -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.
  *
index eb522b2..05e8014 100644 (file)
@@ -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,
index dc5568d..1061bdb 100644 (file)
@@ -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 */
index 201949c..75b164a 100644 (file)
@@ -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;
index cbe6f04..b6ef2f1 100644 (file)
@@ -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:
index bcaea3c..c25e49e 100644 (file)
@@ -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)