brw: Skip unnecessary work for trivial emit_uniformize of IMMs

If we pass an immediate, just trivially return that immediate.

This preserves the property that if x was an IMM, emit_uniformize(x)
will also be an IMM, without the need for optimizations to eliminate
unnecessary operations.  That way, you can call emit_uniformize() on
a value and still check whether it's constant afterwards.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32888>
This commit is contained in:
Kenneth Graunke
2025-01-02 00:30:36 -08:00
committed by Marge Bot
parent a0b1e07976
commit 4f0c852a4e

View File

@@ -382,6 +382,10 @@ namespace brw {
brw_reg
emit_uniformize(const brw_reg &src) const
{
/* Trivial: skip unnecessary work and retain IMM */
if (src.file == IMM)
return src;
/* FIXME: We use a vector chan_index and dst to allow constant and
* copy propagration to move result all the way into the consuming
* instruction (typically a surface index or sampler index for a