Skip to content

Commit 3669176

Browse files
committed
Document undocumented features of AsBindGroup derive (#6910)
# Objective - #5364 Added a few features to the AsBindGroup derive, but if you don't know they exist they aren't documented anywhere. ## Solution - Document the new arguments in the doc block for the derive.
1 parent 87bf0e2 commit 3669176

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

crates/bevy_render/src/render_resource/bind_group.rs

+18-2
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,39 @@ impl Deref for BindGroup {
104104
/// are generally bound to group 1.
105105
///
106106
/// The following field-level attributes are supported:
107+
///
107108
/// * `uniform(BINDING_INDEX)`
108109
/// * The field will be converted to a shader-compatible type using the [`ShaderType`] trait, written to a [`Buffer`], and bound as a uniform.
109110
/// [`ShaderType`] is implemented for most math types already, such as [`f32`], [`Vec4`](bevy_math::Vec4), and
110111
/// [`Color`](crate::color::Color). It can also be derived for custom structs.
111-
/// * `texture(BINDING_INDEX)`
112+
///
113+
/// * `texture(BINDING_INDEX, arguments)`
112114
/// * This field's [`Handle<Image>`](bevy_asset::Handle) will be used to look up the matching [`Texture`](crate::render_resource::Texture)
113115
/// GPU resource, which will be bound as a texture in shaders. The field will be assumed to implement [`Into<Option<Handle<Image>>>`]. In practice,
114116
/// most fields should be a [`Handle<Image>`](bevy_asset::Handle) or [`Option<Handle<Image>>`]. If the value of an [`Option<Handle<Image>>`] is
115117
/// [`None`], the [`FallbackImage`] resource will be used instead. This attribute can be used in conjunction with a `sampler` binding attribute
116118
/// (with a different binding index) if a binding of the sampler for the [`Image`] is also required.
117-
/// * `sampler(BINDING_INDEX)`
119+
///
120+
/// | Arguments | Values | Default |
121+
/// |-----------------------|-------------------------------------------------------------------------|----------------------|
122+
/// | `dimension` = "..." | `"1d"`, `"2d"`, `"2d_array"`, `"3d"`, `"cube"`, `"cube_array"` | `"2d"` |
123+
/// | `sample_type` = "..." | `"float"`, `"depth"`, `"s_int"` or `"u_int"` | `"float"` |
124+
/// | `filterable` = ... | `true`, `false` | `true` |
125+
/// | `multisampled` = ... | `true`, `false` | `false` |
126+
/// | `visibility(...)` | `all`, `none`, or a list-combination of `vertex`, `fragment`, `compute` | `vertex`, `fragment` |
127+
///
128+
/// * `sampler(BINDING_INDEX, arguments)`
118129
/// * This field's [`Handle<Image>`](bevy_asset::Handle) will be used to look up the matching [`Sampler`](crate::render_resource::Sampler) GPU
119130
/// resource, which will be bound as a sampler in shaders. The field will be assumed to implement [`Into<Option<Handle<Image>>>`]. In practice,
120131
/// most fields should be a [`Handle<Image>`](bevy_asset::Handle) or [`Option<Handle<Image>>`]. If the value of an [`Option<Handle<Image>>`] is
121132
/// [`None`], the [`FallbackImage`] resource will be used instead. This attribute can be used in conjunction with a `texture` binding attribute
122133
/// (with a different binding index) if a binding of the texture for the [`Image`] is also required.
123134
///
135+
/// | Arguments | Values | Default |
136+
/// |------------------------|-------------------------------------------------------------------------|------------------------|
137+
/// | `sampler_type` = "..." | `"filtering"`, `"non_filtering"`, `"comparison"`. | `"filtering"` |
138+
/// | `visibility(...)` | `all`, `none`, or a list-combination of `vertex`, `fragment`, `compute` | `vertex`, `fragment` |
139+
///
124140
/// Note that fields without field-level binding attributes will be ignored.
125141
/// ```
126142
/// # use bevy_render::{color::Color, render_resource::AsBindGroup};

0 commit comments

Comments
 (0)