r300: set ubo_vec4_max ntt option properly

Besides making sure we don't overflow our reg index, this also prevents
constant folding resulting in negative relative offset in nir_opt_offsets.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20672>
This commit is contained in:
Pavel Ondračka
2023-01-11 14:28:08 +01:00
committed by Marge Bot
parent cd18d541de
commit 7bec63c024
2 changed files with 4 additions and 0 deletions

View File

@@ -1951,9 +1951,11 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
static const struct nir_to_tgsi_options hwtcl_r300_options = {
.lower_cmp = true,
.lower_fabs = true,
.ubo_vec4_max = 0x00ff,
};
static const struct nir_to_tgsi_options hwtcl_r500_options = {
.lower_cmp = true,
.ubo_vec4_max = 0x00ff,
};
const struct nir_to_tgsi_options *ntt_options;
if (r300->screen->caps.has_tcl) {

View File

@@ -177,6 +177,8 @@ static void transform_srcreg(
{
dst->File = translate_register_file(src->Register.File);
dst->Index = translate_register_index(ttr, src->Register.File, src->Register.Index);
/* Negative offsets to relative addressing should have been lowered in NIR */
assert(dst->Index >= 0);
dst->RelAddr = src->Register.Indirect;
dst->Swizzle = tgsi_util_get_full_src_register_swizzle(src, 0);
dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 1) << 3;