initial text impl
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use wgpu::VertexAttribute;
|
||||
|
||||
use crate::UiRegion;
|
||||
use crate::layout::UiRegion;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable, Default)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::num::NonZero;
|
||||
|
||||
use crate::{
|
||||
Ui,
|
||||
layout::Ui,
|
||||
render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf},
|
||||
};
|
||||
use data::WindowUniform;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
Color, UiRegion,
|
||||
layout::{Color, TextureHandle, UiRegion},
|
||||
render::{ArrBuf, data::PrimitiveInstance},
|
||||
};
|
||||
use bytemuck::Pod;
|
||||
@@ -8,6 +8,8 @@ use wgpu::*;
|
||||
pub struct Primitives {
|
||||
pub(super) instances: Vec<PrimitiveInstance>,
|
||||
pub(super) data: PrimitiveData,
|
||||
// ensure drawn textures don't get freed
|
||||
pub(crate) drawn_textures: Vec<TextureHandle>,
|
||||
pub updated: bool,
|
||||
}
|
||||
|
||||
@@ -16,6 +18,7 @@ impl Default for Primitives {
|
||||
Self {
|
||||
instances: Default::default(),
|
||||
data: Default::default(),
|
||||
drawn_textures: Default::default(),
|
||||
updated: true,
|
||||
}
|
||||
}
|
||||
@@ -98,6 +101,7 @@ impl Primitives {
|
||||
self.updated = true;
|
||||
self.instances.clear();
|
||||
self.data.clear();
|
||||
self.drawn_textures.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use image::{DynamicImage, EncodableLayout};
|
||||
use wgpu::{util::DeviceExt, *};
|
||||
|
||||
use crate::{TextureUpdate, Textures};
|
||||
use crate::layout::{TextureUpdate, Textures};
|
||||
|
||||
pub struct GpuTextures {
|
||||
device: Device,
|
||||
@@ -23,6 +23,9 @@ impl GpuTextures {
|
||||
TextureUpdate::Free(i) => self.free(i),
|
||||
}
|
||||
}
|
||||
// if changed {
|
||||
// println!("{}", self.views.len());
|
||||
// }
|
||||
changed
|
||||
}
|
||||
fn set(&mut self, i: u32, image: &DynamicImage) {
|
||||
|
||||
Reference in New Issue
Block a user