Skip to content

Commit ef52124

Browse files
committed
Rewrite the notes about when not to use Specialized*Pipeline* to be more clear.
1 parent 0760ca7 commit ef52124

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

crates/bevy_render/src/render_resource/pipeline_specializer.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ use tracing::error;
2020

2121
/// A trait that allows constructing different variants of a render pipeline from a key.
2222
///
23-
/// Note: If your key is a ZST, you do not need to "specialize" anything. Just create the render
24-
/// pipeline once and store its ID.
23+
/// Note: This is intended for modifying your pipeline descriptor on the basis of a key. If your key
24+
/// contains no data then you don't need to specialize. For example, if you are using the
25+
/// [`AsBindGroup`](crate::render_resource::AsBindGroup) without the `#[bind_group_data]` attribute,
26+
/// you don't need to specialize. Instead, create the pipeline directly from [`PipelineCache`] and
27+
/// store its ID.
2528
///
2629
/// See [`SpecializedRenderPipelines`] for more info.
2730
pub trait SpecializedRenderPipeline {
@@ -39,8 +42,11 @@ pub trait SpecializedRenderPipeline {
3942
/// making it easy to A) construct the necessary pipelines, and B) reuse already constructed
4043
/// pipelines.
4144
///
42-
/// Note: If your key is a ZST, you do not need to "specialize" anything. Just create the render
43-
/// pipeline once and store its ID.
45+
/// Note: This is intended for modifying your pipeline descriptor on the basis of a key. If your key
46+
/// contains no data then you don't need to specialize. For example, if you are using the
47+
/// [`AsBindGroup`](crate::render_resource::AsBindGroup) without the `#[bind_group_data]` attribute,
48+
/// you don't need to specialize. Instead, create the pipeline directly from [`PipelineCache`] and
49+
/// store its ID.
4450
#[derive(Resource)]
4551
pub struct SpecializedRenderPipelines<S: SpecializedRenderPipeline> {
4652
cache: HashMap<S::Key, CachedRenderPipelineId>,
@@ -69,8 +75,11 @@ impl<S: SpecializedRenderPipeline> SpecializedRenderPipelines<S> {
6975

7076
/// A trait that allows constructing different variants of a compute pipeline from a key.
7177
///
72-
/// Note: If your key is a ZST, you do not need to "specialize" anything. Just create the compute
73-
/// pipeline once and store its ID.
78+
/// Note: This is intended for modifying your pipeline descriptor on the basis of a key. If your key
79+
/// contains no data then you don't need to specialize. For example, if you are using the
80+
/// [`AsBindGroup`](crate::render_resource::AsBindGroup) without the `#[bind_group_data]` attribute,
81+
/// you don't need to specialize. Instead, create the pipeline directly from [`PipelineCache`] and
82+
/// store its ID.
7483
///
7584
/// See [`SpecializedComputePipelines`] for more info.
7685
pub trait SpecializedComputePipeline {
@@ -88,8 +97,11 @@ pub trait SpecializedComputePipeline {
8897
/// making it easy to A) construct the necessary pipelines, and B) reuse already constructed
8998
/// pipelines.
9099
///
91-
/// Note: If your key is a ZST, you do not need to "specialize" anything. Just create the compute
92-
/// pipeline once and store its ID.
100+
/// Note: This is intended for modifying your pipeline descriptor on the basis of a key. If your key
101+
/// contains no data then you don't need to specialize. For example, if you are using the
102+
/// [`AsBindGroup`](crate::render_resource::AsBindGroup) without the `#[bind_group_data]` attribute,
103+
/// you don't need to specialize. Instead, create the pipeline directly from [`PipelineCache`] and
104+
/// store its ID.
93105
#[derive(Resource)]
94106
pub struct SpecializedComputePipelines<S: SpecializedComputePipeline> {
95107
cache: HashMap<S::Key, CachedComputePipelineId>,

0 commit comments

Comments
 (0)