Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime SPIR-V validation #2460

Merged
merged 25 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eedcb5d
Add runtime SPIR-V validation
Rua Feb 1, 2024
9319b5a
Remove copyright message
Rua Feb 1, 2024
c8f001e
fmt
Rua Feb 1, 2024
ad32039
Merge branch 'master' of https://github.com/vulkano-rs/vulkano into r…
Rua Feb 15, 2024
3bb1f12
Up vk version in shader compilation (#2467)
maratik123 Feb 15, 2024
7b17d59
#2467 changelog
Rua Feb 15, 2024
c90c6e8
Remove windows specific dnd disable (#2474)
hakolao Feb 20, 2024
4eb8111
Fix unnecessarily strict validation for DRM format modifiers (#2469)
Rua Feb 20, 2024
4349c8e
#2469 changelog
marc0246 Feb 20, 2024
4074a91
Add support for querying memory requirements directly from the device…
Rua Feb 20, 2024
cdcaedc
#2470 changelog
marc0246 Feb 20, 2024
9a35fb0
Make image_index and final_views accessible, and add new example. (#2…
coolcatcoder Feb 21, 2024
89cf540
Fix `VulkanoWindowRenderer::swapchain_image_views` return type
marc0246 Feb 21, 2024
4fcb869
#2473 changelog
marc0246 Feb 21, 2024
1b91d4e
Fix `VulkanoWindowRenderer::acquire` taking `&Vec<T>` as well
marc0246 Feb 21, 2024
d60677b
Replace cgmath with glam in the examples (#2475)
stefnotch Feb 21, 2024
89e75ca
#2475 changelog
marc0246 Feb 21, 2024
817436b
Fix alignment checks when allocating buffers (#2476)
marc0246 Feb 27, 2024
1d2dbd2
#2476 changelog
Rua Feb 27, 2024
eac4fae
Add `DepthState::reverse` helper method (#2483)
jmi2k Mar 2, 2024
50d82cd
#2483 changelog
Rua Mar 2, 2024
60cae00
Add runtime SPIR-V validation
Rua Feb 1, 2024
afd7da7
Remove copyright message
Rua Feb 1, 2024
aa94a11
fmt
Rua Feb 1, 2024
9127de3
Merge branch 'runtimespirv' of github.com:Rua/vulkano into runtimespirv
Rua Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Changes to queries:
Changes to queues:
- The `Queue::id_within_family` method is renamed to `queue_index` to match Vulkan.

Changes to vulkano-util:
- `VulkanoWindowRenderer::acquire` now takes in an `FnOnce(&[Arc<ImageView>])`. This means that a closure can be called when the swapchain gets recreated.

### Additions

- Partially validated versions of `submit` and `present` commands (called via `QueueGuard`).
Expand All @@ -89,6 +92,11 @@ Changes to queues:
- Documented the safety requirements of shaders in the `shader` module.
- Support for the `khr_draw_indirect_count` extension.
- Support for the `ext_mesh_shader` extension.
- Vulkano-shaders: Support for Vulkan 1.3 target environment.
- Support for querying memory requirements directly from the device.
- Vulkano-util: `VulkanoWindowsRenderer::swapchain_image_views` allows access to the swapchain images.
- Support for the `glam` crate in the `type_for_format` macro.
- Added `DepthState::reverse` helper method.

### Bugs fixed

Expand All @@ -101,6 +109,8 @@ Changes to queues:
- Improved and more accurate validation of fragment output.
- `RawRecordingCommandBuffer::end` being safe to call.
- Fix wrong comparison in push constant size validation check.
- Unnecessarily strict validation that disallowed providing a single DRM format modifier without an explicit layout.
- Fixed the alignment check when (sub)allocating buffers that would limit the alignment to 64 at maximum, even though some applications might need buffers with higher alignments that aren't read/written by the host. The check is now only present when reading/writing a buffer.

# Version 0.34.1 (2023-10-29)

Expand Down
54 changes: 21 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ vk-parse = "0.12"
winit = "0.29"

# Only used in examples
cgmath = "0.18"
glam = "0.25"
png = "0.17"
rand = "0.8"
ron = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion examples/async-update/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bench = false
doc = false

[dependencies]
cgmath = { workspace = true }
glam = { workspace = true }
rand = { workspace = true }
vulkano = { workspace = true, features = ["macros"] }
vulkano-shaders = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions examples/async-update/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// same data but their consistency is not strict. A replica might be out-of-date for some time
// before *reaching convergence*, hence becoming consistent, eventually.

use cgmath::{Matrix4, Rad};
use glam::f32::Mat4;
use rand::Rng;
use std::{
error::Error,
Expand Down Expand Up @@ -659,7 +659,7 @@ fn main() -> Result<(), impl Error> {
let delta = (remainder / DURATION) as f32;
let angle = delta * std::f32::consts::PI * 2.0;

Matrix4::from_angle_z(Rad(angle)).into()
Mat4::from_rotation_z(angle).to_cols_array_2d()
},
};

Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bench = false
doc = false

[dependencies]
cgmath = { workspace = true }
glam = { workspace = true }
vulkano = { workspace = true, features = ["macros"] }
vulkano-shaders = { workspace = true }
winit = { workspace = true }
4 changes: 2 additions & 2 deletions examples/deferred/frame/directional_lighting_system.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::LightingVertex;
use cgmath::Vector3;
use glam::f32::Vec3;
use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
Expand Down Expand Up @@ -168,7 +168,7 @@ impl DirectionalLightingSystem {
viewport_dimensions: [u32; 2],
color_input: Arc<ImageView>,
normals_input: Arc<ImageView>,
direction: Vector3<f32>,
direction: Vec3,
color: [f32; 3],
) -> Arc<CommandBuffer> {
let push_constants = fs::PushConstants {
Expand Down
8 changes: 4 additions & 4 deletions examples/deferred/frame/point_lighting_system.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::LightingVertex;
use cgmath::{Matrix4, Vector3};
use glam::f32::{Mat4, Vec3};
use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
Expand Down Expand Up @@ -178,12 +178,12 @@ impl PointLightingSystem {
color_input: Arc<ImageView>,
normals_input: Arc<ImageView>,
depth_input: Arc<ImageView>,
screen_to_world: Matrix4<f32>,
position: Vector3<f32>,
screen_to_world: Mat4,
position: Vec3,
color: [f32; 3],
) -> Arc<CommandBuffer> {
let push_constants = fs::PushConstants {
screen_to_world: screen_to_world.into(),
screen_to_world: screen_to_world.to_cols_array_2d(),
color: [color[0], color[1], color[2], 1.0],
position: position.extend(0.0).into(),
};
Expand Down
14 changes: 7 additions & 7 deletions examples/deferred/frame/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::{
directional_lighting_system::DirectionalLightingSystem,
point_lighting_system::PointLightingSystem,
};
use cgmath::{Matrix4, SquareMatrix, Vector3};
use glam::f32::{Mat4, Vec3};
use std::sync::Arc;
use vulkano::{
command_buffer::{
Expand Down Expand Up @@ -258,7 +258,7 @@ impl FrameSystem {
&mut self,
before_future: F,
final_image_view: Arc<ImageView>,
world_to_framebuffer: Matrix4<f32>,
world_to_framebuffer: Mat4,
) -> Frame
where
F: GpuFuture + 'static,
Expand Down Expand Up @@ -400,7 +400,7 @@ pub struct Frame<'a> {
// The command buffer builder that will be built during the lifetime of this object.
command_buffer_builder: Option<RecordingCommandBuffer>,
// Matrix that was passed to `frame()`.
world_to_framebuffer: Matrix4<f32>,
world_to_framebuffer: Mat4,
}

impl<'a> Frame<'a> {
Expand Down Expand Up @@ -506,7 +506,7 @@ impl<'f, 's: 'f> DrawPass<'f, 's> {

/// Returns the 4x4 matrix that turns world coordinates into 2D coordinates on the framebuffer.
#[allow(dead_code)]
pub fn world_to_framebuffer_matrix(&self) -> Matrix4<f32> {
pub fn world_to_framebuffer_matrix(&self) -> Mat4 {
self.frame.world_to_framebuffer
}
}
Expand Down Expand Up @@ -538,7 +538,7 @@ impl<'f, 's: 'f> LightingPass<'f, 's> {
///
/// All the objects will be colored with an intensity varying between `[0, 0, 0]` and `color`,
/// depending on the dot product of their normal and `direction`.
pub fn directional_light(&mut self, direction: Vector3<f32>, color: [f32; 3]) {
pub fn directional_light(&mut self, direction: Vec3, color: [f32; 3]) {
let command_buffer = self.frame.system.directional_lighting_system.draw(
self.frame.framebuffer.extent(),
self.frame.system.diffuse_buffer.clone(),
Expand All @@ -559,14 +559,14 @@ impl<'f, 's: 'f> LightingPass<'f, 's> {
/// All the objects will be colored with an intensity varying between `[0, 0, 0]` and `color`,
/// depending on their distance with `position`. Objects that aren't facing `position` won't
/// receive any light.
pub fn point_light(&mut self, position: Vector3<f32>, color: [f32; 3]) {
pub fn point_light(&mut self, position: Vec3, color: [f32; 3]) {
let command_buffer = {
self.frame.system.point_lighting_system.draw(
self.frame.framebuffer.extent(),
self.frame.system.diffuse_buffer.clone(),
self.frame.system.normals_buffer.clone(),
self.frame.system.depth_buffer.clone(),
self.frame.world_to_framebuffer.invert().unwrap(),
self.frame.world_to_framebuffer.inverse(),
position,
color,
)
Expand Down
13 changes: 6 additions & 7 deletions examples/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
frame::{FrameSystem, Pass},
triangle_draw_system::TriangleDrawSystem,
};
use cgmath::{Matrix4, SquareMatrix, Vector3};
use glam::f32::{Mat4, Vec3};
use std::{error::Error, sync::Arc};
use vulkano::{
command_buffer::allocator::{
Expand Down Expand Up @@ -240,7 +240,7 @@ fn main() -> Result<(), impl Error> {
let mut frame = frame_system.frame(
future,
images[image_index as usize].clone(),
Matrix4::identity(),
Mat4::IDENTITY,
);
let mut after_future = None;
while let Some(pass) = frame.next_pass() {
Expand All @@ -251,11 +251,10 @@ fn main() -> Result<(), impl Error> {
}
Pass::Lighting(mut lighting) => {
lighting.ambient_light([0.1, 0.1, 0.1]);
lighting
.directional_light(Vector3::new(0.2, -0.1, -0.7), [0.6, 0.6, 0.6]);
lighting.point_light(Vector3::new(0.5, -0.5, -0.1), [1.0, 0.0, 0.0]);
lighting.point_light(Vector3::new(-0.9, 0.2, -0.15), [0.0, 1.0, 0.0]);
lighting.point_light(Vector3::new(0.0, 0.5, -0.05), [0.0, 0.0, 1.0]);
lighting.directional_light(Vec3::new(0.2, -0.1, -0.7), [0.6, 0.6, 0.6]);
lighting.point_light(Vec3::new(0.5, -0.5, -0.1), [1.0, 0.0, 0.0]);
lighting.point_light(Vec3::new(-0.9, 0.2, -0.15), [0.0, 1.0, 0.0]);
lighting.point_light(Vec3::new(0.0, 0.5, -0.05), [0.0, 0.0, 1.0]);
}
Pass::Finished(af) => {
after_future = Some(af);
Expand Down
2 changes: 1 addition & 1 deletion examples/interactive-fractal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bench = false
doc = false

[dependencies]
cgmath = { workspace = true }
glam = { workspace = true }
rand = { workspace = true }
vulkano = { workspace = true, features = ["macros"] }
vulkano-shaders = { workspace = true }
Expand Down
Loading
Loading