atomicCompareExchangeWeak
이 페이지에서

atomicCompareExchangeWeak

함수

Stores the third argument into the atomic location only when it holds the second, as one indivisible step.

이름마다 붙은 시그니처와 설명은 커밋 26de7be8의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

declare function atomicCompareExchangeWeak<T extends u32 | i32>(location: atomic<T>, compare: T, value: T): { old_value: T; exchanged: bool }

매개변수

  • location atomic<T>
  • compare T
  • value T

반환값

{ old_value: T; exchanged: bool }

설명

Answers a struct: old_value is what the location held before the call and exchanged says whether the store happened. WGSL gives that struct no writable name, so bind the result with const and read its fields.

대상별 출력

WGSL
atomicCompareExchangeWeak(&a, b, c)
GLSL ES 3.00
atomicCompareExchangeWeak has no GLSL ES 3.00 spelling (no storage buffers, no atomics)

예제

함께 보기

이 페이지 편집 문제 보고