From d5d806a474cc6ab3a96c56cc66953c7e8195151b Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:09:02 +0200 Subject: [PATCH] pass through `pipeline_id` instead of getting it via `.as_info().id()` --- wgpu-core/src/command/bundle.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index 8dd91929e..d1ecbc229 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -507,7 +507,7 @@ impl RenderBundleEncoder { .map_pass_err(scope); } - let pipeline_state = PipelineState::new(pipeline); + let pipeline_state = PipelineState::new(pipeline, pipeline_id); commands.push(ArcRenderCommand::SetPipeline(pipeline.clone())); @@ -1212,6 +1212,8 @@ struct PipelineState { /// The pipeline pipeline: Arc>, + pipeline_id: id::RenderPipelineId, + /// How this pipeline's vertex shader traverses each vertex buffer, indexed /// by vertex buffer slot number. steps: Vec, @@ -1225,9 +1227,10 @@ struct PipelineState { } impl PipelineState { - fn new(pipeline: &Arc>) -> Self { + fn new(pipeline: &Arc>, pipeline_id: id::RenderPipelineId) -> Self { Self { pipeline: pipeline.clone(), + pipeline_id, steps: pipeline.vertex_steps.to_vec(), push_constant_ranges: pipeline .layout @@ -1301,7 +1304,7 @@ struct State { impl State { /// Return the id of the current pipeline, if any. fn pipeline_id(&self) -> Option { - self.pipeline.as_ref().map(|p| p.pipeline.as_info().id()) + self.pipeline.as_ref().map(|p| p.pipeline_id) } /// Return the current pipeline state. Return an error if none is set.