mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
ac/nir: Add support for planes.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
parent
dc917c8073
commit
427024bf2e
3 changed files with 26 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1089,6 +1089,13 @@ LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx,
|
|||
list = LLVMBuildPointerCast(builder, list,
|
||||
ac_array_in_const32_addr_space(ctx->v4i32), "");
|
||||
break;
|
||||
case AC_DESC_PLANE_0:
|
||||
case AC_DESC_PLANE_1:
|
||||
case AC_DESC_PLANE_2:
|
||||
/* Only used for the multiplane image support for Vulkan. Should
|
||||
* never be reached in radeonsi.
|
||||
*/
|
||||
unreachable("Plane descriptor requested in radeonsi.");
|
||||
}
|
||||
|
||||
return ac_build_load_to_sgpr(&ctx->ac, list, index);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue