Make extract_mesh_materials
and MaterialBindGroupAllocator
public (#16982)
# Objective Fixes #16730 ## Solution Make the relevant functions public. (`MaterialBindGroupAllocator` itself was already `pub`)
This commit is contained in:
parent
54a3fd7754
commit
0362abd4f4
@ -582,7 +582,7 @@ pub const fn screen_space_specular_transmission_pipeline_key(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract_mesh_materials<M: Material>(
|
pub fn extract_mesh_materials<M: Material>(
|
||||||
mut material_instances: ResMut<RenderMaterialInstances<M>>,
|
mut material_instances: ResMut<RenderMaterialInstances<M>>,
|
||||||
mut material_ids: ResMut<RenderMeshMaterialIds>,
|
mut material_ids: ResMut<RenderMeshMaterialIds>,
|
||||||
mut material_bind_group_allocator: ResMut<MaterialBindGroupAllocator<M>>,
|
mut material_bind_group_allocator: ResMut<MaterialBindGroupAllocator<M>>,
|
||||||
|
@ -202,7 +202,7 @@ where
|
|||||||
M: Material,
|
M: Material,
|
||||||
{
|
{
|
||||||
/// Creates or recreates any bind groups that were modified this frame.
|
/// Creates or recreates any bind groups that were modified this frame.
|
||||||
pub(crate) fn prepare_bind_groups(
|
pub fn prepare_bind_groups(
|
||||||
&mut self,
|
&mut self,
|
||||||
render_device: &RenderDevice,
|
render_device: &RenderDevice,
|
||||||
fallback_image: &FallbackImage,
|
fallback_image: &FallbackImage,
|
||||||
@ -221,12 +221,12 @@ where
|
|||||||
|
|
||||||
/// Returns the bind group with the given index, if it exists.
|
/// Returns the bind group with the given index, if it exists.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn get(&self, index: MaterialBindGroupIndex) -> Option<&MaterialBindGroup<M>> {
|
pub fn get(&self, index: MaterialBindGroupIndex) -> Option<&MaterialBindGroup<M>> {
|
||||||
self.bind_groups.get(index.0 as usize)
|
self.bind_groups.get(index.0 as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allocates a new binding slot and returns its ID.
|
/// Allocates a new binding slot and returns its ID.
|
||||||
pub(crate) fn allocate(&mut self) -> MaterialBindingId {
|
pub fn allocate(&mut self) -> MaterialBindingId {
|
||||||
let group_index = self.free_bind_groups.pop().unwrap_or_else(|| {
|
let group_index = self.free_bind_groups.pop().unwrap_or_else(|| {
|
||||||
let group_index = self.bind_groups.len() as u32;
|
let group_index = self.bind_groups.len() as u32;
|
||||||
self.bind_groups
|
self.bind_groups
|
||||||
@ -249,7 +249,7 @@ where
|
|||||||
|
|
||||||
/// Assigns an unprepared bind group to the group and slot specified in the
|
/// Assigns an unprepared bind group to the group and slot specified in the
|
||||||
/// [`MaterialBindingId`].
|
/// [`MaterialBindingId`].
|
||||||
pub(crate) fn init(
|
pub fn init(
|
||||||
&mut self,
|
&mut self,
|
||||||
render_device: &RenderDevice,
|
render_device: &RenderDevice,
|
||||||
material_binding_id: MaterialBindingId,
|
material_binding_id: MaterialBindingId,
|
||||||
@ -268,7 +268,7 @@ where
|
|||||||
/// This is only a meaningful operation for non-bindless bind groups. It's
|
/// This is only a meaningful operation for non-bindless bind groups. It's
|
||||||
/// rarely used, but see the `texture_binding_array` example for an example
|
/// rarely used, but see the `texture_binding_array` example for an example
|
||||||
/// demonstrating how this feature might see use in practice.
|
/// demonstrating how this feature might see use in practice.
|
||||||
pub(crate) fn init_custom(
|
pub fn init_custom(
|
||||||
&mut self,
|
&mut self,
|
||||||
material_binding_id: MaterialBindingId,
|
material_binding_id: MaterialBindingId,
|
||||||
bind_group: BindGroup,
|
bind_group: BindGroup,
|
||||||
@ -279,7 +279,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Marks the slot corresponding to the given [`MaterialBindingId`] as free.
|
/// Marks the slot corresponding to the given [`MaterialBindingId`] as free.
|
||||||
pub(crate) fn free(&mut self, material_binding_id: MaterialBindingId) {
|
pub fn free(&mut self, material_binding_id: MaterialBindingId) {
|
||||||
let bind_group = &mut self.bind_groups[material_binding_id.group.0 as usize];
|
let bind_group = &mut self.bind_groups[material_binding_id.group.0 as usize];
|
||||||
let was_full = bind_group.is_full();
|
let was_full = bind_group.is_full();
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ impl<M: Material2d> Default for RenderMaterial2dInstances<M> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract_mesh_materials_2d<M: Material2d>(
|
pub fn extract_mesh_materials_2d<M: Material2d>(
|
||||||
mut material_instances: ResMut<RenderMaterial2dInstances<M>>,
|
mut material_instances: ResMut<RenderMaterial2dInstances<M>>,
|
||||||
query: Extract<Query<(Entity, &ViewVisibility, &MeshMaterial2d<M>), With<Mesh2d>>>,
|
query: Extract<Query<(Entity, &ViewVisibility, &MeshMaterial2d<M>), With<Mesh2d>>>,
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user