RWByteAddressBuffer.InterlockedCompareExchangeU64

Description

Perform a 64-bit integer atomic compare-and-exchange operation at byteAddress.

Signature

void RWByteAddressBuffer.InterlockedCompareExchangeU64(
    uint byteAddress,
    uint64_t compareValue,
    uint64_t value,
    out uint64_t outOriginalValue);

Parameters

byteAddress : uint

The address at which to perform the atomic compare-and-exchange operation.

compareValue : uint64_t

The value to compare to the value at byteAddress.

value : uint64_t

The value to store at byteAddress if the comparison is successful.

outOriginalValue : uint64_t

The original value at byteAddress before the add operation.

Remarks

For SPIR-V, this function maps to OpAtomicCompareExchange. For HLSL, this function translates to InterlockedCompareExchange64 and requires shader model 6.6. For CUDA, this function maps to atomicCAS.

Availability and Requirements

Defined for the following targets:

hlsl

Available in all stages.

glsl

Available in all stages.

cuda

Available in all stages.

spirv

Available in all stages.

Requires capability: spvInt64Atomics.