blade: fix tile bounds shader FFI
This commit is contained in:
parent
0a5ebee9e5
commit
224fe13f9f
2 changed files with 14 additions and 6 deletions
|
@ -3,8 +3,9 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
Action, AnyWindowHandle, BackgroundExecutor, Bounds, ClipboardItem, CursorStyle, DisplayId,
|
Action, AnyWindowHandle, BackgroundExecutor, Bounds, ClipboardItem, CursorStyle, DisplayId,
|
||||||
ForegroundExecutor, Keymap, LinuxDispatcher, LinuxDisplay, LinuxTextSystem, LinuxWindow,
|
ForegroundExecutor, Keymap, LinuxDispatcher, LinuxDisplay, LinuxTextSystem, LinuxWindow,
|
||||||
LinuxWindowState, Menu, PathPromptOptions, Platform, PlatformDisplay, PlatformInput,
|
LinuxWindowState, Menu, PathPromptOptions, Platform, PlatformDispatcher as _, PlatformDisplay,
|
||||||
PlatformTextSystem, PlatformWindow, Point, Result, SemanticVersion, Size, Task, WindowOptions,
|
PlatformInput, PlatformTextSystem, PlatformWindow, Point, Result, SemanticVersion, Size, Task,
|
||||||
|
WindowOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
use collections::{HashMap, HashSet};
|
use collections::{HashMap, HashSet};
|
||||||
|
@ -39,6 +40,7 @@ pub(crate) struct LinuxPlatformState {
|
||||||
atoms: XcbAtoms,
|
atoms: XcbAtoms,
|
||||||
background_executor: BackgroundExecutor,
|
background_executor: BackgroundExecutor,
|
||||||
foreground_executor: ForegroundExecutor,
|
foreground_executor: ForegroundExecutor,
|
||||||
|
dispatcher: Arc<LinuxDispatcher>,
|
||||||
windows: HashMap<x::Window, Arc<LinuxWindowState>>,
|
windows: HashMap<x::Window, Arc<LinuxWindowState>>,
|
||||||
text_system: Arc<LinuxTextSystem>,
|
text_system: Arc<LinuxTextSystem>,
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,8 @@ impl LinuxPlatform {
|
||||||
x_root_index,
|
x_root_index,
|
||||||
atoms,
|
atoms,
|
||||||
background_executor: BackgroundExecutor::new(dispatcher.clone()),
|
background_executor: BackgroundExecutor::new(dispatcher.clone()),
|
||||||
foreground_executor: ForegroundExecutor::new(dispatcher),
|
foreground_executor: ForegroundExecutor::new(dispatcher.clone()),
|
||||||
|
dispatcher,
|
||||||
windows: HashMap::default(),
|
windows: HashMap::default(),
|
||||||
text_system: Arc::new(LinuxTextSystem::new()),
|
text_system: Arc::new(LinuxTextSystem::new()),
|
||||||
}))
|
}))
|
||||||
|
@ -118,6 +121,7 @@ impl Platform for LinuxPlatform {
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
self.0.lock().dispatcher.tick(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +186,7 @@ impl Platform for LinuxPlatform {
|
||||||
display_id: DisplayId,
|
display_id: DisplayId,
|
||||||
callback: Box<dyn FnMut() + Send>,
|
callback: Box<dyn FnMut() + Send>,
|
||||||
) {
|
) {
|
||||||
unimplemented!()
|
log::warn!("unimplemented: set_display_link_output_callback");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_display_link(&self, display_id: DisplayId) {}
|
fn start_display_link(&self, display_id: DisplayId) {}
|
||||||
|
|
|
@ -43,11 +43,15 @@ struct AtlasTextureId {
|
||||||
kind: u32,
|
kind: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct AtlasBounds {
|
||||||
|
origin: vec2<i32>,
|
||||||
|
size: vec2<i32>,
|
||||||
|
}
|
||||||
struct AtlasTile {
|
struct AtlasTile {
|
||||||
texture_id: AtlasTextureId,
|
texture_id: AtlasTextureId,
|
||||||
tile_id: u32,
|
tile_id: u32,
|
||||||
padding: u32,
|
padding: u32,
|
||||||
bounds: Bounds,
|
bounds: AtlasBounds,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_device_position_impl(position: vec2<f32>) -> vec4<f32> {
|
fn to_device_position_impl(position: vec2<f32>) -> vec4<f32> {
|
||||||
|
@ -62,7 +66,7 @@ fn to_device_position(unit_vertex: vec2<f32>, bounds: Bounds) -> vec4<f32> {
|
||||||
|
|
||||||
fn to_tile_position(unit_vertex: vec2<f32>, tile: AtlasTile) -> vec2<f32> {
|
fn to_tile_position(unit_vertex: vec2<f32>, tile: AtlasTile) -> vec2<f32> {
|
||||||
let atlas_size = vec2<f32>(textureDimensions(t_sprite, 0));
|
let atlas_size = vec2<f32>(textureDimensions(t_sprite, 0));
|
||||||
return (tile.bounds.origin + unit_vertex * tile.bounds.size) / atlas_size;
|
return (vec2<f32>(tile.bounds.origin) + unit_vertex * vec2<f32>(tile.bounds.size)) / atlas_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn distance_from_clip_rect_impl(position: vec2<f32>, clip_bounds: Bounds) -> vec4<f32> {
|
fn distance_from_clip_rect_impl(position: vec2<f32>, clip_bounds: Bounds) -> vec4<f32> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue