*/
#include "util/mesa-sha1.h"
+#include "util/u_atomic.h"
#include "radv_private.h"
#include "nir/nir.h"
#include "nir/nir_builder.h"
void radv_shader_variant_destroy(struct radv_device *device,
struct radv_shader_variant *variant)
{
- if (__sync_fetch_and_sub(&variant->ref_count, 1) != 1)
+ if (!p_atomic_dec_zero(&variant->ref_count))
return;
device->ws->buffer_destroy(variant->bo);
#include "util/mesa-sha1.h"
#include "util/debug.h"
+#include "util/u_atomic.h"
#include "radv_private.h"
#include "ac_nir_to_llvm.h"
entry->variant = variant;
}
- __sync_fetch_and_add(&entry->variant->ref_count, 1);
+ p_atomic_inc(&entry->variant->ref_count);
return entry->variant;
}
} else {
entry->variant = variant;
}
- __sync_fetch_and_add(&variant->ref_count, 1);
+ p_atomic_inc(&variant->ref_count);
pthread_mutex_unlock(&cache->mutex);
return variant;
}
entry->rsrc2 = variant->rsrc2;
entry->code_size = code_size;
entry->variant = variant;
- __sync_fetch_and_add(&variant->ref_count, 1);
+ p_atomic_inc(&variant->ref_count);
radv_pipeline_cache_add_entry(cache, entry);