mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
pvr, pco: add support for robust buffer access
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
parent
483bfbf8aa
commit
231755f517
3 changed files with 28 additions and 0 deletions
|
|
@ -188,6 +188,8 @@ typedef struct _pco_common_data {
|
|||
bool point_sampler; /** Whether the shader uses a point sampler. */
|
||||
bool ia_sampler; /** Does the shader use an input attachment sampler? */
|
||||
} uses;
|
||||
|
||||
bool robust_buffer_access;
|
||||
} pco_common_data;
|
||||
|
||||
/** PCO shader data. */
|
||||
|
|
|
|||
|
|
@ -659,6 +659,25 @@ void pco_rev_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer)
|
|||
nir_print_shader(consumer, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
static bool robustness_filter(const nir_intrinsic_instr *intr,
|
||||
UNUSED const void *data)
|
||||
{
|
||||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_load_ubo:
|
||||
case nir_intrinsic_load_ssbo:
|
||||
case nir_intrinsic_store_ssbo:
|
||||
case nir_intrinsic_ssbo_atomic:
|
||||
case nir_intrinsic_ssbo_atomic_swap:
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Lowers a NIR shader.
|
||||
*
|
||||
|
|
@ -715,6 +734,9 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
|||
nir_address_format_32bit_offset);
|
||||
NIR_PASS(_, nir, nir_lower_io_to_scalar, nir_var_mem_shared, NULL, NULL);
|
||||
|
||||
if (data->common.robust_buffer_access)
|
||||
NIR_PASS(_, nir, nir_lower_robust_access, robustness_filter, NULL);
|
||||
|
||||
NIR_PASS(_, nir, pco_nir_lower_vk, data);
|
||||
NIR_PASS(_, nir, pco_nir_lower_io);
|
||||
NIR_PASS(_, nir, pco_nir_lower_atomics, &uses_usclib);
|
||||
|
|
|
|||
|
|
@ -2068,6 +2068,10 @@ static void pvr_init_descriptors(pco_data *data,
|
|||
nir_shader *nir,
|
||||
struct vk_pipeline_layout *layout)
|
||||
{
|
||||
const struct pvr_device *device = vk_to_pvr_device(layout->base.device);
|
||||
data->common.robust_buffer_access =
|
||||
device->vk.enabled_features.robustBufferAccess;
|
||||
|
||||
for (unsigned desc_set = 0; desc_set < layout->set_count; ++desc_set) {
|
||||
const struct pvr_descriptor_set_layout *set_layout =
|
||||
vk_to_pvr_descriptor_set_layout(layout->set_layouts[desc_set]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue