spirv: Give atomic counters their own variable mode
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5278>
This commit is contained in:
@@ -3161,7 +3161,7 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
||||
}
|
||||
|
||||
/* uniform as "atomic counter uniform" */
|
||||
if (ptr->mode == vtn_variable_mode_uniform) {
|
||||
if (ptr->mode == vtn_variable_mode_atomic_counter) {
|
||||
nir_deref_instr *deref = vtn_pointer_to_deref(b, ptr);
|
||||
nir_intrinsic_op op = get_uniform_nir_atomic_op(b, opcode);
|
||||
atomic = nir_intrinsic_instr_create(b->nb.shader, op);
|
||||
|
@@ -467,6 +467,7 @@ enum vtn_variable_mode {
|
||||
vtn_variable_mode_function,
|
||||
vtn_variable_mode_private,
|
||||
vtn_variable_mode_uniform,
|
||||
vtn_variable_mode_atomic_counter,
|
||||
vtn_variable_mode_ubo,
|
||||
vtn_variable_mode_ssbo,
|
||||
vtn_variable_mode_phys_ssbo,
|
||||
|
@@ -1845,7 +1845,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
|
||||
nir_mode = nir_var_mem_shared;
|
||||
break;
|
||||
case SpvStorageClassAtomicCounter:
|
||||
mode = vtn_variable_mode_uniform;
|
||||
mode = vtn_variable_mode_atomic_counter;
|
||||
nir_mode = nir_var_uniform;
|
||||
break;
|
||||
case SpvStorageClassCrossWorkgroup:
|
||||
@@ -1897,6 +1897,7 @@ vtn_mode_to_address_format(struct vtn_builder *b, enum vtn_variable_mode mode)
|
||||
|
||||
case vtn_variable_mode_private:
|
||||
case vtn_variable_mode_uniform:
|
||||
case vtn_variable_mode_atomic_counter:
|
||||
case vtn_variable_mode_input:
|
||||
case vtn_variable_mode_output:
|
||||
case vtn_variable_mode_image:
|
||||
@@ -2190,11 +2191,12 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
|
||||
case vtn_variable_mode_function:
|
||||
case vtn_variable_mode_private:
|
||||
case vtn_variable_mode_uniform:
|
||||
case vtn_variable_mode_atomic_counter:
|
||||
/* For these, we create the variable normally */
|
||||
var->var = rzalloc(b->shader, nir_variable);
|
||||
var->var->name = ralloc_strdup(var->var, val->name);
|
||||
|
||||
if (storage_class == SpvStorageClassAtomicCounter) {
|
||||
if (var->mode == vtn_variable_mode_atomic_counter) {
|
||||
/* Need to tweak the nir type here as at vtn_handle_type we don't
|
||||
* have the access to storage_class, that is the one that points us
|
||||
* that is an atomic uint.
|
||||
|
Reference in New Issue
Block a user