summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorPavel Ondračka <pavel.ondracka@gmail.com>2022-10-05 21:22:05 +0200
committerMarge Bot <emma+marge@anholt.net>2023-01-16 19:57:13 +0000
commite86c7ac9f4b23769f3dcbaf3267d46436749315b (patch)
tree56ec7eac4830a8ebe983c1291626383bde253902 /src/gallium/drivers/r300
parentd8f59b14d03cff23467dff834780a2613e5dab5f (diff)
r300: remove backend input range transformation for sin and cos
We already do this in NIR since a04aa4bc08df2c3772fc7dda6766f76ef3a5dfb4 and 3f97306b956f707d637da6b76dd9465fcabfc451 so there is no effect for the mesa state tracker now that it can not emit TGSI any more. This leaves only nine when RADEON_DEBUG=use_tgsi is set. D3D9 however requires that sin and cos inputs already have the proper range. This is super important when the nine shader uses relative adressing and therefore needs all 256 constants we have. If we add our extra constants for the fixup, we get over the limit and fail compilation. v2: vertex shaders only Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Reviewed-by: Filip Gawin <filip@gawin.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18933>
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/compiler/r3xx_vertprog.c1
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_program_alu.c42
-rw-r--r--src/gallium/drivers/r300/r300_vs.c1
3 files changed, 0 insertions, 44 deletions
diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
index e8e3712bffc..ceb590ea085 100644
--- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
+++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
@@ -878,7 +878,6 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
/* Lists of instruction transformations. */
struct radeon_program_transformation alu_rewrite_r500[] = {
{ &r300_transform_vertex_alu, NULL },
- { &r300_transform_trig_scale_vertex, NULL },
{ NULL, NULL }
};
diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
index c28cebce3a4..4f2c5081c62 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
@@ -1037,48 +1037,6 @@ int radeonTransformTrigScale(struct radeon_compiler* c,
}
/**
- * Transform the trigonometric functions COS and SIN
- * so that the input to COS and SIN is always in the range [-PI, PI].
- */
-int r300_transform_trig_scale_vertex(struct radeon_compiler *c,
- struct rc_instruction *inst,
- void *unused)
-{
- static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979};
- unsigned int temp;
- unsigned int constant;
-
- 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;
-
- /* Repeat x in the range [-PI, PI]:
- *
- * repeat(x) = frac(x / 2PI + 0.5) * 2PI - PI
- */
-
- temp = rc_find_free_temporary(c);
- constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons);
-
- emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
- swizzle_xxxx(inst->U.I.SrcReg[0]),
- srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_XXXX),
- srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_YYYY));
- emit1(c, inst->Prev, RC_OPCODE_FRC, NULL, dstregtmpmask(temp, RC_MASK_W),
- srcreg(RC_FILE_TEMPORARY, temp));
- emit3(c, inst->Prev, RC_OPCODE_MAD, NULL, dstregtmpmask(temp, RC_MASK_W),
- srcreg(RC_FILE_TEMPORARY, temp),
- srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_ZZZZ),
- srcregswz(RC_FILE_CONSTANT, constant, RC_SWIZZLE_WWWW));
-
- r300_transform_SIN_COS(c, inst, temp);
- return 1;
-}
-
-/**
* Replaces DDX/DDY instructions with MOV 0 to avoid using dummy shaders on r300/r400.
*
* @warning This explicitly changes the form of DDX and DDY!
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index dfa26de1c84..106d5520d41 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -201,7 +201,6 @@ void r300_translate_vertex_shader(struct r300_context *r300,
compiler.Base.has_half_swizzles = FALSE;
compiler.Base.has_presub = FALSE;
compiler.Base.has_omod = FALSE;
- compiler.Base.needs_trig_input_transform = DBG_ON(r300, DBG_USE_TGSI);
compiler.Base.max_temp_regs = 32;
compiler.Base.max_constants = 256;
compiler.Base.max_alu_insts = r300->screen->caps.is_r500 ? 1024 : 256;