Vixen
02b45cc4
csharp
public sealed class IrAtomicInstruction

An indivisible read-modify-write of one scalar in a writable resource.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Takes a place, for the same reason IrArrayLengthInstruction does and a stronger one. The whole content of "atomic" is that the read and the write are the same operation on the same storage; a value loaded out and handed to an intrinsic is a copy, and no instruction on a copy can be atomic. Both targets say so in their operands — GLSL's atomicAdd takes an l-value and SPIR-V's OpAtomicIAdd takes a pointer.

The old value is the result, always. That is what makes an atomic add an allocator: every invocation that adds one gets a different answer back, and those answers are exactly the indices 0..n. An operation that returned nothing would be a counter nobody could use.

Scalar integers only. GLSL 4.5 has no atomic on a float without an extension and none on a vector at all, so a wider set here would be a promise one target could not keep.

Fields and properties (6)

  • public override IrValue Result
  • public IrAtomicOp Op
  • public IrPlace Place
  • public IrValue Value

    What is added, combined or written.

  • public IrValue? Comparand

    What the storage has to equal for CompareExchange to write.

  • public override IEnumerable<IrValue> Operands

Methods (1)

Used by (10)

  • AtomicTestsVixen.Raven.Tests
  • FunctionVerifierVixen.Raven
  • GlslEmitterVixen.Raven
  • GroupSharedTestsVixen.Raven.Tests
  • Int64TestsVixen.Raven.Tests
  • IrCapabilitiesVixen.Raven
  • IrPrinterVixen.Raven
  • LibraryBuilderVixen.Raven
  • LowererVixen.Raven
  • SpirvEmitterVixen.Raven