mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 14:10:09 +01:00
i965/fs_nir: Add support for indirect texture arrays
v2 Jason Ekstrand <jason.ekstrand@intel.com>: - Use the nir_tex_src_sampler_offset source type instead of the sampler_indirect thing that I cooked up before. Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
This commit is contained in:
parent
60ec60a600
commit
3c2c0a164c
1 changed files with 21 additions and 4 deletions
|
|
@ -1592,6 +1592,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
|
|||
{
|
||||
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
|
||||
unsigned sampler = instr->sampler_index;
|
||||
fs_reg sampler_reg(sampler);
|
||||
|
||||
/* FINISHME: We're failing to recompile our programs when the sampler is
|
||||
* updated. This only matters for the texture rectangle scale parameters
|
||||
|
|
@ -1662,8 +1663,24 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
|
|||
break;
|
||||
case nir_tex_src_projector:
|
||||
unreachable("should be lowered");
|
||||
case nir_tex_src_sampler_offset:
|
||||
unreachable("not yet supported");
|
||||
|
||||
case nir_tex_src_sampler_offset: {
|
||||
/* Figure out the highest possible sampler index and mark it as used */
|
||||
uint32_t max_used = sampler + instr->sampler_array_size - 1;
|
||||
if (instr->op == nir_texop_tg4 && brw->gen < 8) {
|
||||
max_used += stage_prog_data->binding_table.gather_texture_start;
|
||||
} else {
|
||||
max_used += stage_prog_data->binding_table.texture_start;
|
||||
}
|
||||
brw_mark_surface_used(prog_data, max_used);
|
||||
|
||||
/* Emit code to evaluate the actual indexing expression */
|
||||
sampler_reg = fs_reg(this, glsl_type::uint_type);
|
||||
emit(ADD(sampler_reg, src, fs_reg(sampler)))
|
||||
->force_writemask_all = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
unreachable("unknown texture source");
|
||||
}
|
||||
|
|
@ -1671,7 +1688,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
|
|||
|
||||
if (instr->op == nir_texop_txf_ms) {
|
||||
if (brw->gen >= 7 && key->tex.compressed_multisample_layout_mask & (1<<sampler))
|
||||
mcs = emit_mcs_fetch(coordinate, instr->coord_components, fs_reg(sampler));
|
||||
mcs = emit_mcs_fetch(coordinate, instr->coord_components, sampler_reg);
|
||||
else
|
||||
mcs = fs_reg(0u);
|
||||
}
|
||||
|
|
@ -1722,7 +1739,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
|
|||
emit_texture(op, dest_type, coordinate, instr->coord_components,
|
||||
shadow_comparitor, lod, lod2, lod_components, sample_index,
|
||||
offset, offset_components, mcs, gather_component,
|
||||
is_cube_array, is_rect, sampler, fs_reg(sampler), texunit);
|
||||
is_cube_array, is_rect, sampler, sampler_reg, texunit);
|
||||
|
||||
fs_reg dest = get_nir_dest(instr->dest);
|
||||
dest.type = this->result.type;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue