add empty bind group layout
This commit is contained in:
parent
8fd69182e4
commit
d787a0fc1f
@ -96,6 +96,7 @@ use render_asset::{
|
||||
extract_render_asset_bytes_per_frame, reset_render_asset_bytes_per_frame,
|
||||
RenderAssetBytesPerFrame, RenderAssetBytesPerFrameLimiter,
|
||||
};
|
||||
use render_resource::init_empty_bind_group_layout;
|
||||
use renderer::{RenderAdapter, RenderDevice, RenderQueue};
|
||||
use settings::RenderResources;
|
||||
use sync_world::{
|
||||
@ -465,6 +466,8 @@ impl Plugin for RenderPlugin {
|
||||
Render,
|
||||
reset_render_asset_bytes_per_frame.in_set(RenderSystems::Cleanup),
|
||||
);
|
||||
|
||||
render_app.add_systems(RenderStartup, init_empty_bind_group_layout);
|
||||
}
|
||||
|
||||
app.register_type::<alpha::AlphaMode>()
|
||||
|
@ -1,4 +1,6 @@
|
||||
use crate::define_atomic_id;
|
||||
use crate::{define_atomic_id, renderer::RenderDevice};
|
||||
use bevy_ecs::system::Res;
|
||||
use bevy_platform::sync::OnceLock;
|
||||
use bevy_utils::WgpuWrapper;
|
||||
use core::ops::Deref;
|
||||
|
||||
@ -62,3 +64,19 @@ impl Deref for BindGroupLayout {
|
||||
&self.value
|
||||
}
|
||||
}
|
||||
|
||||
static EMPTY_BIND_GROUP_LAYOUT: OnceLock<BindGroupLayout> = OnceLock::new();
|
||||
|
||||
pub(crate) fn init_empty_bind_group_layout(render_device: Res<RenderDevice>) {
|
||||
let layout = render_device.create_bind_group_layout(Some("empty_bind_group_layout"), &[]);
|
||||
EMPTY_BIND_GROUP_LAYOUT
|
||||
.set(layout)
|
||||
.expect("init_empty_bind_group_layout was called more than once");
|
||||
}
|
||||
|
||||
pub fn empty_bind_group_layout() -> BindGroupLayout {
|
||||
EMPTY_BIND_GROUP_LAYOUT
|
||||
.get()
|
||||
.expect("init_empty_bind_group_layout was not called")
|
||||
.clone()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user