fix safety with lifetime of commandlist

This commit is contained in:
janis 2026-04-12 21:39:17 +02:00
parent 933b4a5979
commit 3c6baa591d
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8
2 changed files with 7 additions and 7 deletions

View file

@ -319,9 +319,9 @@ impl Command for EndRendering {
fn apply(self, _recorder: &mut CommandRecorder) {} fn apply(self, _recorder: &mut CommandRecorder) {}
} }
pub struct BindPipeline<'cmd>(pub &'cmd Pipeline); pub struct BindPipeline(pub vk::Pipeline, pub vk::PipelineBindPoint);
impl<'cmd> Command for BindPipeline<'cmd> { impl Command for BindPipeline {
fn side_effects(&self, _map: SideEffectMap) { fn side_effects(&self, _map: SideEffectMap) {
// No resource access, but affects the pipeline state // No resource access, but affects the pipeline state
} }
@ -331,7 +331,7 @@ impl<'cmd> Command for BindPipeline<'cmd> {
let dev = &cmd.device().raw; let dev = &cmd.device().raw;
unsafe { unsafe {
dev.cmd_bind_pipeline(cmd.raw(), self.0.bind_point(), self.0.raw()); dev.cmd_bind_pipeline(cmd.raw(), self.1, self.0);
} }
} }
} }
@ -602,8 +602,8 @@ impl<T: Resource, U: Resource> OutsideRenderPass for Copy<T, U> {}
impl OutsideRenderPass for ClearTexture {} impl OutsideRenderPass for ClearTexture {}
impl OutsideRenderPass for UpdateBuffer {} impl OutsideRenderPass for UpdateBuffer {}
impl InsideRenderPass for BindPipeline<'_> {} impl InsideRenderPass for BindPipeline {}
impl OutsideRenderPass for BindPipeline<'_> {} impl OutsideRenderPass for BindPipeline {}
impl InsideRenderPass for BindVertexBuffers {} impl InsideRenderPass for BindVertexBuffers {}
impl OutsideRenderPass for BindVertexBuffers {} impl OutsideRenderPass for BindVertexBuffers {}
impl InsideRenderPass for BindIndexBuffer {} impl InsideRenderPass for BindIndexBuffer {}

View file

@ -105,7 +105,7 @@ pub struct CommandList<'cmd> {
side_effects: SideEffects, side_effects: SideEffects,
num_commands: u32, num_commands: u32,
_pd: PhantomData<fn(&'cmd ())>, _pd: PhantomData<&'cmd ()>,
} }
#[must_use] #[must_use]
@ -156,7 +156,7 @@ impl<'cmd> CommandList<'cmd> {
self.push_inner(command); self.push_inner(command);
} }
fn push_inner<C: Command>(&mut self, command: C) { fn push_inner<C: Command + 'cmd>(&mut self, command: C) {
#[repr(C, packed)] #[repr(C, packed)]
struct Packed<C> { struct Packed<C> {
meta: CommandMeta, meta: CommandMeta,