diff options
author | Karol Herbst <[email protected]> | 2019-03-24 17:11:34 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-04-12 09:02:59 +0200 |
commit | d7bbb3caf19e6e0f2dd47855babb8f5e91596e77 (patch) | |
tree | f48f3d8f27aa6ebabdc9387924eacfe504ce489e /src/compiler/glsl | |
parent | 035759b61ba1778d5143cdf3a8795a62dd5d8a60 (diff) |
glsl_to_nir: handle bindless textures
v2: add support for AMD
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]> (v1)
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 6a1a0b5f113..89edaa41d27 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -2410,10 +2410,21 @@ nir_visitor::visit(ir_texture *ir) } nir_deref_instr *sampler_deref = evaluate_deref(ir->sampler); - instr->src[0].src = nir_src_for_ssa(&sampler_deref->dest.ssa); - instr->src[0].src_type = nir_tex_src_texture_deref; - instr->src[1].src = nir_src_for_ssa(&sampler_deref->dest.ssa); - instr->src[1].src_type = nir_tex_src_sampler_deref; + + /* check for bindless handles */ + if (sampler_deref->mode != nir_var_uniform || + nir_deref_instr_get_variable(sampler_deref)->data.bindless) { + nir_ssa_def *load = nir_load_deref(&b, sampler_deref); + instr->src[0].src = nir_src_for_ssa(load); + instr->src[0].src_type = nir_tex_src_texture_handle; + instr->src[1].src = nir_src_for_ssa(load); + instr->src[1].src_type = nir_tex_src_sampler_handle; + } else { + instr->src[0].src = nir_src_for_ssa(&sampler_deref->dest.ssa); + instr->src[0].src_type = nir_tex_src_texture_deref; + instr->src[1].src = nir_src_for_ssa(&sampler_deref->dest.ssa); + instr->src[1].src_type = nir_tex_src_sampler_deref; + } unsigned src_number = 2; |