add set_layout

This commit is contained in:
Emerson Coskey 2025-07-14 12:11:47 -07:00
parent d787a0fc1f
commit f995079348
No known key found for this signature in database

View File

@ -1,4 +1,4 @@
use super::ShaderDefVal;
use super::{empty_bind_group_layout, ShaderDefVal};
use crate::mesh::VertexBufferLayout;
use crate::{
define_atomic_id,
@ -112,6 +112,20 @@ pub struct RenderPipelineDescriptor {
pub zero_initialize_workgroup_memory: bool,
}
#[derive(Copy, Clone, Debug, Error)]
#[error("RenderPipelineDescriptor has no FragmentState configured")]
pub struct NoFragmentStateError;
impl RenderPipelineDescriptor {
pub fn fragment_mut(&mut self) -> Result<&mut FragmentState, NoFragmentStateError> {
self.fragment.as_mut().ok_or(NoFragmentStateError)
}
pub fn set_layout(&mut self, index: usize, layout: BindGroupLayout) {
filling_set_at(&mut self.layout, index, empty_bind_group_layout(), layout);
}
}
#[derive(Clone, Debug, Eq, PartialEq, Default)]
pub struct VertexState {
/// The compiled shader module for this stage.