damascene_vulkano/lib.rs
1//! Native Vulkan backend for custom Damascene hosts.
2//!
3//! Most applications should implement `damascene_core::App` and run it
4//! through `damascene-winit-wgpu`. Use this crate directly when you are
5//! validating backend parity or embedding Damascene into an existing Vulkan
6//! renderer built on `vulkano`.
7//!
8//! The public entry point is [`Runner`]. Its surface mirrors
9//! `damascene-wgpu::Runner` where the GPU APIs allow it: the host owns the
10//! window, device, queue, swapchain, and event loop; the runner owns
11//! Damascene interaction state, layout/draw-op preparation, Vulkan
12//! pipelines, text atlas images, and icon rendering.
13//!
14//! WGSL remains the shader source language. This backend uses [`naga`]
15//! to compile WGSL to SPIR-V when building pipelines so custom shader
16//! fixtures can be shared with the `wgpu` backend.
17
18mod icon;
19mod image;
20mod instance;
21pub mod naga_compile;
22mod pipeline;
23pub mod runner;
24mod scene;
25mod surface;
26mod text;
27
28pub use naga_compile::{CompileError, wgsl_to_spirv};
29pub use runner::{LayoutPrepared, PointerMove, PrepareResult, PrepareTimings, Runner};
30pub use surface::{VulkanoAppTexture, app_texture};
31
32/// Vulkan device features the runner's stock pipelines depend on.
33/// Hosts must merge this with their own required features when calling
34/// `Device::new(..., DeviceCreateInfo { enabled_features, .. })` —
35/// otherwise pipeline construction panics with a SPIR-V validation
36/// error like "uses the SPIR-V capability `SampleRateShading`".
37///
38/// Currently this is just `sample_rate_shading`, used by
39/// `stock::rounded_rect`'s `@interpolate(perspective, sample)` to keep
40/// quad antialiasing one screen-pixel wide under MSAA. Wgpu's
41/// device-creation flow turns this on by default; vulkano's doesn't.
42pub fn required_device_features() -> vulkano::device::DeviceFeatures {
43 vulkano::device::DeviceFeatures {
44 sample_rate_shading: true,
45 ..vulkano::device::DeviceFeatures::empty()
46 }
47}