From b404b50b62f6de9695f0236f764f5de0bfda18a7 Mon Sep 17 00:00:00 2001 From: Janis Date: Sun, 19 Jan 2025 15:17:21 +0100 Subject: [PATCH] renderer struct that handles engine objects like samplers, textures --- crates/renderer/src/lib.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/crates/renderer/src/lib.rs b/crates/renderer/src/lib.rs index 0c274df..d10bc45 100644 --- a/crates/renderer/src/lib.rs +++ b/crates/renderer/src/lib.rs @@ -2054,6 +2054,32 @@ impl EguiState { } } +pub struct Renderer2 { + device: Device, + samplers: SamplerCache, + texture_managers: texture::TextureManager, + + #[allow(unused)] + // keep this around because the vulkan device has been created with this + // display handle in mind. Might not be necessary. + display: RawDisplayHandle, +} + +impl Renderer2 { + pub fn new(display: RawDisplayHandle) -> Result { + let device = Device::new_from_default_desc(Some(display))?; + + Ok(Self { + samplers: SamplerCache::new(device.clone()), + texture_managers: texture::TextureManager::new(device.clone()), + display, + device, + }) + } + + //pub fn create_surface +} + pub struct Renderer { pub texture_handler: texture::TextureManager, pub egui_state: EguiState,