diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
commit | c48b54f3fb7bbe9046915eb99eca02fa84dc55c9 (patch) | |
tree | 752831451d2bd3a658485df724a01ae39e80fae3 /stockton-render/src/draw/ui/texture.rs | |
parent | b437109ebf4da243fd643f0a31546d0d0155b0a4 (diff) |
feat(render): multithreaded texture loading
also a bunch of supporting changes
Diffstat (limited to 'stockton-render/src/draw/ui/texture.rs')
-rwxr-xr-x | stockton-render/src/draw/ui/texture.rs | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/stockton-render/src/draw/ui/texture.rs b/stockton-render/src/draw/ui/texture.rs index 98688de..439c3d7 100755 --- a/stockton-render/src/draw/ui/texture.rs +++ b/stockton-render/src/draw/ui/texture.rs @@ -14,10 +14,25 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ -use crate::draw::texture::{LoadableImage, TextureStore}; +use crate::draw::texture::{LoadableImage, TextureRepo}; use crate::types::*; -use crate::UIState; +use crate::UiState; use egui::Texture; +use stockton_levels::{prelude::HasTextures, traits::textures::Texture as LTexture}; + +pub struct UiTextures; + +impl HasTextures for UiTextures { + type TexturesIter<'a> = std::slice::Iter<'a, LTexture>; + + fn textures_iter(&self) -> Self::TexturesIter<'_> { + (&[]).iter() + } + + fn get_texture(&self, _idx: u32) -> Option<&stockton_levels::prelude::textures::Texture> { + None + } +} impl LoadableImage for &Texture { fn width(&self) -> u32 { @@ -38,31 +53,25 @@ impl LoadableImage for &Texture { } } } + + unsafe fn copy_into(&self, _ptr: *mut u8, _row_size: usize) { + todo!() + } } pub fn ensure_textures( - texture_store: &mut TextureStore, - ui: &mut UIState, - device: &mut Device, - adapter: &mut Adapter, - allocator: &mut DynamicAllocator, - command_queue: &mut CommandQueue, - command_pool: &mut CommandPool, + _tex_repo: &mut TextureRepo, + ui: &mut UiState, + _device: &mut Device, + _adapter: &mut Adapter, + _allocator: &mut DynamicAllocator, + _command_queue: &mut CommandQueue, + _command_pool: &mut CommandPool, ) { let tex = ui.ctx.texture(); if tex.version != ui.last_tex_ver { - texture_store - .put_texture( - 0, - &*tex, - device, - adapter, - allocator, - command_queue, - command_pool, - ) - .unwrap(); // TODO + // tex_repo.force_queue_load(0).unwrap(); // TODO ui.last_tex_ver = tex.version; } } |