diff options
author | Jason Ekstrand <[email protected]> | 2015-11-02 17:58:29 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-09 15:00:17 -0800 |
commit | 5ec456375e4fdd0b6c7d797f99191044e19ead74 (patch) | |
tree | c34b2d2e4560f516ef3ab10bd798a6a3b7c469c1 /src/compiler/nir/nir_instr_set.c | |
parent | ee85014b90af1d94d637ec763a803479e9bac5dc (diff) |
nir: Separate texture from sampler in nir_tex_instr
This commit adds the capability to NIR to support separate textures and
samplers. As it currently stands, glsl_to_nir only sets the texture deref
and leaves the sampler deref alone as it did before and nir_lower_samplers
assumes this. Backends can still assume that they are combined and only
look at only at the texture index. Or, if they wish, they can assume that
they are separate because nir_lower_samplers, tgsi_to_nir, and prog_to_nir
all set both texture and sampler index whenever a sampler is required (the
two indices are the same in this case).
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_instr_set.c')
-rw-r--r-- | src/compiler/nir/nir_instr_set.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 4489a881905..c3cf2579be7 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -157,8 +157,9 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr) hash = HASH(hash, component); hash = HASH(hash, instr->texture_index); hash = HASH(hash, instr->texture_array_size); + hash = HASH(hash, instr->sampler_index); - assert(!instr->texture); + assert(!instr->texture && !instr->sampler); return hash; } @@ -306,12 +307,14 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) sizeof(tex1->const_offset)) != 0 || tex1->component != tex2->component || tex1->texture_index != tex2->texture_index || - tex1->texture_array_size != tex2->texture_array_size) { + tex1->texture_array_size != tex2->texture_array_size || + tex1->sampler_index != tex2->sampler_index) { return false; } - /* Don't support un-lowered texture derefs currently. */ - assert(!tex1->texture && !tex2->texture); + /* Don't support un-lowered sampler derefs currently. */ + assert(!tex1->texture && !tex1->sampler && + !tex2->texture && !tex2->sampler); return true; } @@ -421,8 +424,8 @@ instr_can_rewrite(nir_instr *instr) case nir_instr_type_tex: { nir_tex_instr *tex = nir_instr_as_tex(instr); - /* Don't support un-lowered texture derefs currently. */ - if (tex->texture) + /* Don't support un-lowered sampler derefs currently. */ + if (tex->texture || tex->sampler) return false; return true; |