Skip to content

Commit a46fb07

Browse files
sagudevcwfitzgerald
authored andcommitted
Unify ResolvedPipelineLayoutDescriptor into PipelineLayoutDescriptor
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent c3bda44 commit a46fb07

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

wgpu-core/src/binding_model.rs

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,23 @@ pub enum PushConstantUploadError {
641641
/// A `PipelineLayoutDescriptor` can be used to create a pipeline layout.
642642
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
643643
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
644-
pub struct PipelineLayoutDescriptor<'a> {
644+
#[cfg_attr(feature = "serde", serde(bound = "BGL: Serialize"))]
645+
pub struct PipelineLayoutDescriptor<'a, BGL = BindGroupLayoutId>
646+
where
647+
[BGL]: ToOwned,
648+
<[BGL] as ToOwned>::Owned: std::fmt::Debug,
649+
{
645650
/// Debug label of the pipeline layout.
646651
///
647652
/// This will show up in graphics debuggers for easy identification.
648653
pub label: Label<'a>,
649654
/// Bind groups that this pipeline uses. The first entry will provide all the bindings for
650655
/// "set = 0", second entry will provide all the bindings for "set = 1" etc.
651-
pub bind_group_layouts: Cow<'a, [BindGroupLayoutId]>,
656+
#[cfg_attr(
657+
feature = "serde",
658+
serde(bound(deserialize = "<[BGL] as ToOwned>::Owned: Deserialize<'de>"))
659+
)]
660+
pub bind_group_layouts: Cow<'a, [BGL]>,
652661
/// Set of push constant ranges this pipeline uses. Each shader stage that
653662
/// uses push constants must define the range in push constant memory that
654663
/// corresponds to its single `layout(push_constant)` uniform block.
@@ -659,27 +668,7 @@ pub struct PipelineLayoutDescriptor<'a> {
659668
pub push_constant_ranges: Cow<'a, [wgt::PushConstantRange]>,
660669
}
661670

662-
/// Describes a pipeline layout.
663-
///
664-
/// A `PipelineLayoutDescriptor` can be used to create a pipeline layout.
665-
#[derive(Debug)]
666-
pub struct ResolvedPipelineLayoutDescriptor<'a> {
667-
/// Debug label of the pipeline layout.
668-
///
669-
/// This will show up in graphics debuggers for easy identification.
670-
pub label: Label<'a>,
671-
/// Bind groups that this pipeline uses. The first entry will provide all the bindings for
672-
/// "set = 0", second entry will provide all the bindings for "set = 1" etc.
673-
pub bind_group_layouts: Cow<'a, [Arc<BindGroupLayout>]>,
674-
/// Set of push constant ranges this pipeline uses. Each shader stage that
675-
/// uses push constants must define the range in push constant memory that
676-
/// corresponds to its single `layout(push_constant)` uniform block.
677-
///
678-
/// If this array is non-empty, the
679-
/// [`Features::PUSH_CONSTANTS`](wgt::Features::PUSH_CONSTANTS) feature must
680-
/// be enabled.
681-
pub push_constant_ranges: Cow<'a, [wgt::PushConstantRange]>,
682-
}
671+
pub type ResolvedPipelineLayoutDescriptor<'a> = PipelineLayoutDescriptor<'a, Arc<BindGroupLayout>>;
683672

684673
#[derive(Debug)]
685674
pub struct PipelineLayout {

0 commit comments

Comments
 (0)