diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 12 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 19 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 3d2f738edec..f5440d19e83 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3498,9 +3498,17 @@ static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx, bool bindless = false; if (!deref_instr) { - assert(tex_instr && !image); + int sampSrcIdx = nir_tex_instr_src_index(tex_instr, + nir_tex_src_sampler_handle); descriptor_set = 0; - base_index = tex_instr->sampler_index; + if (sampSrcIdx != -1) { + base_index = 0; + bindless = true; + index = get_src(ctx, tex_instr->src[sampSrcIdx].src); + } else { + assert(tex_instr && !image); + base_index = tex_instr->sampler_index; + } } else { while(deref_instr->deref_type != nir_deref_type_var) { if (deref_instr->deref_type == nir_deref_type_array) { 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; |