diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2020-01-01 14:42:58 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2020-01-02 11:41:33 +0100 |
commit | 69bdc1c5fccbd9c0ef5354675b069ffb1383769e (patch) | |
tree | 7a985379fa7d64bf29e2453fa5503ddec60bf6eb /src | |
parent | 525cbe85ef522902d9e14ddc5a4b17f91f2ebea2 (diff) |
nir: Add clone/hash/serialize support for non-uniform tex instructions.
These were missed when the fields got added. Added it everywhere where
texture_index got used and it made sense.
Found this in "The Surge 2", where the inliner does not copy the fields,
resulting in corruption and hangs.
Fixes: 3bd54576415 "nir: Add a lowering pass for non-uniform resource access"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1203
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3246>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir_clone.c | 3 | ||||
-rw-r--r-- | src/compiler/nir/nir_instr_set.c | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_serialize.c | 8 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 69807e2e7a5..d1938918d5e 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -422,6 +422,9 @@ clone_tex(clone_state *state, const nir_tex_instr *tex) ntex->texture_array_size = tex->texture_array_size; ntex->sampler_index = tex->sampler_index; + ntex->texture_non_uniform = tex->texture_non_uniform; + ntex->sampler_non_uniform = tex->sampler_non_uniform; + return ntex; } diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index fdab2a4fb1e..cb0f2befa86 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -276,6 +276,8 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr) hash = HASH(hash, instr->texture_index); hash = HASH(hash, instr->texture_array_size); hash = HASH(hash, instr->sampler_index); + hash = HASH(hash, instr->texture_non_uniform); + hash = HASH(hash, instr->sampler_non_uniform); return hash; } diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index b991b1d02e2..990f778ef51 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -1440,7 +1440,9 @@ union packed_tex_data { unsigned is_shadow:1; unsigned is_new_style_shadow:1; unsigned component:2; - unsigned unused:10; /* Mark unused for valgrind. */ + unsigned texture_non_uniform:1; + unsigned sampler_non_uniform:1; + unsigned unused:8; /* Mark unused for valgrind. */ } u; }; @@ -1475,6 +1477,8 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex) .u.is_shadow = tex->is_shadow, .u.is_new_style_shadow = tex->is_new_style_shadow, .u.component = tex->component, + .u.texture_non_uniform = tex->texture_non_uniform, + .u.sampler_non_uniform = tex->sampler_non_uniform, }; blob_write_uint32(ctx->blob, packed.u32); @@ -1509,6 +1513,8 @@ read_tex(read_ctx *ctx, union packed_instr header) tex->is_shadow = packed.u.is_shadow; tex->is_new_style_shadow = packed.u.is_new_style_shadow; tex->component = packed.u.component; + tex->texture_non_uniform = packed.u.texture_non_uniform; + tex->sampler_non_uniform = packed.u.sampler_non_uniform; for (unsigned i = 0; i < tex->num_srcs; i++) { union packed_src src = read_src(ctx, &tex->src[i].src, &tex->instr); |