Skip to content

Commit 7572bf2

Browse files
authored
Remove unnecessary pin (#8535)
1 parent 9a975b2 commit 7572bf2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

wgpu-hal/src/dx12/device.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,8 +1953,7 @@ impl crate::Device for super::Device {
19531953
};
19541954
let flags = Direct3D12::D3D12_PIPELINE_STATE_FLAG_NONE;
19551955

1956-
let mut view_instancing =
1957-
core::pin::pin!(ArrayVec::<Direct3D12::D3D12_VIEW_INSTANCE_LOCATION, 32>::new());
1956+
let mut view_instancing = ArrayVec::<Direct3D12::D3D12_VIEW_INSTANCE_LOCATION, 32>::new();
19581957
if let Some(mask) = desc.multiview_mask {
19591958
let mask = mask.get();
19601959
// This array is just what _could_ be rendered to. We actually apply the mask at
@@ -1969,6 +1968,9 @@ impl crate::Device for super::Device {
19691968
}
19701969
}
19711970

1971+
// Borrow view instancing slice, so we can be sure that it won't be moved while we have pointers into this buffer.
1972+
let view_instancing_slice = view_instancing.as_slice();
1973+
19721974
let mut stream_desc = RenderPipelineStateStreamDesc {
19731975
// Shared by vertex and mesh pipelines
19741976
root_signature: desc.layout.shared.signature.as_ref(),
@@ -1987,10 +1989,10 @@ impl crate::Device for super::Device {
19871989
node_mask: 0,
19881990
cached_pso,
19891991
flags,
1990-
view_instancing: if !view_instancing.is_empty() {
1992+
view_instancing: if !view_instancing_slice.is_empty() {
19911993
Some(Direct3D12::D3D12_VIEW_INSTANCING_DESC {
1992-
ViewInstanceCount: view_instancing.len() as u32,
1993-
pViewInstanceLocations: view_instancing.as_ptr(),
1994+
ViewInstanceCount: view_instancing_slice.len() as u32,
1995+
pViewInstanceLocations: view_instancing_slice.as_ptr(),
19941996
// This lets us hide/mask certain values later, at renderpass creation time.
19951997
Flags: Direct3D12::D3D12_VIEW_INSTANCING_FLAG_ENABLE_VIEW_INSTANCE_MASKING,
19961998
})

0 commit comments

Comments
 (0)