fix MacOS build, switch external RWH to 0.6
leaving blade-internal RWH as 0.5 until this is fixed: https://github.com/ash-rs/ash/issues/864
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
|
||||
use super::{BladeBelt, BladeBeltDescriptor};
|
||||
use crate::{
|
||||
AtlasTextureKind, AtlasTile, BladeAtlas, Bounds, ContentMask, Hsla, Path, PathId, PathVertex,
|
||||
PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Underline, MonochromeSprite, PolychromeSprite, PATH_TEXTURE_FORMAT,
|
||||
AtlasTextureKind, AtlasTile, BladeAtlas, Bounds, ContentMask, Hsla, MonochromeSprite, Path,
|
||||
PathId, PathVertex, PolychromeSprite, PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow,
|
||||
Underline, PATH_TEXTURE_FORMAT,
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use collections::HashMap;
|
||||
@@ -444,7 +445,10 @@ impl BladeRenderer {
|
||||
);
|
||||
encoder.draw(0, 4, 0, underlines.len() as u32);
|
||||
}
|
||||
PrimitiveBatch::MonochromeSprites { texture_id, sprites } => {
|
||||
PrimitiveBatch::MonochromeSprites {
|
||||
texture_id,
|
||||
sprites,
|
||||
} => {
|
||||
let tex_info = self.atlas.get_texture_info(texture_id);
|
||||
let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
|
||||
let mut encoder = pass.with(&self.pipelines.mono_sprites);
|
||||
@@ -459,7 +463,10 @@ impl BladeRenderer {
|
||||
);
|
||||
encoder.draw(0, 4, 0, sprites.len() as u32);
|
||||
}
|
||||
PrimitiveBatch::PolychromeSprites { texture_id, sprites } => {
|
||||
PrimitiveBatch::PolychromeSprites {
|
||||
texture_id,
|
||||
sprites,
|
||||
} => {
|
||||
let tex_info = self.atlas.get_texture_info(texture_id);
|
||||
let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
|
||||
let mut encoder = pass.with(&self.pipelines.poly_sprites);
|
||||
@@ -474,7 +481,7 @@ impl BladeRenderer {
|
||||
);
|
||||
encoder.draw(0, 4, 0, sprites.len() as u32);
|
||||
}
|
||||
PrimitiveBatch::Surfaces {..} => {
|
||||
PrimitiveBatch::Surfaces { .. } => {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ use raw_window_handle as rwh;
|
||||
use std::{
|
||||
ffi::c_void,
|
||||
mem,
|
||||
num::NonZeroU32,
|
||||
ptr::NonNull,
|
||||
rc::Rc,
|
||||
sync::{self, Arc},
|
||||
};
|
||||
@@ -71,17 +73,17 @@ pub(crate) struct LinuxWindowState {
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct LinuxWindow(pub(crate) Arc<LinuxWindowState>);
|
||||
|
||||
unsafe impl rwh::HasRawWindowHandle for RawWindow {
|
||||
fn raw_window_handle(&self) -> rwh::RawWindowHandle {
|
||||
let mut wh = rwh::XcbWindowHandle::empty();
|
||||
unsafe impl blade_rwh::HasRawWindowHandle for RawWindow {
|
||||
fn raw_window_handle(&self) -> blade_rwh::RawWindowHandle {
|
||||
let mut wh = blade_rwh::XcbWindowHandle::empty();
|
||||
wh.window = self.window_id;
|
||||
wh.visual_id = self.visual_id;
|
||||
wh.into()
|
||||
}
|
||||
}
|
||||
unsafe impl rwh::HasRawDisplayHandle for RawWindow {
|
||||
fn raw_display_handle(&self) -> rwh::RawDisplayHandle {
|
||||
let mut dh = rwh::XcbDisplayHandle::empty();
|
||||
unsafe impl blade_rwh::HasRawDisplayHandle for RawWindow {
|
||||
fn raw_display_handle(&self) -> blade_rwh::RawDisplayHandle {
|
||||
let mut dh = blade_rwh::XcbDisplayHandle::empty();
|
||||
dh.connection = self.connection;
|
||||
dh.screen = self.screen_id;
|
||||
dh.into()
|
||||
@@ -91,16 +93,18 @@ unsafe impl rwh::HasRawDisplayHandle for RawWindow {
|
||||
impl rwh::HasWindowHandle for LinuxWindow {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
|
||||
Ok(unsafe {
|
||||
let raw_handle = rwh::HasRawWindowHandle::raw_window_handle(&self.0.raw);
|
||||
rwh::WindowHandle::borrow_raw(raw_handle, rwh::ActiveHandle::new())
|
||||
let non_zero = NonZeroU32::new(self.0.raw.window_id).unwrap();
|
||||
let handle = rwh::XcbWindowHandle::new(non_zero);
|
||||
rwh::WindowHandle::borrow_raw(handle.into())
|
||||
})
|
||||
}
|
||||
}
|
||||
impl rwh::HasDisplayHandle for LinuxWindow {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
|
||||
Ok(unsafe {
|
||||
let raw_handle = rwh::HasRawDisplayHandle::raw_display_handle(&self.0.raw);
|
||||
rwh::DisplayHandle::borrow_raw(raw_handle)
|
||||
let non_zero = NonNull::new(self.0.raw.connection).unwrap();
|
||||
let handle = rwh::XcbDisplayHandle::new(Some(non_zero), self.0.raw.screen_id);
|
||||
rwh::DisplayHandle::borrow_raw(handle.into())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user