aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
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/mesa
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/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp3
-rw-r--r--src/mesa/program/prog_to_nir.c1
3 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index ecca3ef7183..1a2c39f4b35 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -3024,6 +3024,9 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
break;
}
+ case nir_tex_src_sampler_offset:
+ break; /* Ignored for now */
+
default:
unreachable("unknown texture source");
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 40a7530d940..41d20ff0d13 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -1738,6 +1738,9 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
break;
}
+ case nir_tex_src_sampler_offset:
+ break; /* Ignored for now */
+
case nir_tex_src_projector:
unreachable("Should be lowered by do_lower_texture_projection");
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 93a167e0aa1..74cbbfb1cc6 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -610,6 +610,7 @@ ptn_tex(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src,
instr->dest_type = nir_type_float;
instr->is_shadow = prog_inst->TexShadow;
instr->texture_index = prog_inst->TexSrcUnit;
+ instr->sampler_index = prog_inst->TexSrcUnit;
switch (prog_inst->TexSrcTarget) {
case TEXTURE_1D_INDEX: