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
Track and validate buffer binding sizes
  • Loading branch information
toji committed May 6, 2025
commit 213bb49dac912f63e15d624e343a3ecfa2ca6beb
16 changes: 13 additions & 3 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11054,6 +11054,7 @@ It must only be included by interfaces which also include those mixins.
- If |bindGroupLayout| is `null`, [=iteration/continue=].
- Let |bindGroup| be |encoder|.{{GPUBindingCommandsMixin/[[bind_groups]]}}[|index|].
- Let |dynamicOffsets| be |encoder|.{{GPUBindingCommandsMixin/[[dynamic_offsets]]}}[|index|].
- Let |inheritedState| be |encoder|.{{GPUBindingCommandsMixin/[[inheritedBindGroupState]]}}[|index|].
- |bindGroup| must not be `null`.
- |bindGroup|.{{GPUBindGroup/[[layout]]}} must be [=group-equivalent=] with |bindGroupLayout|.
- Let |dynamicOffsetIndex| be 0.
Expand All @@ -11070,8 +11071,13 @@ It must only be included by interfaces which also include those mixins.
|dynamicOffsets|[|dynamicOffsetIndex|].
- Increment |dynamicOffsetIndex| by 1.
- If |bindGroupEntry|.{{GPUBindGroupEntry/[[prevalidatedSize]]}} is `false`:
- [$effective buffer binding size$](|bound|) must be ≥ [=minimum buffer binding size=]
of the binding variable in |pipeline|'s shader that corresponds to |bindGroupEntry|.
- Let |minimumBindingSize| be the [=minimum buffer binding size=] of the binding variable in
|pipeline|'s shader that corresponds to |bindGroupEntry|.
- If |inheritedState| [=map/exists=]:
- Set |inheritedState|.{{InheritedBindGroupState/[[minimumBufferBindingSize]]}}[|bindGroupEntry|.{{GPUBindGroupEntry/binding}}]
to the maximum of |minimumBindingSize| and |inheritedState|.{{InheritedBindGroupState/[[minimumBufferBindingSize]]}}[|bindGroupEntry|.{{GPUBindGroupEntry/binding}}]
- Otherwise:
- [$effective buffer binding size$](|bound|) must be ≥ |minimumBindingSize|.
- [$Encoder bind groups alias a writable resource$](|encoder|, |pipeline|) must be `false`.
</div>

Expand Down Expand Up @@ -13234,7 +13240,11 @@ attachments used by this encoder.
- For each ({{GPUIndex32}} |group|, [=InheritedBindGroupState=] |inheritedState|) in |bundle|.{{GPURenderBundle/[[inheritedBindGroupState]]}}:
- Let |bindGroup| be |this|.{{GPUBindingCommandsMixin/[[bind_groups]]}}[|group|].
- |bindGroup|.{{GPUBindGroup/[[layout]]}} must be [=group-equivalent=] with |inheritedState|.{{InheritedBindGroupState/[[layout]]}}.
- // TODO: Validate that the inherited bind group buffers satisfy the minimum buffer size recorded in in the inherited state.
- For each ({{GPUIndex32}} |binding|, {{GPUSize64}} |minimumBindingSize|) in |inheritedState|.{{InheritedBindGroupState/[[minimumBufferBindingSize]]}}:
- Let |bindGroupEntry| be the entry in |bindGroup|.{{GPUBindGroup/[[entries]]}} where |bindGroupEntry|.{{GPUBindGroupEntry/binding}} is |binding|.
- Let |bound| be a copy of |bindGroupEntry|.{{GPUBindGroupEntry/resource}}.
- [=Assert=] |bound| is a {{GPUBufferBinding}}.
- [$effective buffer binding size$](|bound|) must be &ge; |minimumBindingSize|.
</div>

1. For each |bundle| in |bundles|:
Expand Down