summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_clone.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-02 17:58:29 -0800
committerJason Ekstrand <[email protected]>2016-02-09 15:00:17 -0800
commit5ec456375e4fdd0b6c7d797f99191044e19ead74 (patch)
treec34b2d2e4560f516ef3ab10bd798a6a3b7c469c1 /src/compiler/nir/nir_clone.c
parentee85014b90af1d94d637ec763a803479e9bac5dc (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_clone.c')
-rw-r--r--src/compiler/nir/nir_clone.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index d9c190d35e9..a666d8ee451 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -357,10 +357,15 @@ clone_tex(clone_state *state, const nir_tex_instr *tex)
ntex->is_new_style_shadow = tex->is_new_style_shadow;
memcpy(ntex->const_offset, tex->const_offset, sizeof(ntex->const_offset));
ntex->component = tex->component;
+
ntex->texture_index = tex->texture_index;
- ntex->texture_array_size = tex->texture_array_size;
if (tex->texture)
ntex->texture = clone_deref_var(state, tex->texture, &ntex->instr);
+ ntex->texture_array_size = tex->texture_array_size;
+
+ ntex->sampler_index = tex->sampler_index;
+ if (tex->sampler)
+ ntex->sampler = clone_deref_var(state, tex->sampler, &ntex->instr);
return ntex;
}