InterlockedCompareStore function

Atomically compares the destination to the comparison value. If they are identical, the destination is overwritten with the input value.

Syntax

void InterlockedCompareStore(
  in R dest,
  in T compare_value,
  in T value
);

Parameters

dest [in]

Type: R

The destination address.

compare_value [in]

Type: T

The comparison value.

value [in]

Type: T

The input value.

Return value

This function does not return a value.

Remarks

Atomically compares the value referenced by dest with compare_value and stores value in the location referenced by dest if the values match. This operation can only be performed on int or uint typed resources and shared memory variables. There are two possible uses for this function. The first is when R is a shared memory variable type. In this case, the function performs the operation on the shared memory register referenced by dest. The second scenario is when R is a resource variable type. In this scenario, the function performs the operation on the resource location referenced by dest.

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 5 and higher shader modelsyes

 

This function is supported in the following types of shaders:

VertexHullDomainGeometryPixelCompute
xx

 

See also

Intrinsic Functions
Shader Model 5

 

 

Show: