Skip to content

Commit

Permalink
Lazily initialize render registry (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper0406 committed Jan 6, 2022
1 parent 8db0559 commit c0b2e50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions skulpin-renderer/src/renderer.rs
Expand Up @@ -108,6 +108,12 @@ pub struct Renderer {
pub api: RafxApi,
}

lazy_static::lazy_static! {
pub static ref RENDER_REGISTRY: RenderRegistry = RenderRegistryBuilder::default()
.register_render_phase::<OpaqueRenderPhase>("opaque")
.build();
}

impl Renderer {
/// Create the renderer
pub fn new(
Expand All @@ -119,11 +125,8 @@ impl Renderer {
let api = unsafe { RafxApi::new(window, &Default::default()) }?;
let device_context = api.device_context();

let render_registry = RenderRegistryBuilder::default()
.register_render_phase::<OpaqueRenderPhase>("opaque")
.build();
let resource_manager =
rafx::framework::ResourceManager::new(&device_context, &render_registry);
rafx::framework::ResourceManager::new(&device_context, &RENDER_REGISTRY);

let swapchain = device_context.create_swapchain(
window,
Expand Down

0 comments on commit c0b2e50

Please sign in to comment.