• Slang Standard Library Reference
    • Interfaces
    • Types
      • Buffer types
        • AppendStructuredBuffer
        • ByteAddressBuffer
        • ConsumeStructuredBuffer
        • RWByteAddressBuffer
        • RWStructuredBuffer
        • RasterizerOrderedByteAddressBuffer
          • GetDimensions
          • InterlockedAdd
          • InterlockedAnd
          • InterlockedCompareExchange
          • InterlockedCompareStore
          • InterlockedExchange
          • InterlockedMax
          • InterlockedMin
          • InterlockedOr
          • InterlockedXor
          • Load
          • Load2
          • Load2Aligned
          • Load3
          • Load3Aligned
          • Load4
          • Load4Aligned
          • LoadAligned
          • Store
          • Store2
          • Store2Aligned
          • Store3
          • Store3Aligned
          • Store4
          • Store4Aligned
          • StoreAligned
        • RasterizerOrderedStructuredBuffer
        • StructuredBuffer
      • Math types
      • Miscelaneous types
      • Ray-tracing
      • Sampler types
      • Scalar types
      • Stage IO types
      • Texture types
      • Array
      • Atomic
      • ConstantBuffer
      • DifferentialPair
      • DifferentialPtrPair
      • Optional
      • ParameterBlock
      • Ptr
      • String
      • Tuple
      • _AttributeTargets
    • Attributes
    • Global Declarations

RasterizerOrderedByteAddressBuffer.InterlockedCompareStore

Description

Perform a 32-bit integer atomic compare-and-store operation at the specified byte address within the RWByteAddressBuffer.

Signature

void RasterizerOrderedByteAddressBuffer.InterlockedCompareStore(
    uint dest,
    uint compare_value,
    uint value);

Parameters

dest : uint

The address at which to perform the atomic add operation.

compare_value : uint

The value to perform comparison to the value at byteAddress.

value : uint

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

Remarks

For SPIR-V, this function maps to OpAtomicCompareExchange. For HLSL, this function translates to InterlockedCompareStore. 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.

metal

Available in all stages.

spirv

Available in all stages.