pass through pipeline_id instead of getting it via .as_info().id()

This commit is contained in:
teoxoy 2024-06-20 20:09:02 +02:00 committed by Teodor Tanasoaia
parent 1b40c8c745
commit d5d806a474

View File

@ -507,7 +507,7 @@ impl RenderBundleEncoder {
.map_pass_err(scope); .map_pass_err(scope);
} }
let pipeline_state = PipelineState::new(pipeline); let pipeline_state = PipelineState::new(pipeline, pipeline_id);
commands.push(ArcRenderCommand::SetPipeline(pipeline.clone())); commands.push(ArcRenderCommand::SetPipeline(pipeline.clone()));
@ -1212,6 +1212,8 @@ struct PipelineState<A: HalApi> {
/// The pipeline /// The pipeline
pipeline: Arc<RenderPipeline<A>>, pipeline: Arc<RenderPipeline<A>>,
pipeline_id: id::RenderPipelineId,
/// How this pipeline's vertex shader traverses each vertex buffer, indexed /// How this pipeline's vertex shader traverses each vertex buffer, indexed
/// by vertex buffer slot number. /// by vertex buffer slot number.
steps: Vec<VertexStep>, steps: Vec<VertexStep>,
@ -1225,9 +1227,10 @@ struct PipelineState<A: HalApi> {
} }
impl<A: HalApi> PipelineState<A> { impl<A: HalApi> PipelineState<A> {
fn new(pipeline: &Arc<RenderPipeline<A>>) -> Self { fn new(pipeline: &Arc<RenderPipeline<A>>, pipeline_id: id::RenderPipelineId) -> Self {
Self { Self {
pipeline: pipeline.clone(), pipeline: pipeline.clone(),
pipeline_id,
steps: pipeline.vertex_steps.to_vec(), steps: pipeline.vertex_steps.to_vec(),
push_constant_ranges: pipeline push_constant_ranges: pipeline
.layout .layout
@ -1301,7 +1304,7 @@ struct State<A: HalApi> {
impl<A: HalApi> State<A> { impl<A: HalApi> State<A> {
/// Return the id of the current pipeline, if any. /// Return the id of the current pipeline, if any.
fn pipeline_id(&self) -> Option<id::RenderPipelineId> { fn pipeline_id(&self) -> Option<id::RenderPipelineId> {
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. /// Return the current pipeline state. Return an error if none is set.