Skip to content

Commit 0362abd

Browse files
Make extract_mesh_materials and MaterialBindGroupAllocator public (#16982)
# Objective Fixes #16730 ## Solution Make the relevant functions public. (`MaterialBindGroupAllocator` itself was already `pub`)
1 parent 54a3fd7 commit 0362abd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

crates/bevy_pbr/src/material.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ pub const fn screen_space_specular_transmission_pipeline_key(
582582
}
583583
}
584584

585-
fn extract_mesh_materials<M: Material>(
585+
pub fn extract_mesh_materials<M: Material>(
586586
mut material_instances: ResMut<RenderMaterialInstances<M>>,
587587
mut material_ids: ResMut<RenderMeshMaterialIds>,
588588
mut material_bind_group_allocator: ResMut<MaterialBindGroupAllocator<M>>,

crates/bevy_pbr/src/material_bind_groups.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ where
202202
M: Material,
203203
{
204204
/// Creates or recreates any bind groups that were modified this frame.
205-
pub(crate) fn prepare_bind_groups(
205+
pub fn prepare_bind_groups(
206206
&mut self,
207207
render_device: &RenderDevice,
208208
fallback_image: &FallbackImage,
@@ -221,12 +221,12 @@ where
221221

222222
/// Returns the bind group with the given index, if it exists.
223223
#[inline]
224-
pub(crate) fn get(&self, index: MaterialBindGroupIndex) -> Option<&MaterialBindGroup<M>> {
224+
pub fn get(&self, index: MaterialBindGroupIndex) -> Option<&MaterialBindGroup<M>> {
225225
self.bind_groups.get(index.0 as usize)
226226
}
227227

228228
/// Allocates a new binding slot and returns its ID.
229-
pub(crate) fn allocate(&mut self) -> MaterialBindingId {
229+
pub fn allocate(&mut self) -> MaterialBindingId {
230230
let group_index = self.free_bind_groups.pop().unwrap_or_else(|| {
231231
let group_index = self.bind_groups.len() as u32;
232232
self.bind_groups
@@ -249,7 +249,7 @@ where
249249

250250
/// Assigns an unprepared bind group to the group and slot specified in the
251251
/// [`MaterialBindingId`].
252-
pub(crate) fn init(
252+
pub fn init(
253253
&mut self,
254254
render_device: &RenderDevice,
255255
material_binding_id: MaterialBindingId,
@@ -268,7 +268,7 @@ where
268268
/// This is only a meaningful operation for non-bindless bind groups. It's
269269
/// rarely used, but see the `texture_binding_array` example for an example
270270
/// demonstrating how this feature might see use in practice.
271-
pub(crate) fn init_custom(
271+
pub fn init_custom(
272272
&mut self,
273273
material_binding_id: MaterialBindingId,
274274
bind_group: BindGroup,
@@ -279,7 +279,7 @@ where
279279
}
280280

281281
/// Marks the slot corresponding to the given [`MaterialBindingId`] as free.
282-
pub(crate) fn free(&mut self, material_binding_id: MaterialBindingId) {
282+
pub fn free(&mut self, material_binding_id: MaterialBindingId) {
283283
let bind_group = &mut self.bind_groups[material_binding_id.group.0 as usize];
284284
let was_full = bind_group.is_full();
285285

crates/bevy_sprite/src/mesh2d/material.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<M: Material2d> Default for RenderMaterial2dInstances<M> {
278278
}
279279
}
280280

281-
fn extract_mesh_materials_2d<M: Material2d>(
281+
pub fn extract_mesh_materials_2d<M: Material2d>(
282282
mut material_instances: ResMut<RenderMaterial2dInstances<M>>,
283283
query: Extract<Query<(Entity, &ViewVisibility, &MeshMaterial2d<M>), With<Mesh2d>>>,
284284
) {

0 commit comments

Comments
 (0)