fix alpha, remove sound for dbus toasts
This commit is contained in:
@@ -158,7 +158,7 @@ impl NotificationManager {
|
||||
|
||||
let toast = Toast::new(msg.title, msg.content.unwrap_or_else(|| "".into()))
|
||||
.with_timeout(msg.timeout.unwrap_or(5.))
|
||||
.with_sound(msg.volume.unwrap_or(0.) > 0.1);
|
||||
.with_sound(msg.volume.unwrap_or(-1.) >= 0.); // XSOverlay still plays at 0,
|
||||
|
||||
match sender.try_send(toast) {
|
||||
Ok(_) => {}
|
||||
@@ -187,9 +187,9 @@ fn parse_dbus(msg: &dbus::Message) -> anyhow::Result<Toast> {
|
||||
};
|
||||
|
||||
Ok(Toast::new(title.into(), body.into())
|
||||
.with_sound(true)
|
||||
.with_timeout(5.0)
|
||||
.with_opacity(1.0))
|
||||
// leave the audio part to the desktop env
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
|
||||
@@ -173,8 +173,6 @@ pub fn openvr_run(running: Arc<AtomicBool>) -> Result<(), BackendError> {
|
||||
continue;
|
||||
};
|
||||
|
||||
log::info!("Creating overlay: {}", state.name);
|
||||
|
||||
overlays.add(OverlayData {
|
||||
state,
|
||||
backend,
|
||||
@@ -183,7 +181,6 @@ pub fn openvr_run(running: Arc<AtomicBool>) -> Result<(), BackendError> {
|
||||
}
|
||||
TaskType::DropOverlay(sel) => {
|
||||
if let Some(o) = overlays.mut_by_selector(&sel) {
|
||||
log::info!("Dropping overlay: {}", o.state.name);
|
||||
o.destroy(&mut overlay_mngr);
|
||||
overlays.drop_by_selector(&sel);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use openxr as xr;
|
||||
use smallvec::SmallVec;
|
||||
use vulkano::{
|
||||
image::{sampler::Filter, sys::RawImage, view::ImageView, ImageCreateInfo, ImageUsage},
|
||||
pipeline::graphics::color_blend::AttachmentBlend,
|
||||
Handle,
|
||||
};
|
||||
|
||||
@@ -38,6 +39,7 @@ pub(super) fn create_swapchain_render_data(
|
||||
shaders.get("vert_common").unwrap().clone(), // want panic
|
||||
shaders.get("frag_srgb").unwrap().clone(), // want panic
|
||||
graphics.native_format,
|
||||
Some(AttachmentBlend::alpha()),
|
||||
)?;
|
||||
|
||||
let images = swapchain
|
||||
|
||||
@@ -19,27 +19,34 @@ use vulkano::{
|
||||
#[cfg(feature = "openxr")]
|
||||
use {ash::vk, std::os::raw::c_void, vulkano::swapchain::Surface};
|
||||
|
||||
pub const BLEND_ALPHA: AttachmentBlend = AttachmentBlend {
|
||||
src_color_blend_factor: BlendFactor::SrcAlpha,
|
||||
dst_color_blend_factor: BlendFactor::OneMinusSrcAlpha,
|
||||
color_blend_op: BlendOp::Add,
|
||||
src_alpha_blend_factor: BlendFactor::One,
|
||||
dst_alpha_blend_factor: BlendFactor::One,
|
||||
alpha_blend_op: BlendOp::Max,
|
||||
};
|
||||
|
||||
use vulkano::{
|
||||
buffer::{
|
||||
allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
|
||||
Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer,
|
||||
},
|
||||
command_buffer::CommandBufferInheritanceRenderingInfo,
|
||||
command_buffer::{
|
||||
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
|
||||
sys::{CommandBufferBeginInfo, RawRecordingCommandBuffer},
|
||||
CommandBuffer, CommandBufferExecFuture, CommandBufferInheritanceInfo,
|
||||
CommandBufferInheritanceRenderPassInfo, CommandBufferInheritanceRenderPassType,
|
||||
CommandBufferLevel, CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer,
|
||||
RenderPassBeginInfo, RenderingAttachmentInfo, RenderingInfo, SubpassBeginInfo,
|
||||
SubpassContents, SubpassEndInfo,
|
||||
CommandBufferInheritanceRenderingInfo, CommandBufferLevel, CommandBufferUsage,
|
||||
CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
|
||||
RenderingAttachmentInfo, RenderingInfo, SubpassBeginInfo, SubpassContents, SubpassEndInfo,
|
||||
},
|
||||
descriptor_set::{
|
||||
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||
},
|
||||
device::Features,
|
||||
device::{
|
||||
physical::PhysicalDevice, Device, DeviceCreateInfo, DeviceExtensions, Queue,
|
||||
physical::PhysicalDevice, Device, DeviceCreateInfo, DeviceExtensions, Features, Queue,
|
||||
QueueCreateInfo, QueueFlags,
|
||||
},
|
||||
format::Format,
|
||||
@@ -61,7 +68,9 @@ use vulkano::{
|
||||
},
|
||||
pipeline::{
|
||||
graphics::{
|
||||
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
|
||||
color_blend::{
|
||||
AttachmentBlend, BlendFactor, BlendOp, ColorBlendAttachmentState, ColorBlendState,
|
||||
},
|
||||
input_assembly::InputAssemblyState,
|
||||
multisample::MultisampleState,
|
||||
rasterization::RasterizationState,
|
||||
@@ -699,6 +708,7 @@ impl WlxGraphics {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
) -> anyhow::Result<Arc<WlxPipeline<WlxPipelineLegacy>>> {
|
||||
Ok(Arc::new(WlxPipeline::<WlxPipelineLegacy>::new(
|
||||
render_target,
|
||||
@@ -706,6 +716,7 @@ impl WlxGraphics {
|
||||
vert,
|
||||
frag,
|
||||
format,
|
||||
blend,
|
||||
)?))
|
||||
}
|
||||
|
||||
@@ -715,6 +726,7 @@ impl WlxGraphics {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
initial_layout: ImageLayout,
|
||||
final_layout: ImageLayout,
|
||||
) -> anyhow::Result<Arc<WlxPipeline<WlxPipelineLegacy>>> {
|
||||
@@ -724,6 +736,7 @@ impl WlxGraphics {
|
||||
vert,
|
||||
frag,
|
||||
format,
|
||||
blend,
|
||||
initial_layout,
|
||||
final_layout,
|
||||
)?))
|
||||
@@ -735,12 +748,14 @@ impl WlxGraphics {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
) -> anyhow::Result<Arc<WlxPipeline<WlxPipelineDynamic>>> {
|
||||
Ok(Arc::new(WlxPipeline::<WlxPipelineDynamic>::new(
|
||||
self.clone(),
|
||||
vert,
|
||||
frag,
|
||||
format,
|
||||
blend,
|
||||
)?))
|
||||
}
|
||||
|
||||
@@ -978,6 +993,7 @@ impl WlxPipeline<WlxPipelineDynamic> {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
) -> anyhow::Result<Self> {
|
||||
let vep = vert.entry_point("main").unwrap(); // want panic
|
||||
let fep = frag.entry_point("main").unwrap(); // want panic
|
||||
@@ -1012,7 +1028,7 @@ impl WlxPipeline<WlxPipelineDynamic> {
|
||||
multisample_state: Some(MultisampleState::default()),
|
||||
color_blend_state: Some(ColorBlendState {
|
||||
attachments: vec![ColorBlendAttachmentState {
|
||||
blend: Some(AttachmentBlend::alpha()),
|
||||
blend,
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
@@ -1054,6 +1070,7 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
) -> anyhow::Result<Self> {
|
||||
let render_pass = vulkano::single_pass_renderpass!(
|
||||
graphics.device.clone(),
|
||||
@@ -1071,7 +1088,15 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
},
|
||||
)?;
|
||||
|
||||
Self::new_from_pass(render_target, render_pass, graphics, vert, frag, format)
|
||||
Self::new_from_pass(
|
||||
render_target,
|
||||
render_pass,
|
||||
graphics,
|
||||
vert,
|
||||
frag,
|
||||
format,
|
||||
blend,
|
||||
)
|
||||
}
|
||||
|
||||
fn new_with_layout(
|
||||
@@ -1080,6 +1105,7 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
initial_layout: ImageLayout,
|
||||
final_layout: ImageLayout,
|
||||
) -> anyhow::Result<Self> {
|
||||
@@ -1106,7 +1132,15 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
|
||||
let render_pass = RenderPass::new(graphics.device.clone(), render_pass_description)?;
|
||||
|
||||
Self::new_from_pass(render_target, render_pass, graphics, vert, frag, format)
|
||||
Self::new_from_pass(
|
||||
render_target,
|
||||
render_pass,
|
||||
graphics,
|
||||
vert,
|
||||
frag,
|
||||
format,
|
||||
blend,
|
||||
)
|
||||
}
|
||||
|
||||
fn new_from_pass(
|
||||
@@ -1116,6 +1150,7 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
vert: Arc<ShaderModule>,
|
||||
frag: Arc<ShaderModule>,
|
||||
format: Format,
|
||||
blend: Option<AttachmentBlend>,
|
||||
) -> anyhow::Result<Self> {
|
||||
let vep = vert.entry_point("main").unwrap(); // want panic
|
||||
let fep = frag.entry_point("main").unwrap(); // want panic
|
||||
@@ -1151,7 +1186,7 @@ impl WlxPipeline<WlxPipelineLegacy> {
|
||||
viewport_state: Some(ViewportState::default()),
|
||||
color_blend_state: Some(ColorBlendState {
|
||||
attachments: vec![ColorBlendAttachmentState {
|
||||
blend: Some(AttachmentBlend::alpha()),
|
||||
blend,
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
|
||||
@@ -13,7 +13,9 @@ use crate::{
|
||||
input::{Haptics, InteractionHandler, PointerHit, PointerMode},
|
||||
overlay::{OverlayBackend, OverlayRenderer},
|
||||
},
|
||||
graphics::{WlxCommandBuffer, WlxGraphics, WlxPass, WlxPipeline, WlxPipelineLegacy},
|
||||
graphics::{
|
||||
WlxCommandBuffer, WlxGraphics, WlxPass, WlxPipeline, WlxPipelineLegacy, BLEND_ALPHA,
|
||||
},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
@@ -243,6 +245,7 @@ impl<D, S> Canvas<D, S> {
|
||||
shaders.get("vert_common").unwrap().clone(), // want panic
|
||||
shaders.get("frag_color").unwrap().clone(), // want panic
|
||||
format,
|
||||
Some(BLEND_ALPHA),
|
||||
)?;
|
||||
|
||||
let pipeline_fg_glyph = graphics.create_pipeline(
|
||||
@@ -250,6 +253,7 @@ impl<D, S> Canvas<D, S> {
|
||||
shaders.get("vert_common").unwrap().clone(), // want panic
|
||||
shaders.get("frag_glyph").unwrap().clone(), // want panic
|
||||
format,
|
||||
Some(BLEND_ALPHA),
|
||||
)?;
|
||||
|
||||
let vertex_buffer =
|
||||
@@ -260,6 +264,7 @@ impl<D, S> Canvas<D, S> {
|
||||
shaders.get("vert_common").unwrap().clone(), // want panic
|
||||
shaders.get("frag_sprite").unwrap().clone(), // want panic
|
||||
format,
|
||||
Some(BLEND_ALPHA),
|
||||
ImageLayout::TransferSrcOptimal,
|
||||
ImageLayout::TransferSrcOptimal,
|
||||
)?;
|
||||
|
||||
@@ -43,7 +43,7 @@ use crate::{
|
||||
overlay::{OverlayData, OverlayRenderer, OverlayState, SplitOverlayBackend},
|
||||
},
|
||||
config::def_pw_tokens,
|
||||
graphics::{fourcc_to_vk, WlxCommandBuffer, WlxPipeline, WlxPipelineLegacy},
|
||||
graphics::{fourcc_to_vk, WlxCommandBuffer, WlxPipeline, WlxPipelineLegacy, BLEND_ALPHA},
|
||||
hid::{MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT},
|
||||
state::{AppSession, AppState},
|
||||
};
|
||||
@@ -152,6 +152,7 @@ impl ScreenPipeline {
|
||||
shaders.get("vert_common").unwrap().clone(), // want panic
|
||||
shaders.get("frag_sprite").unwrap().clone(), // want panic
|
||||
app.graphics.native_format,
|
||||
Some(BLEND_ALPHA),
|
||||
)?;
|
||||
|
||||
let extentf = [extent[0] as f32, extent[1] as f32];
|
||||
|
||||
Reference in New Issue
Block a user