summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2020-09-08 17:56:54 -0700
committerDylan Baker <dylan.c.baker@intel.com>2020-09-11 10:32:43 -0700
commitda0ed80410ee597ef2ff81bf2f159579e64398ca (patch)
treeb5c88bb77c0f4150ad5499e1d4fc1eac948cba83
parent3a09792bfcfe0ac7b50a2f9e20f1816fb23ff6f9 (diff)
nir: More NIR_MAX_VEC_COMPONENTS fixes
Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6655> (cherry picked from commit 89401e58672e1251b954662f0f776a6e9bce6df8)
-rw-r--r--.pick_status.json2
-rw-r--r--src/compiler/nir/nir_builder.h2
-rw-r--r--src/compiler/nir/nir_builtin_builder.c2
-rw-r--r--src/compiler/nir/nir_lower_io.c2
-rw-r--r--src/compiler/nir/nir_opt_copy_propagate.c2
5 files changed, 6 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 1f399150ac6..53394c6da78 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -571,7 +571,7 @@
"description": "nir: More NIR_MAX_VEC_COMPONENTS fixes",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index fd7a45a8d8c..8b1837492b2 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -929,7 +929,7 @@ nir_ssa_for_src(nir_builder *build, nir_src src, int num_components)
nir_alu_src alu = { NIR_SRC_INIT };
alu.src = src;
- for (int j = 0; j < 4; j++)
+ for (int j = 0; j < NIR_MAX_VEC_COMPONENTS; j++)
alu.swizzle[j] = j;
return nir_mov_alu(build, alu, num_components);
diff --git a/src/compiler/nir/nir_builtin_builder.c b/src/compiler/nir/nir_builtin_builder.c
index 3a66eba2c8c..690fa98da25 100644
--- a/src/compiler/nir/nir_builtin_builder.c
+++ b/src/compiler/nir/nir_builtin_builder.c
@@ -74,6 +74,8 @@ nir_fast_length(nir_builder *b, nir_ssa_def *vec)
case 2: return nir_fsqrt(b, nir_fdot2(b, vec, vec));
case 3: return nir_fsqrt(b, nir_fdot3(b, vec, vec));
case 4: return nir_fsqrt(b, nir_fdot4(b, vec, vec));
+ case 8: return nir_fsqrt(b, nir_fdot8(b, vec, vec));
+ case 16: return nir_fsqrt(b, nir_fdot16(b, vec, vec));
default:
unreachable("Invalid number of components");
}
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 58c4597c27e..d314aefb89f 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -1177,7 +1177,7 @@ nir_lower_explicit_io_instr(nir_builder *b,
if (intrin->intrinsic == nir_intrinsic_load_deref) {
nir_ssa_def *value;
if (vec_stride > scalar_size) {
- nir_ssa_def *comps[4] = { NULL, };
+ nir_ssa_def *comps[NIR_MAX_VEC_COMPONENTS] = { NULL, };
for (unsigned i = 0; i < intrin->num_components; i++) {
nir_ssa_def *comp_addr = build_addr_iadd_imm(b, addr, addr_format,
vec_stride * i);
diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c
index 2f7e4bc49f7..e67bcf3c2ef 100644
--- a/src/compiler/nir/nir_opt_copy_propagate.c
+++ b/src/compiler/nir/nir_opt_copy_propagate.c
@@ -68,7 +68,7 @@ static bool
is_swizzleless_move(nir_alu_instr *instr)
{
if (is_move(instr)) {
- for (unsigned i = 0; i < 4; i++) {
+ for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {
if (!((instr->dest.write_mask >> i) & 1))
break;
if (instr->src[0].swizzle[i] != i)