flag UPDATE_AFTER_BIND descriptor sets to fix validation

This commit is contained in:
galister
2025-09-28 23:00:29 +09:00
parent 0d251e9351
commit 8c41eaa048
12 changed files with 161 additions and 99 deletions

View File

@@ -4,12 +4,17 @@ use openxr as xr;
use std::{
f32::consts::PI,
sync::{
Arc,
atomic::{AtomicUsize, Ordering},
Arc,
},
};
use wgui::gfx::{WGfx, cmd::WGfxClearMode, pass::WGfxPass, pipeline::WGfxPipeline};
use wgui::gfx::{
cmd::WGfxClearMode,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx,
};
use crate::{
backend::openxr::helpers,
@@ -19,12 +24,11 @@ use crate::{
use vulkano::{
buffer::{BufferUsage, Subbuffer},
command_buffer::CommandBufferUsage,
pipeline::graphics::input_assembly::PrimitiveTopology,
};
use super::{
swapchain::{create_swapchain, SwapchainOpts, WlxSwapchain},
CompositionLayer, XrState,
swapchain::{SwapchainOpts, WlxSwapchain, create_swapchain},
};
static LINE_AUTO_INCREMENT: AtomicUsize = AtomicUsize::new(1);
@@ -53,10 +57,7 @@ impl LinePool {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_color").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,
false,
WPipelineCreateInfo::new(app.gfx.surface_format),
)?;
let buf_color = app

View File

@@ -7,22 +7,21 @@ use std::{
use glam::{Quat, Vec3A};
use openxr as xr;
use vulkano::{
command_buffer::CommandBufferUsage,
image::view::ImageView,
pipeline::graphics::{color_blend::AttachmentBlend, input_assembly::PrimitiveTopology},
command_buffer::CommandBufferUsage, image::view::ImageView,
pipeline::graphics::color_blend::AttachmentBlend,
};
use wgui::gfx::cmd::WGfxClearMode;
use wgui::gfx::{cmd::WGfxClearMode, pipeline::WPipelineCreateInfo};
use crate::{
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
config_io,
graphics::{CommandBuffers, ExtentExt, dds::WlxCommandBufferDds},
graphics::{dds::WlxCommandBufferDds, CommandBuffers, ExtentExt},
state::AppState,
};
use super::{
swapchain::{create_swapchain, WlxSwapchain},
CompositionLayer, XrState,
swapchain::{WlxSwapchain, create_swapchain},
};
pub(super) struct Skybox {
@@ -99,10 +98,7 @@ impl Skybox {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,
false,
WPipelineCreateInfo::new(app.gfx.surface_format),
)?;
let set0 = pipeline.uniform_sampler(0, self.view.clone(), app.gfx.texture_filter)?;
@@ -149,10 +145,7 @@ impl Skybox {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_grid").unwrap(), // want panic
app.gfx.surface_format,
Some(AttachmentBlend::alpha()),
PrimitiveTopology::TriangleStrip,
false,
WPipelineCreateInfo::new(app.gfx.surface_format).use_blend(AttachmentBlend::alpha()),
)?;
let tgt = swapchain.acquire_wait_image()?;

View File

@@ -30,8 +30,7 @@ use vulkano::{
buffer::{Buffer, BufferContents, IndexBuffer, Subbuffer},
device::{
physical::{PhysicalDevice, PhysicalDeviceType},
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo,
QueueFlags,
DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
},
format::Format,
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
@@ -284,9 +283,11 @@ pub fn init_openxr_graphics(
})
.collect::<Vec<_>>();
// If adding anything here, also add to the native device_create_info below
let features = DeviceFeatures {
dynamic_rendering: true,
..Default::default()
descriptor_binding_sampled_image_update_after_bind: true,
..DeviceFeatures::empty()
};
let queue_create_infos = queue_families
@@ -305,8 +306,12 @@ pub fn init_openxr_graphics(
let mut dynamic_rendering =
vk::PhysicalDeviceDynamicRenderingFeatures::default().dynamic_rendering(true);
let mut indexing_features = vk::PhysicalDeviceDescriptorIndexingFeatures::default()
.descriptor_binding_sampled_image_update_after_bind(true);
dynamic_rendering.p_next = device_create_info.p_next.cast_mut();
device_create_info.p_next = &raw mut dynamic_rendering as *const c_void;
indexing_features.p_next = &raw mut dynamic_rendering as *mut c_void;
device_create_info.p_next = &raw mut indexing_features as *const c_void;
let (device, queues) = unsafe {
let vk_device = xr_instance
@@ -375,6 +380,8 @@ pub fn init_openvr_graphics(
mut vk_instance_extensions: InstanceExtensions,
mut vk_device_extensions_fn: impl FnMut(&PhysicalDevice) -> DeviceExtensions,
) -> anyhow::Result<(Arc<WGfx>, WGfxExtras)> {
use vulkano::device::Device;
//#[cfg(debug_assertions)]
//let layers = vec!["VK_LAYER_KHRONOS_validation".to_owned()];
//#[cfg(not(debug_assertions))]
@@ -449,6 +456,7 @@ pub fn init_openvr_graphics(
enabled_extensions: my_extensions,
enabled_features: DeviceFeatures {
dynamic_rendering: true,
descriptor_binding_sampled_image_update_after_bind: true,
..DeviceFeatures::empty()
},
queue_create_infos: queue_families

View File

@@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc, sync::Arc};
use button::setup_custom_button;
use glam::{Affine2, Vec2, vec2};
use glam::{vec2, Affine2, Vec2};
use label::setup_custom_label;
use vulkano::{command_buffer::CommandBufferUsage, image::view::ImageView};
use wgui::{
@@ -20,7 +20,7 @@ use wgui::{
use crate::{
backend::{
input::{Haptics, PointerHit, PointerMode},
overlay::{FrameMeta, OverlayBackend, ShouldRender, ui_transform},
overlay::{ui_transform, FrameMeta, OverlayBackend, ShouldRender},
},
graphics::{CommandBuffers, ExtentExt},
state::AppState,

View File

@@ -1,27 +1,32 @@
use std::{f32::consts::PI, sync::Arc};
use glam::{Affine3A, Vec3};
use smallvec::smallvec;
use vulkano::{
buffer::{BufferUsage, Subbuffer},
command_buffer::CommandBufferUsage,
device::Queue,
format::Format,
image::{Image, sampler::Filter, view::ImageView},
pipeline::graphics::{color_blend::AttachmentBlend, input_assembly::PrimitiveTopology},
image::{sampler::Filter, view::ImageView, Image},
pipeline::graphics::color_blend::AttachmentBlend,
};
use wgui::gfx::{
cmd::WGfxClearMode,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx,
};
use wgui::gfx::{WGfx, cmd::WGfxClearMode, pass::WGfxPass, pipeline::WGfxPipeline};
use wlx_capture::{
WlxCapture,
frame::{self as wlx_frame, DrmFormat, FrameFormat, MouseMeta, Transform, WlxFrame},
WlxCapture,
};
use crate::{
backend::overlay::FrameMeta,
config::GeneralConfig,
graphics::{
CommandBuffers, Vert2Uv,
dmabuf::{WGfxDmabuf, fourcc_to_vk},
upload_quad_vertices,
dmabuf::{fourcc_to_vk, WGfxDmabuf},
upload_quad_vertices, CommandBuffers, Vert2Uv,
},
state::AppState,
};
@@ -48,10 +53,9 @@ impl ScreenPipeline {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_screen").unwrap(), // want panic
app.gfx.surface_format,
Some(AttachmentBlend::default()),
PrimitiveTopology::TriangleStrip,
false,
WPipelineCreateInfo::new(app.gfx.surface_format)
.use_blend(AttachmentBlend::default())
.use_updatable_descriptors(smallvec![0]),
)?;
let buf_alpha = app

View File

@@ -1,14 +1,18 @@
use glam::{Affine2, Vec3, Vec3A, vec3a};
use glam::{vec3a, Affine2, Vec3, Vec3A};
use smallvec::smallvec;
use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};
use vulkano::{
buffer::{BufferUsage, Subbuffer},
command_buffer::CommandBufferUsage,
format::Format,
image::{Image, ImageTiling, SubresourceLayout, view::ImageView},
pipeline::graphics::input_assembly::PrimitiveTopology,
image::{view::ImageView, Image, ImageTiling, SubresourceLayout},
};
use wayvr_ipc::packet_server::{self, PacketServer, WvrStateChanged};
use wgui::gfx::{WGfx, pass::WGfxPass, pipeline::WGfxPipeline};
use wgui::gfx::{
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx,
};
use wlx_capture::frame::{DmabufFrame, FourCC, FrameFormat, FramePlane};
use crate::{
@@ -16,17 +20,18 @@ use crate::{
common::{OverlayContainer, OverlaySelector},
input::{self},
overlay::{
FrameMeta, OverlayBackend, OverlayData, OverlayID, OverlayState, ShouldRender,
Z_ORDER_DASHBOARD, ui_transform,
ui_transform, FrameMeta, OverlayBackend, OverlayData, OverlayID, OverlayState,
ShouldRender, Z_ORDER_DASHBOARD,
},
task::TaskType,
wayvr::{
self, WayVR, WayVRAction, WayVRDisplayClickAction, display,
self, display,
server_ipc::{gen_args_vec, gen_env_vec},
WayVR, WayVRAction, WayVRDisplayClickAction,
},
},
config_wayvr,
graphics::{CommandBuffers, Vert2Uv, dmabuf::WGfxDmabuf},
graphics::{dmabuf::WGfxDmabuf, CommandBuffers, Vert2Uv},
state::{self, AppState},
subsystem::input::KeyboardFocus,
};
@@ -125,10 +130,8 @@ impl WayVRBackend {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,
false,
WPipelineCreateInfo::new(app.gfx.surface_format)
.use_updatable_descriptors(smallvec![0]),
)?;
let buf_alpha = app