document the remaining win32 safety contracts
This commit is contained in:
@@ -363,6 +363,10 @@ impl TonemapPipeline {
|
||||
// -> viewport+scissor -> draw. Every stage is set explicitly because the
|
||||
// frame's device/context still carries state from prior frames.
|
||||
//
|
||||
#[allow(
|
||||
clippy::multiple_unsafe_ops_per_block,
|
||||
reason = "the bind sequence only makes sense as one unit; splitting it would imply the intermediate states are reachable"
|
||||
)]
|
||||
// SAFETY: every resource bound here was created on this same device and
|
||||
// is kept alive by `self` for the duration of the draw; the slices and
|
||||
// viewport/scissor arrays are stack locals that outlive each call.
|
||||
@@ -388,10 +392,15 @@ impl TonemapPipeline {
|
||||
}
|
||||
|
||||
// Copy to the SDR staging texture and read it back.
|
||||
let row_bytes = self.width * 4;
|
||||
#[allow(
|
||||
clippy::multiple_unsafe_ops_per_block,
|
||||
reason = "copy/map/read/unmap must stay paired; the map guard has to be released in the same scope"
|
||||
)]
|
||||
// SAFETY: both textures live on this device and share dimensions and
|
||||
// format, so the copy is well-defined; `mapped` is a zeroed local that
|
||||
// Map fills before any field of it is read.
|
||||
let row_bytes = self.width * 4;
|
||||
// Map fills before any field of it is read, and the slice is sized from
|
||||
// the mapped pitch and this pipeline's own height.
|
||||
unsafe {
|
||||
context.CopyResource(&self.staging, &self.render_target);
|
||||
let mut mapped = D3D11_MAPPED_SUBRESOURCE::default();
|
||||
|
||||
Reference in New Issue
Block a user