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 <kenneth@whitecape.org>
This commit is contained in:
@@ -625,6 +625,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
||||
case nir_tex_src_texture_offset:
|
||||
fprintf(fp, "(texture_offset)");
|
||||
break;
|
||||
case nir_tex_src_sampler_offset:
|
||||
fprintf(fp, "(sampler_offset)");
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Invalid texture source type");
|
||||
@@ -654,11 +657,16 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
||||
|
||||
if (instr->texture) {
|
||||
print_deref(instr->texture, state);
|
||||
fprintf(fp, " (texture)");
|
||||
if (instr->sampler) {
|
||||
print_deref(instr->sampler, state);
|
||||
fprintf(fp, " (sampler)");
|
||||
}
|
||||
} else {
|
||||
fprintf(fp, "%u", instr->texture_index);
|
||||
assert(instr->sampler == NULL);
|
||||
fprintf(fp, "%u (texture) %u (sampler)",
|
||||
instr->texture_index, instr->sampler_index);
|
||||
}
|
||||
|
||||
fprintf(fp, " (texture)");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user