diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-03-30 03:15:32 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-04-25 19:56:20 +0000 |
commit | 427024bf2e9a0464fae1481d81c59579fcc506cf (patch) | |
tree | 74aa0dbe3d953f5c3b4d53cc2cf1e4a7ffcc0f5f /src/amd/common | |
parent | dc917c80736715ac271471289f04654f1d578158 (diff) |
ac/nir: Add support for planes.
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 20 | ||||
-rw-r--r-- | src/amd/common/ac_shader_abi.h | 3 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 78f25b8e742..92aea7df9bf 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3593,6 +3593,7 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx, { nir_deref_instr *texture_deref_instr = NULL; nir_deref_instr *sampler_deref_instr = NULL; + int plane = -1; for (unsigned i = 0; i < instr->num_srcs; i++) { switch (instr->src[i].src_type) { @@ -3602,6 +3603,9 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx, case nir_tex_src_sampler_deref: sampler_deref_instr = nir_src_as_deref(instr->src[i].src); break; + case nir_tex_src_plane: + plane = nir_src_as_int(instr->src[i].src); + break; default: break; } @@ -3610,10 +3614,18 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx, if (!sampler_deref_instr) sampler_deref_instr = texture_deref_instr; - if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) - *res_ptr = get_sampler_desc(ctx, texture_deref_instr, AC_DESC_BUFFER, &instr->instr, false, false); - else - *res_ptr = get_sampler_desc(ctx, texture_deref_instr, AC_DESC_IMAGE, &instr->instr, false, false); + enum ac_descriptor_type main_descriptor = instr->sampler_dim == GLSL_SAMPLER_DIM_BUF ? AC_DESC_BUFFER : AC_DESC_IMAGE; + + if (plane >= 0) { + assert(instr->op != nir_texop_txf_ms && + instr->op != nir_texop_samples_identical); + assert(instr->sampler_dim != GLSL_SAMPLER_DIM_BUF); + + main_descriptor = AC_DESC_PLANE_0 + plane; + } + + *res_ptr = get_sampler_desc(ctx, texture_deref_instr, main_descriptor, &instr->instr, false, false); + if (samp_ptr) { *samp_ptr = get_sampler_desc(ctx, sampler_deref_instr, AC_DESC_SAMPLER, &instr->instr, false, false); if (instr->sampler_dim < GLSL_SAMPLER_DIM_RECT) diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h index c9b2c2eb4b8..108fe58ce57 100644 --- a/src/amd/common/ac_shader_abi.h +++ b/src/amd/common/ac_shader_abi.h @@ -39,6 +39,9 @@ enum ac_descriptor_type { AC_DESC_FMASK, AC_DESC_SAMPLER, AC_DESC_BUFFER, + AC_DESC_PLANE_0, + AC_DESC_PLANE_1, + AC_DESC_PLANE_2, }; /* Document the shader ABI during compilation. This is what allows radeonsi and |