Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "wgpu_text"
authors = ["Leon (Blatko1)"]
version = "27.0.1"
version = "28.0.0"
edition = "2024"
description = "A simple 2D text renderer for wgpu."
license = "MIT"
Expand All @@ -12,13 +12,13 @@ categories = ["graphics", "rendering"]
include = ["src/**/*", "LICENSE", "Cargo.toml", "README.md", ".gitignore"]

[dependencies]
wgpu = "27.0.1"
wgpu = "28.0.0"
glyph_brush = "0.7.12"
log = "0.4.28"
bytemuck = { version = "1.24.0", features = ["derive"] }

[dev-dependencies]
wgpu = { version = "27.0.1", features = ["spirv"] }
wgpu = { version = "28.0.0", features = ["spirv"] }
winit = "0.30.12"
pollster = "0.4.0"
env_logger = "0.11.8"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add the following to your `Cargo.toml` file:

```toml
[dependencies]
wgpu_text = "27.0.1"
wgpu_text = "28.0.0"
```

## **Usage**
Expand Down
10 changes: 7 additions & 3 deletions examples/custom_target/custom_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use camera::Camera;
use ctx::Ctx;
use glyph_brush::ab_glyph::FontRef;
use glyph_brush::{OwnedSection, OwnedText, VerticalAlign};
use pipeline::{create_pipeline, Vertex};
use pipeline::{Vertex, create_pipeline};
use std::sync::Arc;
use std::time::{Duration, Instant};
use wgpu::util::DeviceExt;
Expand Down Expand Up @@ -121,7 +121,7 @@ impl ApplicationHandler for State<'_> {
address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Linear,
min_filter: wgpu::FilterMode::Linear,
mipmap_filter: wgpu::FilterMode::Linear,
mipmap_filter: wgpu::MipmapFilterMode::Linear,
..Default::default()
});
self.texture_view = Some(texture.create_view(&Default::default()));
Expand Down Expand Up @@ -367,6 +367,7 @@ impl ApplicationHandler for State<'_> {
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});

brush.draw(&mut rpass);
Expand Down Expand Up @@ -394,6 +395,7 @@ impl ApplicationHandler for State<'_> {
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});

rpass.set_pipeline(self.pipeline.as_ref().unwrap());
Expand Down Expand Up @@ -440,7 +442,9 @@ impl ApplicationHandler for State<'_> {

fn main() {
if std::env::var("RUST_LOG").is_err() {
unsafe { std::env::set_var("RUST_LOG", "error"); }
unsafe {
std::env::set_var("RUST_LOG", "error");
}
}
env_logger::init();

Expand Down
4 changes: 2 additions & 2 deletions examples/custom_target/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn create_pipeline(
let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Custom Surface Render Pipeline Layout"),
bind_group_layouts,
push_constant_ranges: &[],
immediate_size: 0,
});

let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
Expand Down Expand Up @@ -74,7 +74,7 @@ pub fn create_pipeline(
})],
compilation_options: Default::default(),
}),
multiview: None,
multiview_mask: None,
cache: None,
});
pipeline
Expand Down
13 changes: 9 additions & 4 deletions examples/depth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
mod ctx;

use ctx::Ctx;
use glyph_brush::ab_glyph::FontRef;
use glyph_brush::OwnedSection;
use glyph_brush::ab_glyph::FontRef;
use std::sync::Arc;
use std::time::{Duration, Instant};
use wgpu::{DepthStencilState, TextureView};
Expand Down Expand Up @@ -268,6 +268,7 @@ impl ApplicationHandler for State<'_> {
),
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});

brush.draw(&mut rpass);
Expand All @@ -287,8 +288,10 @@ impl ApplicationHandler for State<'_> {
self.delta_time = Instant::now();
self.fps += 1;
if self.fps_update_time.elapsed().as_millis() > 1000 {
window
.set_title(&format!("wgpu-text: 'depth' example, FPS: {}", self.fps));
window.set_title(&format!(
"wgpu-text: 'depth' example, FPS: {}",
self.fps
));
self.fps = 0;
self.fps_update_time = Instant::now();
}
Expand All @@ -303,7 +306,9 @@ impl ApplicationHandler for State<'_> {

fn main() {
if std::env::var("RUST_LOG").is_err() {
unsafe { std::env::set_var("RUST_LOG", "error"); }
unsafe {
std::env::set_var("RUST_LOG", "error");
}
}
env_logger::init();

Expand Down
5 changes: 4 additions & 1 deletion examples/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ impl ApplicationHandler for State<'_> {
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});

brush.draw(&mut rpass)
Expand Down Expand Up @@ -238,7 +239,9 @@ impl ApplicationHandler for State<'_> {

fn main() {
if std::env::var("RUST_LOG").is_err() {
unsafe { std::env::set_var("RUST_LOG", "error"); }
unsafe {
std::env::set_var("RUST_LOG", "error");
}
}
env_logger::init();

Expand Down
7 changes: 5 additions & 2 deletions examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
mod ctx;

use ctx::Ctx;
use glyph_brush::ab_glyph::FontRef;
use glyph_brush::OwnedSection;
use glyph_brush::ab_glyph::FontRef;
use std::sync::Arc;
use std::time::{Duration, Instant};
use wgpu_text::glyph_brush::{
Expand Down Expand Up @@ -241,6 +241,7 @@ impl ApplicationHandler for State<'_> {
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});

brush.draw(&mut rpass);
Expand Down Expand Up @@ -279,7 +280,9 @@ impl ApplicationHandler for State<'_> {
// TODO text layout of characters like 'š, ć, ž, đ' doesn't work correctly.
fn main() {
if std::env::var("RUST_LOG").is_err() {
unsafe { std::env::set_var("RUST_LOG", "error"); }
unsafe {
std::env::set_var("RUST_LOG", "error");
}
}
env_logger::init();

Expand Down
10 changes: 5 additions & 5 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::num::NonZeroU32;

use glyph_brush::{
ab_glyph::{point, Rect},
Rectangle,
ab_glyph::{Rect, point},
};
use wgpu::util::DeviceExt;

use crate::{cache::Cache, Matrix};
use crate::{Matrix, cache::Cache};

/// Responsible for drawing text.
#[derive(Debug)]
Expand All @@ -25,7 +25,7 @@ impl Pipeline {
render_format: wgpu::TextureFormat,
depth_stencil: Option<wgpu::DepthStencilState>,
multisample: wgpu::MultisampleState,
multiview: Option<NonZeroU32>,
multiview_mask: Option<NonZeroU32>,
tex_dimensions: (u32, u32),
matrix: Matrix,
) -> Pipeline {
Expand All @@ -45,7 +45,7 @@ impl Pipeline {
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("wgpu-text Render Pipeline Layout"),
bind_group_layouts: &[&cache.bind_group_layout],
push_constant_ranges: &[],
immediate_size: 0,
});

let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
Expand Down Expand Up @@ -74,8 +74,8 @@ impl Pipeline {
})],
compilation_options: Default::default(),
}),
multiview,
cache: None,
multiview_mask,
});

Self {
Expand Down