mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
panfrost: add sysval for number of samples
Not really used yet, but we will need it later when we change how we lower multisampled image arrays. Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40460>
This commit is contained in:
parent
54860bb4c7
commit
89288722e7
4 changed files with 32 additions and 0 deletions
|
|
@ -1110,6 +1110,25 @@ panfrost_upload_txs_sysval(struct panfrost_batch *batch,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_upload_image_samples_sysval(struct panfrost_batch *batch,
|
||||
mesa_shader_stage st,
|
||||
unsigned int sysvalid,
|
||||
struct sysval_uniform *uniform)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
unsigned idx = PAN_SYSVAL_ID_TO_TXS_TEX_IDX(sysvalid);
|
||||
|
||||
struct pipe_image_view *image = &ctx->images[st][idx];
|
||||
|
||||
if (image->resource->target == PIPE_BUFFER) {
|
||||
uniform->i[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
uniform->i[0] = image->resource->nr_samples;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_upload_image_size_sysval(struct panfrost_batch *batch,
|
||||
mesa_shader_stage st,
|
||||
|
|
@ -1360,6 +1379,10 @@ panfrost_upload_sysvals(struct panfrost_batch *batch, void *ptr_cpu,
|
|||
panfrost_upload_image_size_sysval(batch, st, PAN_SYSVAL_ID(sysval),
|
||||
&uniforms[i]);
|
||||
break;
|
||||
case PAN_SYSVAL_IMAGE_SAMPLES:
|
||||
panfrost_upload_image_samples_sysval(batch, st, PAN_SYSVAL_ID(sysval),
|
||||
&uniforms[i]);
|
||||
break;
|
||||
case PAN_SYSVAL_SAMPLE_POSITIONS:
|
||||
panfrost_upload_sample_positions_sysval(batch, &uniforms[i]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ enum {
|
|||
PAN_SYSVAL_XFB = 17,
|
||||
PAN_SYSVAL_NUM_VERTICES = 18,
|
||||
PAN_SYSVAL_PRINTF_BUFFER = 19,
|
||||
PAN_SYSVAL_IMAGE_SAMPLES = 20,
|
||||
};
|
||||
|
||||
#define PAN_TXS_SYSVAL_ID(texidx, dim, is_array) \
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ panfrost_analyze_sysvals(struct panfrost_compiled_shader *ss)
|
|||
break;
|
||||
|
||||
case PAN_SYSVAL_IMAGE_SIZE:
|
||||
case PAN_SYSVAL_IMAGE_SAMPLES:
|
||||
dirty_shader |= PAN_DIRTY_STAGE_IMAGE;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,13 @@ sysval_for_intrinsic(unsigned arch, nir_intrinsic_instr *intr, unsigned *offset)
|
|||
return PAN_SYSVAL(RT_CONVERSION, rt | (size << 4));
|
||||
}
|
||||
|
||||
case nir_intrinsic_image_samples: {
|
||||
uint32_t uindex = nir_src_as_uint(intr->src[0]);
|
||||
bool is_array = nir_intrinsic_image_array(intr);
|
||||
unsigned dim = nir_intrinsic_dest_components(intr) - is_array;
|
||||
|
||||
return PAN_SYSVAL(IMAGE_SAMPLES, PAN_TXS_SYSVAL_ID(uindex, dim, is_array));
|
||||
}
|
||||
case nir_intrinsic_image_size: {
|
||||
uint32_t uindex = nir_src_as_uint(intr->src[0]);
|
||||
bool is_array = nir_intrinsic_image_array(intr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue