diff options
author | Filip Gawin <filip@gawin.net> | 2022-05-17 18:10:21 +0200 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2022-05-20 09:27:03 -0700 |
commit | c5ed7faa6c03c36d6b50030aa6297cbfca9a6699 (patch) | |
tree | b6bd5e28e39f6ef6a3a64bb6a7135e7d4d7321e3 | |
parent | cdb79116c2758910c4d1f19e2ba12f1807006c68 (diff) |
r300: keep negation if w is an inline constant
(in dataflow swizzles pass)
helps with:
dEQP-GLES2.functional.shaders.random.conditionals.combined.73
on r300 and r400
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16559>
(cherry picked from commit fb2426db7a1eec78121609c0fb744c8f9cf885e9)
stable changes:
- add `#include <stdbool.h>`, required to compile
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r300/compiler/radeon_program_constants.h | 5 |
3 files changed, 14 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json index 0cf7443bde1..d112d534b31 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -748,7 +748,7 @@ "description": "r300: keep negation if w is an inline constant", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "because_sha": null }, { diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c index a16f4715c70..9113b005a59 100644 --- a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c @@ -29,6 +29,8 @@ * Tom Stellard <thomas.stellard@amd.com> */ +#include <stdbool.h> + #include "radeon_dataflow.h" #include "radeon_code.h" @@ -97,6 +99,7 @@ static unsigned try_rewrite_constant(struct radeon_compiler *c, { unsigned new_swizzle, chan, swz0, swz1, swz2, swz3, found_swizzle, swz; unsigned all_inline = 0; + bool w_inline_constant = false; float imms[4] = {0.0f, 0.0f, 0.0f, 0.0f}; if (!rc_src_reg_is_immediate(c, reg->File, reg->Index)) { @@ -321,7 +324,9 @@ static unsigned try_rewrite_constant(struct radeon_compiler *c, swz3 = GET_SWZ(reg->Swizzle, 3); /* We can skip this if the swizzle in channel w is an inline constant. */ - if (swz3 <= RC_SWIZZLE_W) { + if (is_swizzle_inline_constant(swz3)) { + w_inline_constant = true; + } else { for (chan = 0; chan < 3; chan++) { unsigned old_swz = GET_SWZ(reg->Swizzle, chan); unsigned new_swz = GET_SWZ(new_swizzle, chan); @@ -372,7 +377,7 @@ static unsigned try_rewrite_constant(struct radeon_compiler *c, * * Swizzles with a value > RC_SWIZZLE_W are inline constants. */ - if (chan == 3 && old_swz > RC_SWIZZLE_W) { + if (chan == 3 && w_inline_constant) { continue; } @@ -409,7 +414,7 @@ static unsigned try_rewrite_constant(struct radeon_compiler *c, * ONE, ZERO, HALF). */ reg->File = RC_FILE_CONSTANT; - reg->Negate = 0; + reg->Negate = w_inline_constant ? reg->Negate & (1 << 3) : 0; return 1; } diff --git a/src/gallium/drivers/r300/compiler/radeon_program_constants.h b/src/gallium/drivers/r300/compiler/radeon_program_constants.h index e54c6a892dc..6a8cbe333bf 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_constants.h +++ b/src/gallium/drivers/r300/compiler/radeon_program_constants.h @@ -115,6 +115,11 @@ typedef enum { RC_SWIZZLE_UNUSED } rc_swizzle; +static inline int is_swizzle_inline_constant(rc_swizzle swizzle){ + return swizzle >= RC_SWIZZLE_ZERO; + +} + #define RC_MAKE_SWIZZLE(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) #define RC_MAKE_SWIZZLE_SMEAR(a) RC_MAKE_SWIZZLE((a),(a),(a),(a)) #define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) |