The previous commit moved PrimitiveIndex to the top of the BuiltIn enum
to fix FXC ordering (SV_PrimitiveID must appear before other SVs).
However, since BuiltIn derives Ord, this changed the global sort order,
breaking DX12 inter-stage variable matching in CTS tests.
Fix: Restore PrimitiveIndex to its original enum position and handle
the FXC ordering requirement locally in the HLSL backend's InterfaceKey
by giving PrimitiveIndex its own sort key between Location and BuiltIn.
Co-authored-by: cwfitzgerald <7861353+cwfitzgerald@users.noreply.github.com>
When accessing a buffer for writing, do not expose (or internally
create) any `&'a mut [u8]` references to that memory, so as to avoid
exposing write-combining memory that might visibly misbehave in atomic
operations. Instead, expose the new pointer type `WriteOnly<'a, [u8]>`
which offers only write operations. This can be sliced and reborrowed,
allowing it to be used in most ways which `&mut [u8]` would be,
hopefully with near-zero overhead.
This pointer type might also allow users to opt in to uninitialized
memory for performance, while confining the consequences to GPU UB
rather than Rust UB. However, that is a future possibility and is not
implemented in this commit other than as a consideration in defining the
API of the `WriteOnly` type.
This change is not a complete solution to the problem of write-combining
memory because it is still possible to read after writing by calling
`get_mapped_range()` after `get_mapped_range_mut()`. However, that is
solvable separately, perhaps with a barrier or a validation change,
and is not particularly coupled with this part of the solution.
`WriteOnly<'a, T>` is a custom smart pointer which is stricter than
`&'a mut [T]` in that it only allows writing data and not reading it.
This will be part of the fix for <https://github.com/gfx-rs/wgpu/issues/8897>.
This commit only introduces the public type and does not use it.
* style(CHANGELOG): ensure double newline b/w paragraph and fenced code blocks
Regressed by <https://github.com/gfx-rs/wgpu/pull/9180>. I missed this
in review.
* docs(CHANGELOG): fix up formatting for #9141
* docs(CHANGELOG): clarify that `get_current_texture` in a `Surface` method