flag UPDATE_AFTER_BIND descriptor sets to fix validation
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::{Arc, OnceLock};
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
device::{
|
device::{
|
||||||
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
|
|
||||||
physical::{PhysicalDevice, PhysicalDeviceType},
|
physical::{PhysicalDevice, PhysicalDeviceType},
|
||||||
|
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
|
||||||
},
|
},
|
||||||
instance::{Instance, InstanceCreateInfo},
|
instance::{Instance, InstanceCreateInfo},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,29 +7,30 @@ use std::{marker::PhantomData, slice::Iter, sync::Arc};
|
|||||||
use cmd::{GfxCommandBuffer, XferCommandBuffer};
|
use cmd::{GfxCommandBuffer, XferCommandBuffer};
|
||||||
use pipeline::WGfxPipeline;
|
use pipeline::WGfxPipeline;
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
DeviceSize,
|
|
||||||
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, IndexBuffer, Subbuffer},
|
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, IndexBuffer, Subbuffer},
|
||||||
command_buffer::{
|
command_buffer::{
|
||||||
AutoCommandBufferBuilder, CommandBufferUsage,
|
|
||||||
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
|
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
|
||||||
|
AutoCommandBufferBuilder, CommandBufferUsage,
|
||||||
},
|
},
|
||||||
descriptor_set::allocator::{StandardDescriptorSetAllocator, StandardDescriptorSetAllocatorCreateInfo},
|
descriptor_set::allocator::{StandardDescriptorSetAllocator, StandardDescriptorSetAllocatorCreateInfo},
|
||||||
device::{Device, Queue},
|
device::{Device, Queue},
|
||||||
format::Format,
|
format::Format,
|
||||||
image::{Image, ImageCreateInfo, ImageType, ImageUsage, sampler::Filter},
|
image::{sampler::Filter, Image, ImageCreateInfo, ImageType, ImageUsage},
|
||||||
instance::Instance,
|
instance::Instance,
|
||||||
memory::{
|
memory::{
|
||||||
MemoryPropertyFlags,
|
|
||||||
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
|
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
|
||||||
|
MemoryPropertyFlags,
|
||||||
},
|
},
|
||||||
pipeline::graphics::{
|
pipeline::graphics::{
|
||||||
color_blend::{AttachmentBlend, BlendFactor, BlendOp},
|
color_blend::{AttachmentBlend, BlendFactor, BlendOp},
|
||||||
input_assembly::PrimitiveTopology,
|
|
||||||
vertex_input::Vertex,
|
vertex_input::Vertex,
|
||||||
},
|
},
|
||||||
shader::ShaderModule,
|
shader::ShaderModule,
|
||||||
|
DeviceSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::gfx::pipeline::WPipelineCreateInfo;
|
||||||
|
|
||||||
pub const BLEND_ALPHA: AttachmentBlend = AttachmentBlend {
|
pub const BLEND_ALPHA: AttachmentBlend = AttachmentBlend {
|
||||||
src_color_blend_factor: BlendFactor::SrcAlpha,
|
src_color_blend_factor: BlendFactor::SrcAlpha,
|
||||||
dst_color_blend_factor: BlendFactor::OneMinusSrcAlpha,
|
dst_color_blend_factor: BlendFactor::OneMinusSrcAlpha,
|
||||||
@@ -90,7 +91,10 @@ impl WGfx {
|
|||||||
));
|
));
|
||||||
let descriptor_set_allocator = Arc::new(StandardDescriptorSetAllocator::new(
|
let descriptor_set_allocator = Arc::new(StandardDescriptorSetAllocator::new(
|
||||||
device.clone(),
|
device.clone(),
|
||||||
StandardDescriptorSetAllocatorCreateInfo::default(),
|
StandardDescriptorSetAllocatorCreateInfo {
|
||||||
|
update_after_bind: true,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
let quality_filter = if device.enabled_extensions().img_filter_cubic {
|
let quality_filter = if device.enabled_extensions().img_filter_cubic {
|
||||||
@@ -166,10 +170,7 @@ impl WGfx {
|
|||||||
self: &Arc<Self>,
|
self: &Arc<Self>,
|
||||||
vert: &Arc<ShaderModule>,
|
vert: &Arc<ShaderModule>,
|
||||||
frag: &Arc<ShaderModule>,
|
frag: &Arc<ShaderModule>,
|
||||||
format: Format,
|
info: WPipelineCreateInfo,
|
||||||
blend: Option<AttachmentBlend>,
|
|
||||||
topology: PrimitiveTopology,
|
|
||||||
instanced: bool,
|
|
||||||
) -> anyhow::Result<Arc<WGfxPipeline<V>>>
|
) -> anyhow::Result<Arc<WGfxPipeline<V>>>
|
||||||
where
|
where
|
||||||
V: BufferContents + Vertex,
|
V: BufferContents + Vertex,
|
||||||
@@ -178,10 +179,7 @@ impl WGfx {
|
|||||||
self.clone(),
|
self.clone(),
|
||||||
vert,
|
vert,
|
||||||
frag,
|
frag,
|
||||||
format,
|
info,
|
||||||
blend,
|
|
||||||
topology,
|
|
||||||
instanced,
|
|
||||||
)?))
|
)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ use vulkano::{
|
|||||||
view::ImageView,
|
view::ImageView,
|
||||||
},
|
},
|
||||||
pipeline::{
|
pipeline::{
|
||||||
Pipeline, PipelineBindPoint,
|
|
||||||
graphics::{self, vertex_input::Vertex, viewport::Viewport},
|
graphics::{self, vertex_input::Vertex, viewport::Viewport},
|
||||||
|
Pipeline, PipelineBindPoint,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{WGfx, pipeline::WGfxPipeline};
|
use super::{pipeline::WGfxPipeline, WGfx};
|
||||||
|
|
||||||
pub struct WGfxPass<V> {
|
pub struct WGfxPass<V> {
|
||||||
pub command_buffer: Arc<SecondaryAutoCommandBuffer>,
|
pub command_buffer: Arc<SecondaryAutoCommandBuffer>,
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
use std::{marker::PhantomData, ops::Range, sync::Arc};
|
use std::{marker::PhantomData, ops::Range, sync::Arc};
|
||||||
|
|
||||||
use smallvec::smallvec;
|
use smallvec::{smallvec, SmallVec};
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
buffer::{
|
buffer::{
|
||||||
BufferContents, BufferUsage, Subbuffer,
|
|
||||||
allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
|
allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
|
||||||
|
BufferContents, BufferUsage, Subbuffer,
|
||||||
|
},
|
||||||
|
descriptor_set::{
|
||||||
|
layout::{DescriptorBindingFlags, DescriptorSetLayoutCreateFlags},
|
||||||
|
DescriptorSet, WriteDescriptorSet,
|
||||||
},
|
},
|
||||||
descriptor_set::{DescriptorSet, WriteDescriptorSet},
|
|
||||||
format::Format,
|
format::Format,
|
||||||
image::{
|
image::{
|
||||||
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
|
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
|
||||||
@@ -14,9 +17,8 @@ use vulkano::{
|
|||||||
},
|
},
|
||||||
memory::allocator::MemoryTypeFilter,
|
memory::allocator::MemoryTypeFilter,
|
||||||
pipeline::{
|
pipeline::{
|
||||||
DynamicState, GraphicsPipeline, Pipeline, PipelineLayout,
|
|
||||||
graphics::{
|
graphics::{
|
||||||
self, GraphicsPipelineCreateInfo,
|
self,
|
||||||
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
|
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
|
||||||
input_assembly::{InputAssemblyState, PrimitiveTopology},
|
input_assembly::{InputAssemblyState, PrimitiveTopology},
|
||||||
multisample::MultisampleState,
|
multisample::MultisampleState,
|
||||||
@@ -24,13 +26,15 @@ use vulkano::{
|
|||||||
subpass::PipelineRenderingCreateInfo,
|
subpass::PipelineRenderingCreateInfo,
|
||||||
vertex_input::{Vertex, VertexDefinition, VertexInputState},
|
vertex_input::{Vertex, VertexDefinition, VertexInputState},
|
||||||
viewport::ViewportState,
|
viewport::ViewportState,
|
||||||
|
GraphicsPipelineCreateInfo,
|
||||||
},
|
},
|
||||||
layout::PipelineDescriptorSetLayoutCreateInfo,
|
layout::PipelineDescriptorSetLayoutCreateInfo,
|
||||||
|
DynamicState, GraphicsPipeline, Pipeline, PipelineLayout,
|
||||||
},
|
},
|
||||||
shader::{EntryPoint, ShaderModule},
|
shader::{EntryPoint, ShaderModule},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{WGfx, pass::WGfxPass};
|
use super::{pass::WGfxPass, WGfx};
|
||||||
|
|
||||||
pub struct WGfxPipeline<V> {
|
pub struct WGfxPipeline<V> {
|
||||||
pub graphics: Arc<WGfx>,
|
pub graphics: Arc<WGfx>,
|
||||||
@@ -51,16 +55,27 @@ where
|
|||||||
vert_entry_point: EntryPoint,
|
vert_entry_point: EntryPoint,
|
||||||
frag_entry_point: EntryPoint,
|
frag_entry_point: EntryPoint,
|
||||||
vertex_input_state: Option<VertexInputState>,
|
vertex_input_state: Option<VertexInputState>,
|
||||||
|
updatable_sets: &[usize],
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
let stages = smallvec![
|
let stages = smallvec![
|
||||||
vulkano::pipeline::PipelineShaderStageCreateInfo::new(vert_entry_point),
|
vulkano::pipeline::PipelineShaderStageCreateInfo::new(vert_entry_point),
|
||||||
vulkano::pipeline::PipelineShaderStageCreateInfo::new(frag_entry_point),
|
vulkano::pipeline::PipelineShaderStageCreateInfo::new(frag_entry_point),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let mut layout_info = PipelineDescriptorSetLayoutCreateInfo::from_stages(&stages);
|
||||||
|
for (idx_l, l) in layout_info.set_layouts.iter_mut().enumerate() {
|
||||||
|
if updatable_sets.contains(&idx_l) {
|
||||||
|
// mark all bindings in the set as UAB
|
||||||
|
l.flags |= DescriptorSetLayoutCreateFlags::UPDATE_AFTER_BIND_POOL;
|
||||||
|
for b in l.bindings.values_mut() {
|
||||||
|
b.binding_flags |= DescriptorBindingFlags::UPDATE_AFTER_BIND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let layout = PipelineLayout::new(
|
let layout = PipelineLayout::new(
|
||||||
graphics.device.clone(),
|
graphics.device.clone(),
|
||||||
PipelineDescriptorSetLayoutCreateInfo::from_stages(&stages)
|
layout_info.into_pipeline_layout_create_info(graphics.device.clone())?,
|
||||||
.into_pipeline_layout_create_info(graphics.device.clone())?,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let subpass = PipelineRenderingCreateInfo {
|
let subpass = PipelineRenderingCreateInfo {
|
||||||
@@ -173,6 +188,46 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct WPipelineCreateInfo {
|
||||||
|
format: Format,
|
||||||
|
blend: Option<AttachmentBlend>,
|
||||||
|
topology: PrimitiveTopology,
|
||||||
|
instanced: bool,
|
||||||
|
updatable_sets: SmallVec<[usize; 8]>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WPipelineCreateInfo {
|
||||||
|
pub fn new(format: Format) -> Self {
|
||||||
|
Self {
|
||||||
|
format,
|
||||||
|
blend: None,
|
||||||
|
topology: PrimitiveTopology::TriangleStrip,
|
||||||
|
instanced: false,
|
||||||
|
updatable_sets: smallvec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn use_blend(mut self, blend: AttachmentBlend) -> Self {
|
||||||
|
self.blend = Some(blend);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn use_topology(mut self, topology: PrimitiveTopology) -> Self {
|
||||||
|
self.topology = topology;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn use_instanced(mut self) -> Self {
|
||||||
|
self.instanced = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn use_updatable_descriptors(mut self, updatable_sets: SmallVec<[usize; 8]>) -> Self {
|
||||||
|
self.updatable_sets = updatable_sets;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<V> WGfxPipeline<V>
|
impl<V> WGfxPipeline<V>
|
||||||
where
|
where
|
||||||
V: BufferContents + Vertex,
|
V: BufferContents + Vertex,
|
||||||
@@ -181,15 +236,12 @@ where
|
|||||||
graphics: Arc<WGfx>,
|
graphics: Arc<WGfx>,
|
||||||
vert: &Arc<ShaderModule>,
|
vert: &Arc<ShaderModule>,
|
||||||
frag: &Arc<ShaderModule>,
|
frag: &Arc<ShaderModule>,
|
||||||
format: Format,
|
info: WPipelineCreateInfo,
|
||||||
blend: Option<AttachmentBlend>,
|
|
||||||
topology: PrimitiveTopology,
|
|
||||||
instanced: bool,
|
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
let vert_entry_point = vert.entry_point("main").unwrap(); // want panic
|
let vert_entry_point = vert.entry_point("main").unwrap(); // want panic
|
||||||
let frag_entry_point = frag.entry_point("main").unwrap(); // want panic
|
let frag_entry_point = frag.entry_point("main").unwrap(); // want panic
|
||||||
|
|
||||||
let vertex_input_state = Some(if instanced {
|
let vertex_input_state = Some(if info.instanced {
|
||||||
V::per_instance().definition(&vert_entry_point)?
|
V::per_instance().definition(&vert_entry_point)?
|
||||||
} else {
|
} else {
|
||||||
V::per_vertex().definition(&vert_entry_point)?
|
V::per_vertex().definition(&vert_entry_point)?
|
||||||
@@ -197,12 +249,13 @@ where
|
|||||||
|
|
||||||
Self::new_from_stages(
|
Self::new_from_stages(
|
||||||
graphics,
|
graphics,
|
||||||
format,
|
info.format,
|
||||||
blend,
|
info.blend,
|
||||||
topology,
|
info.topology,
|
||||||
vert_entry_point,
|
vert_entry_point,
|
||||||
frag_entry_point,
|
frag_entry_point,
|
||||||
vertex_input_state,
|
vertex_input_state,
|
||||||
|
&info.updatable_sets,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,17 @@ use glam::Mat4;
|
|||||||
use vulkano::{
|
use vulkano::{
|
||||||
buffer::{BufferContents, BufferUsage, Subbuffer},
|
buffer::{BufferContents, BufferUsage, Subbuffer},
|
||||||
format::Format,
|
format::Format,
|
||||||
pipeline::graphics::{self, input_assembly::PrimitiveTopology, vertex_input::Vertex},
|
pipeline::graphics::{self, vertex_input::Vertex},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{Boundary, Rectangle},
|
drawing::{Boundary, Rectangle},
|
||||||
gfx::{BLEND_ALPHA, WGfx, cmd::GfxCommandBuffer, pass::WGfxPass, pipeline::WGfxPipeline},
|
gfx::{
|
||||||
|
cmd::GfxCommandBuffer,
|
||||||
|
pass::WGfxPass,
|
||||||
|
pipeline::{WGfxPipeline, WPipelineCreateInfo},
|
||||||
|
WGfx, BLEND_ALPHA,
|
||||||
|
},
|
||||||
renderer_vk::model_buffer::ModelBuffer,
|
renderer_vk::model_buffer::ModelBuffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,10 +52,7 @@ impl RectPipeline {
|
|||||||
let color_rect = gfx.create_pipeline::<RectVertex>(
|
let color_rect = gfx.create_pipeline::<RectVertex>(
|
||||||
&vert,
|
&vert,
|
||||||
&frag,
|
&frag,
|
||||||
format,
|
WPipelineCreateInfo::new(format).use_blend(BLEND_ALPHA).use_instanced(),
|
||||||
Some(BLEND_ALPHA),
|
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
true,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Self { gfx, color_rect })
|
Ok(Self { gfx, color_rect })
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use cosmic_text::{FontSystem, SwashCache};
|
use cosmic_text::{FontSystem, SwashCache};
|
||||||
use etagere::{Allocation, BucketedAtlasAllocator, size2};
|
use etagere::{size2, Allocation, BucketedAtlasAllocator};
|
||||||
use lru::LruCache;
|
use lru::LruCache;
|
||||||
use rustc_hash::FxHasher;
|
use rustc_hash::FxHasher;
|
||||||
use std::{collections::HashSet, hash::BuildHasherDefault, sync::Arc};
|
use std::{collections::HashSet, hash::BuildHasherDefault, sync::Arc};
|
||||||
@@ -8,18 +8,21 @@ use vulkano::{
|
|||||||
command_buffer::CommandBufferUsage,
|
command_buffer::CommandBufferUsage,
|
||||||
descriptor_set::DescriptorSet,
|
descriptor_set::DescriptorSet,
|
||||||
format::Format,
|
format::Format,
|
||||||
image::{Image, ImageCreateInfo, ImageType, ImageUsage, view::ImageView},
|
image::{view::ImageView, Image, ImageCreateInfo, ImageType, ImageUsage},
|
||||||
memory::allocator::AllocationCreateInfo,
|
memory::allocator::AllocationCreateInfo,
|
||||||
pipeline::graphics::{input_assembly::PrimitiveTopology, vertex_input::Vertex},
|
pipeline::graphics::vertex_input::Vertex,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
GlyphDetails, GpuCacheStatus,
|
|
||||||
custom_glyph::ContentType,
|
custom_glyph::ContentType,
|
||||||
shaders::{frag_atlas, vert_atlas},
|
shaders::{frag_atlas, vert_atlas},
|
||||||
text_renderer::GlyphonCacheKey,
|
text_renderer::GlyphonCacheKey,
|
||||||
|
GlyphDetails, GpuCacheStatus,
|
||||||
|
};
|
||||||
|
use crate::gfx::{
|
||||||
|
pipeline::{WGfxPipeline, WPipelineCreateInfo},
|
||||||
|
WGfx, BLEND_ALPHA,
|
||||||
};
|
};
|
||||||
use crate::gfx::{BLEND_ALPHA, WGfx, pipeline::WGfxPipeline};
|
|
||||||
|
|
||||||
/// Pipeline & shaders to be reused between `TextRenderer` instances
|
/// Pipeline & shaders to be reused between `TextRenderer` instances
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -36,10 +39,7 @@ impl TextPipeline {
|
|||||||
let pipeline = gfx.create_pipeline::<GlyphVertex>(
|
let pipeline = gfx.create_pipeline::<GlyphVertex>(
|
||||||
&vert,
|
&vert,
|
||||||
&frag,
|
&frag,
|
||||||
format,
|
WPipelineCreateInfo::new(format).use_blend(BLEND_ALPHA).use_instanced(),
|
||||||
Some(BLEND_ALPHA),
|
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
true,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Self { gfx, inner: pipeline })
|
Ok(Self { gfx, inner: pipeline })
|
||||||
|
|||||||
@@ -4,12 +4,17 @@ use openxr as xr;
|
|||||||
use std::{
|
use std::{
|
||||||
f32::consts::PI,
|
f32::consts::PI,
|
||||||
sync::{
|
sync::{
|
||||||
Arc,
|
|
||||||
atomic::{AtomicUsize, Ordering},
|
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::{
|
use crate::{
|
||||||
backend::openxr::helpers,
|
backend::openxr::helpers,
|
||||||
@@ -19,12 +24,11 @@ use crate::{
|
|||||||
use vulkano::{
|
use vulkano::{
|
||||||
buffer::{BufferUsage, Subbuffer},
|
buffer::{BufferUsage, Subbuffer},
|
||||||
command_buffer::CommandBufferUsage,
|
command_buffer::CommandBufferUsage,
|
||||||
pipeline::graphics::input_assembly::PrimitiveTopology,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
swapchain::{create_swapchain, SwapchainOpts, WlxSwapchain},
|
||||||
CompositionLayer, XrState,
|
CompositionLayer, XrState,
|
||||||
swapchain::{SwapchainOpts, WlxSwapchain, create_swapchain},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static LINE_AUTO_INCREMENT: AtomicUsize = AtomicUsize::new(1);
|
static LINE_AUTO_INCREMENT: AtomicUsize = AtomicUsize::new(1);
|
||||||
@@ -53,10 +57,7 @@ impl LinePool {
|
|||||||
let pipeline = app.gfx.create_pipeline(
|
let pipeline = app.gfx.create_pipeline(
|
||||||
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
||||||
app.gfx_extras.shaders.get("frag_color").unwrap(), // want panic
|
app.gfx_extras.shaders.get("frag_color").unwrap(), // want panic
|
||||||
app.gfx.surface_format,
|
WPipelineCreateInfo::new(app.gfx.surface_format),
|
||||||
None,
|
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
false,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let buf_color = app
|
let buf_color = app
|
||||||
|
|||||||
@@ -7,22 +7,21 @@ use std::{
|
|||||||
use glam::{Quat, Vec3A};
|
use glam::{Quat, Vec3A};
|
||||||
use openxr as xr;
|
use openxr as xr;
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
command_buffer::CommandBufferUsage,
|
command_buffer::CommandBufferUsage, image::view::ImageView,
|
||||||
image::view::ImageView,
|
pipeline::graphics::color_blend::AttachmentBlend,
|
||||||
pipeline::graphics::{color_blend::AttachmentBlend, input_assembly::PrimitiveTopology},
|
|
||||||
};
|
};
|
||||||
use wgui::gfx::cmd::WGfxClearMode;
|
use wgui::gfx::{cmd::WGfxClearMode, pipeline::WPipelineCreateInfo};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
|
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
|
||||||
config_io,
|
config_io,
|
||||||
graphics::{CommandBuffers, ExtentExt, dds::WlxCommandBufferDds},
|
graphics::{dds::WlxCommandBufferDds, CommandBuffers, ExtentExt},
|
||||||
state::AppState,
|
state::AppState,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
swapchain::{create_swapchain, WlxSwapchain},
|
||||||
CompositionLayer, XrState,
|
CompositionLayer, XrState,
|
||||||
swapchain::{WlxSwapchain, create_swapchain},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(super) struct Skybox {
|
pub(super) struct Skybox {
|
||||||
@@ -99,10 +98,7 @@ impl Skybox {
|
|||||||
let pipeline = app.gfx.create_pipeline(
|
let pipeline = app.gfx.create_pipeline(
|
||||||
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
||||||
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
|
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
|
||||||
app.gfx.surface_format,
|
WPipelineCreateInfo::new(app.gfx.surface_format),
|
||||||
None,
|
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
false,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let set0 = pipeline.uniform_sampler(0, self.view.clone(), app.gfx.texture_filter)?;
|
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(
|
let pipeline = app.gfx.create_pipeline(
|
||||||
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
||||||
app.gfx_extras.shaders.get("frag_grid").unwrap(), // want panic
|
app.gfx_extras.shaders.get("frag_grid").unwrap(), // want panic
|
||||||
app.gfx.surface_format,
|
WPipelineCreateInfo::new(app.gfx.surface_format).use_blend(AttachmentBlend::alpha()),
|
||||||
Some(AttachmentBlend::alpha()),
|
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
false,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let tgt = swapchain.acquire_wait_image()?;
|
let tgt = swapchain.acquire_wait_image()?;
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ use vulkano::{
|
|||||||
buffer::{Buffer, BufferContents, IndexBuffer, Subbuffer},
|
buffer::{Buffer, BufferContents, IndexBuffer, Subbuffer},
|
||||||
device::{
|
device::{
|
||||||
physical::{PhysicalDevice, PhysicalDeviceType},
|
physical::{PhysicalDevice, PhysicalDeviceType},
|
||||||
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo,
|
DeviceCreateInfo, DeviceExtensions, DeviceFeatures, Queue, QueueCreateInfo, QueueFlags,
|
||||||
QueueFlags,
|
|
||||||
},
|
},
|
||||||
format::Format,
|
format::Format,
|
||||||
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
|
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
|
||||||
@@ -284,9 +283,11 @@ pub fn init_openxr_graphics(
|
|||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// If adding anything here, also add to the native device_create_info below
|
||||||
let features = DeviceFeatures {
|
let features = DeviceFeatures {
|
||||||
dynamic_rendering: true,
|
dynamic_rendering: true,
|
||||||
..Default::default()
|
descriptor_binding_sampled_image_update_after_bind: true,
|
||||||
|
..DeviceFeatures::empty()
|
||||||
};
|
};
|
||||||
|
|
||||||
let queue_create_infos = queue_families
|
let queue_create_infos = queue_families
|
||||||
@@ -305,8 +306,12 @@ pub fn init_openxr_graphics(
|
|||||||
let mut dynamic_rendering =
|
let mut dynamic_rendering =
|
||||||
vk::PhysicalDeviceDynamicRenderingFeatures::default().dynamic_rendering(true);
|
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();
|
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 (device, queues) = unsafe {
|
||||||
let vk_device = xr_instance
|
let vk_device = xr_instance
|
||||||
@@ -375,6 +380,8 @@ pub fn init_openvr_graphics(
|
|||||||
mut vk_instance_extensions: InstanceExtensions,
|
mut vk_instance_extensions: InstanceExtensions,
|
||||||
mut vk_device_extensions_fn: impl FnMut(&PhysicalDevice) -> DeviceExtensions,
|
mut vk_device_extensions_fn: impl FnMut(&PhysicalDevice) -> DeviceExtensions,
|
||||||
) -> anyhow::Result<(Arc<WGfx>, WGfxExtras)> {
|
) -> anyhow::Result<(Arc<WGfx>, WGfxExtras)> {
|
||||||
|
use vulkano::device::Device;
|
||||||
|
|
||||||
//#[cfg(debug_assertions)]
|
//#[cfg(debug_assertions)]
|
||||||
//let layers = vec!["VK_LAYER_KHRONOS_validation".to_owned()];
|
//let layers = vec!["VK_LAYER_KHRONOS_validation".to_owned()];
|
||||||
//#[cfg(not(debug_assertions))]
|
//#[cfg(not(debug_assertions))]
|
||||||
@@ -449,6 +456,7 @@ pub fn init_openvr_graphics(
|
|||||||
enabled_extensions: my_extensions,
|
enabled_extensions: my_extensions,
|
||||||
enabled_features: DeviceFeatures {
|
enabled_features: DeviceFeatures {
|
||||||
dynamic_rendering: true,
|
dynamic_rendering: true,
|
||||||
|
descriptor_binding_sampled_image_update_after_bind: true,
|
||||||
..DeviceFeatures::empty()
|
..DeviceFeatures::empty()
|
||||||
},
|
},
|
||||||
queue_create_infos: queue_families
|
queue_create_infos: queue_families
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{cell::RefCell, rc::Rc, sync::Arc};
|
use std::{cell::RefCell, rc::Rc, sync::Arc};
|
||||||
|
|
||||||
use button::setup_custom_button;
|
use button::setup_custom_button;
|
||||||
use glam::{Affine2, Vec2, vec2};
|
use glam::{vec2, Affine2, Vec2};
|
||||||
use label::setup_custom_label;
|
use label::setup_custom_label;
|
||||||
use vulkano::{command_buffer::CommandBufferUsage, image::view::ImageView};
|
use vulkano::{command_buffer::CommandBufferUsage, image::view::ImageView};
|
||||||
use wgui::{
|
use wgui::{
|
||||||
@@ -20,7 +20,7 @@ use wgui::{
|
|||||||
use crate::{
|
use crate::{
|
||||||
backend::{
|
backend::{
|
||||||
input::{Haptics, PointerHit, PointerMode},
|
input::{Haptics, PointerHit, PointerMode},
|
||||||
overlay::{FrameMeta, OverlayBackend, ShouldRender, ui_transform},
|
overlay::{ui_transform, FrameMeta, OverlayBackend, ShouldRender},
|
||||||
},
|
},
|
||||||
graphics::{CommandBuffers, ExtentExt},
|
graphics::{CommandBuffers, ExtentExt},
|
||||||
state::AppState,
|
state::AppState,
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
use std::{f32::consts::PI, sync::Arc};
|
use std::{f32::consts::PI, sync::Arc};
|
||||||
|
|
||||||
use glam::{Affine3A, Vec3};
|
use glam::{Affine3A, Vec3};
|
||||||
|
use smallvec::smallvec;
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
buffer::{BufferUsage, Subbuffer},
|
buffer::{BufferUsage, Subbuffer},
|
||||||
command_buffer::CommandBufferUsage,
|
command_buffer::CommandBufferUsage,
|
||||||
device::Queue,
|
device::Queue,
|
||||||
format::Format,
|
format::Format,
|
||||||
image::{Image, sampler::Filter, view::ImageView},
|
image::{sampler::Filter, view::ImageView, Image},
|
||||||
pipeline::graphics::{color_blend::AttachmentBlend, input_assembly::PrimitiveTopology},
|
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::{
|
use wlx_capture::{
|
||||||
WlxCapture,
|
|
||||||
frame::{self as wlx_frame, DrmFormat, FrameFormat, MouseMeta, Transform, WlxFrame},
|
frame::{self as wlx_frame, DrmFormat, FrameFormat, MouseMeta, Transform, WlxFrame},
|
||||||
|
WlxCapture,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::overlay::FrameMeta,
|
backend::overlay::FrameMeta,
|
||||||
config::GeneralConfig,
|
config::GeneralConfig,
|
||||||
graphics::{
|
graphics::{
|
||||||
CommandBuffers, Vert2Uv,
|
dmabuf::{fourcc_to_vk, WGfxDmabuf},
|
||||||
dmabuf::{WGfxDmabuf, fourcc_to_vk},
|
upload_quad_vertices, CommandBuffers, Vert2Uv,
|
||||||
upload_quad_vertices,
|
|
||||||
},
|
},
|
||||||
state::AppState,
|
state::AppState,
|
||||||
};
|
};
|
||||||
@@ -48,10 +53,9 @@ impl ScreenPipeline {
|
|||||||
let pipeline = app.gfx.create_pipeline(
|
let pipeline = app.gfx.create_pipeline(
|
||||||
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
||||||
app.gfx_extras.shaders.get("frag_screen").unwrap(), // want panic
|
app.gfx_extras.shaders.get("frag_screen").unwrap(), // want panic
|
||||||
app.gfx.surface_format,
|
WPipelineCreateInfo::new(app.gfx.surface_format)
|
||||||
Some(AttachmentBlend::default()),
|
.use_blend(AttachmentBlend::default())
|
||||||
PrimitiveTopology::TriangleStrip,
|
.use_updatable_descriptors(smallvec![0]),
|
||||||
false,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let buf_alpha = app
|
let buf_alpha = app
|
||||||
|
|||||||
@@ -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 std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};
|
||||||
use vulkano::{
|
use vulkano::{
|
||||||
buffer::{BufferUsage, Subbuffer},
|
buffer::{BufferUsage, Subbuffer},
|
||||||
command_buffer::CommandBufferUsage,
|
command_buffer::CommandBufferUsage,
|
||||||
format::Format,
|
format::Format,
|
||||||
image::{Image, ImageTiling, SubresourceLayout, view::ImageView},
|
image::{view::ImageView, Image, ImageTiling, SubresourceLayout},
|
||||||
pipeline::graphics::input_assembly::PrimitiveTopology,
|
|
||||||
};
|
};
|
||||||
use wayvr_ipc::packet_server::{self, PacketServer, WvrStateChanged};
|
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 wlx_capture::frame::{DmabufFrame, FourCC, FrameFormat, FramePlane};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -16,17 +20,18 @@ use crate::{
|
|||||||
common::{OverlayContainer, OverlaySelector},
|
common::{OverlayContainer, OverlaySelector},
|
||||||
input::{self},
|
input::{self},
|
||||||
overlay::{
|
overlay::{
|
||||||
FrameMeta, OverlayBackend, OverlayData, OverlayID, OverlayState, ShouldRender,
|
ui_transform, FrameMeta, OverlayBackend, OverlayData, OverlayID, OverlayState,
|
||||||
Z_ORDER_DASHBOARD, ui_transform,
|
ShouldRender, Z_ORDER_DASHBOARD,
|
||||||
},
|
},
|
||||||
task::TaskType,
|
task::TaskType,
|
||||||
wayvr::{
|
wayvr::{
|
||||||
self, WayVR, WayVRAction, WayVRDisplayClickAction, display,
|
self, display,
|
||||||
server_ipc::{gen_args_vec, gen_env_vec},
|
server_ipc::{gen_args_vec, gen_env_vec},
|
||||||
|
WayVR, WayVRAction, WayVRDisplayClickAction,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config_wayvr,
|
config_wayvr,
|
||||||
graphics::{CommandBuffers, Vert2Uv, dmabuf::WGfxDmabuf},
|
graphics::{dmabuf::WGfxDmabuf, CommandBuffers, Vert2Uv},
|
||||||
state::{self, AppState},
|
state::{self, AppState},
|
||||||
subsystem::input::KeyboardFocus,
|
subsystem::input::KeyboardFocus,
|
||||||
};
|
};
|
||||||
@@ -125,10 +130,8 @@ impl WayVRBackend {
|
|||||||
let pipeline = app.gfx.create_pipeline(
|
let pipeline = app.gfx.create_pipeline(
|
||||||
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
|
||||||
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
|
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
|
||||||
app.gfx.surface_format,
|
WPipelineCreateInfo::new(app.gfx.surface_format)
|
||||||
None,
|
.use_updatable_descriptors(smallvec![0]),
|
||||||
PrimitiveTopology::TriangleStrip,
|
|
||||||
false,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let buf_alpha = app
|
let buf_alpha = app
|
||||||
|
|||||||
Reference in New Issue
Block a user