mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
commit
3c7943fa8c
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -44,18 +44,18 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
|||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.31.0"
|
||||
version = "0.33.3+1.2.191"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
|
||||
checksum = "cc4f1d82f164f838ae413296d1131aa6fa79b917d25bebaa7033d25620c09219"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"libloading 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ash-window"
|
||||
version = "0.5.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "905c4ca25f752e7ab3c3e8f2882625f876e4c3ea5feffbc83f81d697e043afd6"
|
||||
checksum = "12f91ce4c6be1a2ba99d3d6cd57d5bae9ac6d6f903b5ae53d6b1dee2edf872af"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"raw-window-handle",
|
||||
|
@ -348,7 +348,7 @@ version = "0.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"libloading 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -497,6 +497,16 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.1"
|
||||
|
|
|
@ -7,8 +7,8 @@ license = "MIT/Apache-2.0"
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
ash = "0.31"
|
||||
ash-window = "0.5"
|
||||
ash = "0.33"
|
||||
ash-window = "0.7"
|
||||
raw-window-handle = "0.3"
|
||||
bitflags = "1.2.1"
|
||||
smallvec = "1.6.1"
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::os::raw::c_char;
|
|||
use std::sync::Arc;
|
||||
|
||||
use ash::extensions::{ext::DebugUtils, khr};
|
||||
use ash::version::{DeviceV1_0, EntryV1_0, InstanceV1_0, InstanceV1_1};
|
||||
use ash::{vk, Device, Entry, Instance};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
@ -21,7 +20,6 @@ pub struct VkInstance {
|
|||
#[allow(unused)]
|
||||
entry: Entry,
|
||||
instance: Instance,
|
||||
get_phys_dev_props: Option<vk::KhrGetPhysicalDeviceProperties2Fn>,
|
||||
vk_version: u32,
|
||||
_dbg_loader: Option<DebugUtils>,
|
||||
_dbg_callbk: Option<vk::DebugUtilsMessengerEXT>,
|
||||
|
@ -178,8 +176,6 @@ impl VkInstance {
|
|||
if cfg!(debug_assertions) {
|
||||
has_debug_ext = exts.try_add(DebugUtils::name());
|
||||
}
|
||||
// We'll need this to do runtime query of descriptor indexing.
|
||||
let has_phys_dev_props = exts.try_add(vk::KhrGetPhysicalDeviceProperties2Fn::name());
|
||||
if let Some(ref handle) = window_handle {
|
||||
for ext in ash_window::enumerate_required_extensions(*handle)? {
|
||||
exts.try_add(ext);
|
||||
|
@ -188,12 +184,12 @@ impl VkInstance {
|
|||
|
||||
let supported_version = entry
|
||||
.try_enumerate_instance_version()?
|
||||
.unwrap_or(vk::make_version(1, 0, 0));
|
||||
let vk_version = if supported_version >= vk::make_version(1, 1, 0) {
|
||||
.unwrap_or(vk::make_api_version(0, 1, 0, 0));
|
||||
let vk_version = if supported_version >= vk::make_api_version(0, 1, 1, 0) {
|
||||
// We need Vulkan 1.1 to do subgroups; most other things can be extensions.
|
||||
vk::make_version(1, 1, 0)
|
||||
vk::make_api_version(0, 1, 1, 0)
|
||||
} else {
|
||||
vk::make_version(1, 0, 0)
|
||||
vk::make_api_version(0, 1, 0, 0)
|
||||
};
|
||||
|
||||
let instance = entry.create_instance(
|
||||
|
@ -235,20 +231,9 @@ impl VkInstance {
|
|||
None => None,
|
||||
};
|
||||
|
||||
let get_phys_dev_props = if has_phys_dev_props {
|
||||
Some(vk::KhrGetPhysicalDeviceProperties2Fn::load(|name| {
|
||||
std::mem::transmute(
|
||||
entry.get_instance_proc_addr(instance.handle(), name.as_ptr()),
|
||||
)
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let vk_instance = VkInstance {
|
||||
entry,
|
||||
instance,
|
||||
get_phys_dev_props,
|
||||
vk_version,
|
||||
_dbg_loader,
|
||||
_dbg_callbk,
|
||||
|
@ -271,14 +256,13 @@ impl VkInstance {
|
|||
choose_compute_device(&self.instance, &devices, surface).ok_or("no suitable device")?;
|
||||
|
||||
let mut has_descriptor_indexing = false;
|
||||
if let Some(ref get_phys_dev_props) = self.get_phys_dev_props {
|
||||
let vk1_1 = self.vk_version >= vk::make_api_version(0, 1, 1, 0);
|
||||
if vk1_1 {
|
||||
let mut descriptor_indexing_features =
|
||||
vk::PhysicalDeviceDescriptorIndexingFeatures::builder();
|
||||
// See https://github.com/MaikKlein/ash/issues/325 for why we do this workaround.
|
||||
let mut features_v2 = vk::PhysicalDeviceFeatures2::default();
|
||||
features_v2.p_next =
|
||||
&mut descriptor_indexing_features as *mut _ as *mut std::ffi::c_void;
|
||||
get_phys_dev_props.get_physical_device_features2_khr(pdevice, &mut features_v2);
|
||||
let mut features_v2 = vk::PhysicalDeviceFeatures2::builder()
|
||||
.push_next(&mut descriptor_indexing_features);
|
||||
self.instance.get_physical_device_features2(pdevice, &mut features_v2);
|
||||
has_descriptor_indexing = descriptor_indexing_features
|
||||
.shader_storage_image_array_non_uniform_indexing
|
||||
== vk::TRUE
|
||||
|
@ -309,9 +293,9 @@ impl VkInstance {
|
|||
extensions.try_add(vk::KhrMaintenance3Fn::name());
|
||||
extensions.try_add(vk::ExtDescriptorIndexingFn::name());
|
||||
}
|
||||
let has_subgroup_size = self.vk_version >= vk::make_version(1, 1, 0)
|
||||
let has_subgroup_size = vk1_1
|
||||
&& extensions.try_add(vk::ExtSubgroupSizeControlFn::name());
|
||||
let has_memory_model = self.vk_version >= vk::make_version(1, 1, 0)
|
||||
let has_memory_model = vk1_1
|
||||
&& extensions.try_add(vk::KhrVulkanMemoryModelFn::name());
|
||||
let mut create_info = vk::DeviceCreateInfo::builder()
|
||||
.queue_create_infos(&queue_create_infos)
|
||||
|
@ -353,7 +337,7 @@ impl VkInstance {
|
|||
let use_staging_buffers = props.device_type != vk::PhysicalDeviceType::INTEGRATED_GPU;
|
||||
|
||||
// TODO: finer grained query of specific subgroup info.
|
||||
let has_subgroups = self.vk_version >= vk::make_version(1, 1, 0);
|
||||
let has_subgroups = vk1_1;
|
||||
|
||||
let workgroup_limits = WorkgroupLimits {
|
||||
max_invocations: props.limits.max_compute_work_group_invocations,
|
||||
|
|
|
@ -172,11 +172,8 @@ impl PietGpuTextLayout {
|
|||
|
||||
pub(crate) fn draw_text(&self, ctx: &mut PietGpuRenderContext, pos: Point) {
|
||||
let mut scale_ctx = ScaleContext::new();
|
||||
let scaler = scale_ctx.builder(self.font.font_ref).size(2048.)
|
||||
.build();
|
||||
let mut tc = TextRenderCtx {
|
||||
scaler,
|
||||
};
|
||||
let scaler = scale_ctx.builder(self.font.font_ref).size(2048.).build();
|
||||
let mut tc = TextRenderCtx { scaler };
|
||||
// Should we use ppem from font, or let swash scale?
|
||||
const DEFAULT_UPEM: u16 = 2048;
|
||||
let scale = self.size as f32 / DEFAULT_UPEM as f32;
|
||||
|
|
Loading…
Reference in a new issue