Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor comments
  • Loading branch information
Peter McNeeley committed Mar 24, 2026
commit a893387649afbc2d56b1b81086ce6290d2d71495
18 changes: 8 additions & 10 deletions wgsl/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,8 +1863,8 @@ The valid [=enable-extensions=] are listed in the following table.
<tr><td><dfn noexport dfn-for="extension">`atomic_vec2u_min_max`</dfn>
<td>[=atomic-vec2u-min-max|"atomic-vec2u-min-max"=]
<td>The built-in functions [[#atomic-store-min|atomicStoreMin]] and
[[#atomic-store-max|atomicStoreMax]] are valid to use on `atomic<vec2u>`
objects in the WGSL module. Otherwise, using these will result in a
[[#atomic-store-max|atomicStoreMax]] are valid to use on atomic&lt;[=vec2u=]&gt;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd definitely link atomic to atomic types here.

types in the [=address spaces/storage=] address space. Otherwise, using these will result in a
[=shader-creation error=].
</table>

Expand Down Expand Up @@ -2009,11 +2009,6 @@ Extension names are not [=identifiers=]: they do not [=resolves|resolve=] to [=d
<td>
Supports the [=built-in values/global_invocation_index=] and
[=built-in values/workgroup_index=] [=built-in values=].
<tr><td><dfn for="language_extension">atomic_vec2u_min_max</dfn>
<td>
Supports the [[#atomic-store-min|atomicStoreMin]] and
[[#atomic-store-max|atomicStoreMax]] built-in functions
on [[#atomic-types|atomic&lt;vec2u&gt;]] objects.

</table>

Expand Down Expand Up @@ -3061,7 +3056,7 @@ An <dfn noexport>atomic type</dfn> encapsulates a [=type/concrete=] [=integer sc
<tr algorithm="atomic type"><td>atomic&lt;<dfn dfn-for="atomic" noexport>|T|</dfn>&gt;
Comment thread
petermcneeleychromium marked this conversation as resolved.
<td>Atomic of type |T|. Unless otherwise specified, |T| [=shader-creation error|must=] be either [=u32=] or [=i32=].
<tr algorithm="atomic type vecu"><td>atomic&lt;[=vec2u=]&gt;
<td>Atomic of type [=vec2u=]. A 64-bit atomic type via a composite. Requires the [=language_extension/atomic_vec2u_min_max=] extension.
<td>Atomic of type [=vec2u=]. This composite constitutes a 64-bit atomic type and is structurally equivalent to a bitcast. Requires the [=extension/atomic_vec2u_min_max=] extension.
Comment thread
petermcneeleychromium marked this conversation as resolved.
Outdated
</table>

An expression [=shader-creation error|must not=] evaluate to an atomic type.
Expand Down Expand Up @@ -18986,7 +18981,7 @@ is, the `exchanged` member of the result structure may be `false` even if the
### Atomic Store Min and Max Functions ### {#atomic-store-min-max}

The functions in this section [=behavioral requirement|will=] be available only if
the [=language_extension/atomic_vec2u_min_max=] [=language extension=] is supported.
the [=extension/atomic_vec2u_min_max=] [=enable-extension=] is enabled.

Each function performs the following steps atomically:

Expand All @@ -18995,10 +18990,11 @@ Each function performs the following steps atomically:
name with the value |v|.
3. Store the new value using `atomic_ptr`.

The functions do not return any values.
The functions do not return a value.

For the functions in this section:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe hardcoding these constraints is better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that done, these constraints can be removed.

- |T| [=shader-creation error|must=] be [=vec2u=].
- This composite operationally behaves as a single 64-bit unsigned integer scalar.
- `AS` [=shader-creation error|must=] be [=address spaces/storage=].

#### `atomicStoreMin` #### {#atomic-store-min}
Expand All @@ -19014,6 +19010,7 @@ with the value `v`.
<xmp highlight=wgsl>
// All operations are performed atomically
fn atomicStoreMin(atomic_ptr: ptr<AS, atomic<T>, read_write>, v : T) {
Comment thread
petermcneeleychromium marked this conversation as resolved.
Outdated
// both 'old' and 'v' behave operationally as 64-bit unsigned integer scalars
let old = *atomic_ptr;
*atomic_ptr = min(old, v);
}
Expand All @@ -19033,6 +19030,7 @@ with the value `v`.
<xmp highlight=wgsl>
// All operations are performed atomically
fn atomicStoreMax(atomic_ptr: ptr<AS, atomic<T>, read_write>, v : T) {
Comment thread
petermcneeleychromium marked this conversation as resolved.
Outdated
// both 'old' and 'v' behave operationally as 64-bit unsigned integer scalars
let old = *atomic_ptr;
*atomic_ptr = max(old, v);
}
Expand Down
Loading