dep: update ash to 0.38
This commit is contained in:
parent
c646086df4
commit
d4b4366836
87
Cargo.lock
generated
87
Cargo.lock
generated
|
@ -158,32 +158,23 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ash"
|
|
||||||
version = "0.37.3+1.3.251"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a"
|
|
||||||
dependencies = [
|
|
||||||
"libloading 0.7.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ash"
|
name = "ash"
|
||||||
version = "0.38.0+1.3.281"
|
version = "0.38.0+1.3.281"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
|
checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ash-window"
|
name = "ash-window"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab"
|
checksum = "52bca67b61cb81e5553babde81b8211f713cb6db79766f80168f3e5f40ea6c82"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash 0.37.3+1.3.251",
|
"ash",
|
||||||
"raw-window-handle 0.5.2",
|
"raw-window-handle 0.6.2",
|
||||||
"raw-window-metal",
|
"raw-window-metal",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -852,7 +843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
|
checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -905,7 +896,7 @@ version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1245,18 +1236,6 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gpu-allocator"
|
|
||||||
version = "0.25.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
|
|
||||||
dependencies = [
|
|
||||||
"ash 0.37.3+1.3.251",
|
|
||||||
"log",
|
|
||||||
"presser",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-allocator"
|
name = "gpu-allocator"
|
||||||
version = "0.26.0"
|
version = "0.26.0"
|
||||||
|
@ -1270,6 +1249,18 @@ dependencies = [
|
||||||
"windows",
|
"windows",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-allocator"
|
||||||
|
version = "0.27.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd"
|
||||||
|
dependencies = [
|
||||||
|
"ash",
|
||||||
|
"log",
|
||||||
|
"presser",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-descriptor"
|
name = "gpu-descriptor"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -1337,7 +1328,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"com",
|
"com",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"widestring",
|
"widestring",
|
||||||
"winapi",
|
"winapi",
|
||||||
|
@ -1559,7 +1550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
|
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1598,16 +1589,6 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libloading"
|
|
||||||
version = "0.7.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
|
@ -1622,7 +1603,7 @@ dependencies = [
|
||||||
name = "librashader"
|
name = "librashader"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash 0.37.3+1.3.251",
|
"ash",
|
||||||
"glob",
|
"glob",
|
||||||
"halfbrown",
|
"halfbrown",
|
||||||
"librashader-cache",
|
"librashader-cache",
|
||||||
|
@ -1675,7 +1656,7 @@ dependencies = [
|
||||||
name = "librashader-capi"
|
name = "librashader-capi"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash 0.37.3+1.3.251",
|
"ash",
|
||||||
"gl",
|
"gl",
|
||||||
"librashader",
|
"librashader",
|
||||||
"librashader-spirv-cross",
|
"librashader-spirv-cross",
|
||||||
|
@ -1692,7 +1673,7 @@ dependencies = [
|
||||||
name = "librashader-common"
|
name = "librashader-common"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash 0.37.3+1.3.251",
|
"ash",
|
||||||
"gl",
|
"gl",
|
||||||
"halfbrown",
|
"halfbrown",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
@ -1867,11 +1848,11 @@ name = "librashader-runtime-vk"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"array-concat",
|
"array-concat",
|
||||||
"ash 0.37.3+1.3.251",
|
"ash",
|
||||||
"ash-window",
|
"ash-window",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"glfw 0.49.1",
|
"glfw 0.49.1",
|
||||||
"gpu-allocator 0.25.0",
|
"gpu-allocator 0.27.0",
|
||||||
"librashader-cache",
|
"librashader-cache",
|
||||||
"librashader-common",
|
"librashader-common",
|
||||||
"librashader-preprocess",
|
"librashader-preprocess",
|
||||||
|
@ -1880,7 +1861,7 @@ dependencies = [
|
||||||
"librashader-runtime",
|
"librashader-runtime",
|
||||||
"num",
|
"num",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"raw-window-handle 0.5.2",
|
"raw-window-handle 0.6.2",
|
||||||
"rayon",
|
"rayon",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"winit",
|
"winit",
|
||||||
|
@ -2098,7 +2079,6 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"ndk-sys",
|
"ndk-sys",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"raw-window-handle 0.5.2",
|
|
||||||
"raw-window-handle 0.6.2",
|
"raw-window-handle 0.6.2",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -2758,14 +2738,14 @@ checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-metal"
|
name = "raw-window-metal"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac4ea493258d54c24cb46aa9345d099e58e2ea3f30dd63667fc54fc892f18e76"
|
checksum = "76e8caa82e31bb98fee12fa8f051c94a6aa36b07cddb03f0d4fc558988360ff1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cocoa",
|
"cocoa",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"objc",
|
"objc",
|
||||||
"raw-window-handle 0.5.2",
|
"raw-window-handle 0.6.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3728,7 +3708,7 @@ checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"android_system_properties",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"ash 0.38.0+1.3.281",
|
"ash",
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"block",
|
"block",
|
||||||
|
@ -3744,7 +3724,7 @@ dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"khronos-egl",
|
"khronos-egl",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
"naga",
|
"naga",
|
||||||
|
@ -4064,7 +4044,6 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"orbclient",
|
"orbclient",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle 0.5.2",
|
|
||||||
"raw-window-handle 0.6.2",
|
"raw-window-handle 0.6.2",
|
||||||
"redox_syscall 0.3.5",
|
"redox_syscall 0.3.5",
|
||||||
"rustix",
|
"rustix",
|
||||||
|
@ -4133,7 +4112,7 @@ dependencies = [
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.8.3",
|
"libloading",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"x11rb-protocol",
|
"x11rb-protocol",
|
||||||
|
|
|
@ -36,7 +36,7 @@ thiserror = "1.0.37"
|
||||||
paste = "1.0.9"
|
paste = "1.0.9"
|
||||||
gl = { version = "0.14.0", optional = true }
|
gl = { version = "0.14.0", optional = true }
|
||||||
rustc-hash = "2.0.0"
|
rustc-hash = "2.0.0"
|
||||||
ash = { version = "0.37", optional = true }
|
ash = { version = "0.38", optional = true }
|
||||||
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1" }
|
spirv_cross = { package = "librashader-spirv-cross", version = "0.25.1" }
|
||||||
sptr = "0.3.2"
|
sptr = "0.3.2"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ metal = ["objc2-metal"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gl = { version = "0.14.0", optional = true }
|
gl = { version = "0.14.0", optional = true }
|
||||||
ash = { version = "0.37", optional = true }
|
ash = { version = "0.38", optional = true }
|
||||||
wgpu-types = { version = "22", optional = true }
|
wgpu-types = { version = "22", optional = true }
|
||||||
num-traits = "0.2.15"
|
num-traits = "0.2.15"
|
||||||
rustc-hash = "2.0.0"
|
rustc-hash = "2.0.0"
|
||||||
|
|
|
@ -23,8 +23,8 @@ librashader-cache = { path = "../librashader-cache", version = "0.2.8" }
|
||||||
|
|
||||||
bytemuck = { version = "1.12.3", features = ["derive"] }
|
bytemuck = { version = "1.12.3", features = ["derive"] }
|
||||||
thiserror = "1.0.37"
|
thiserror = "1.0.37"
|
||||||
ash = { version = "0.37", features = ["debug"] }
|
ash = { version = "0.38", features = ["debug"] }
|
||||||
gpu-allocator = { version = "0.25.0", default-features = false, features = ["vulkan"] }
|
gpu-allocator = { version = "0.27.0", default-features = false, features = ["vulkan"] }
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
rayon = "1.6.1"
|
rayon = "1.6.1"
|
||||||
array-concat = "0.5.2"
|
array-concat = "0.5.2"
|
||||||
|
@ -32,9 +32,9 @@ array-concat = "0.5.2"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
num = "0.4.0"
|
num = "0.4.0"
|
||||||
glfw = "0.49.0"
|
glfw = "0.49.0"
|
||||||
winit = { version = "0.29.10", features = ["rwh_05"] }
|
winit = { version = "0.29.10", features = ["rwh_06"] }
|
||||||
raw-window-handle = "0.5"
|
raw-window-handle = "0.6.2"
|
||||||
ash-window = "0.12.0"
|
ash-window = "0.13.0"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["librashader-cache/docsrs"]
|
features = ["librashader-cache/docsrs"]
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl TryFrom<VulkanInstance> for VulkanObjects {
|
||||||
fn try_from(vulkan: VulkanInstance) -> Result<Self, FilterChainError> {
|
fn try_from(vulkan: VulkanInstance) -> Result<Self, FilterChainError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let instance = ash::Instance::load(
|
let instance = ash::Instance::load(
|
||||||
&vk::StaticFn {
|
&ash::StaticFn {
|
||||||
get_instance_proc_addr: vulkan.get_instance_proc_addr,
|
get_instance_proc_addr: vulkan.get_instance_proc_addr,
|
||||||
},
|
},
|
||||||
vulkan.instance,
|
vulkan.instance,
|
||||||
|
@ -270,7 +270,7 @@ impl FilterChainVulkan {
|
||||||
|
|
||||||
let command_pool = unsafe {
|
let command_pool = unsafe {
|
||||||
device.create_command_pool(
|
device.create_command_pool(
|
||||||
&vk::CommandPoolCreateInfo::builder()
|
&vk::CommandPoolCreateInfo::default()
|
||||||
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER),
|
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER),
|
||||||
None,
|
None,
|
||||||
)?
|
)?
|
||||||
|
@ -279,7 +279,7 @@ impl FilterChainVulkan {
|
||||||
let command_buffer = unsafe {
|
let command_buffer = unsafe {
|
||||||
// panic safety: command buffer count = 1
|
// panic safety: command buffer count = 1
|
||||||
device.allocate_command_buffers(
|
device.allocate_command_buffers(
|
||||||
&vk::CommandBufferAllocateInfo::builder()
|
&vk::CommandBufferAllocateInfo::default()
|
||||||
.command_pool(command_pool)
|
.command_pool(command_pool)
|
||||||
.level(vk::CommandBufferLevel::PRIMARY)
|
.level(vk::CommandBufferLevel::PRIMARY)
|
||||||
.command_buffer_count(1),
|
.command_buffer_count(1),
|
||||||
|
@ -289,7 +289,7 @@ impl FilterChainVulkan {
|
||||||
unsafe {
|
unsafe {
|
||||||
device.begin_command_buffer(
|
device.begin_command_buffer(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
&vk::CommandBufferBeginInfo::builder()
|
&vk::CommandBufferBeginInfo::default()
|
||||||
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT),
|
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT),
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
|
@ -307,9 +307,9 @@ impl FilterChainVulkan {
|
||||||
device.end_command_buffer(command_buffer)?;
|
device.end_command_buffer(command_buffer)?;
|
||||||
|
|
||||||
let buffers = [command_buffer];
|
let buffers = [command_buffer];
|
||||||
let submit_info = vk::SubmitInfo::builder().command_buffers(&buffers);
|
let submit_info = vk::SubmitInfo::default().command_buffers(&buffers);
|
||||||
|
|
||||||
device.queue_submit(queue, &[*submit_info], vk::Fence::null())?;
|
device.queue_submit(queue, &[submit_info], vk::Fence::null())?;
|
||||||
device.queue_wait_idle(queue)?;
|
device.queue_wait_idle(queue)?;
|
||||||
device.free_command_buffers(command_pool, &buffers);
|
device.free_command_buffers(command_pool, &buffers);
|
||||||
device.destroy_command_pool(command_pool, None);
|
device.destroy_command_pool(command_pool, None);
|
||||||
|
@ -592,18 +592,18 @@ impl FilterChainVulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
let original_image_view = unsafe {
|
let original_image_view = unsafe {
|
||||||
let create_info = vk::ImageViewCreateInfo::builder()
|
let create_info = vk::ImageViewCreateInfo::default()
|
||||||
.image(input.image)
|
.image(input.image)
|
||||||
.format(input.format)
|
.format(input.format)
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.subresource_range(
|
.subresource_range(
|
||||||
*vk::ImageSubresourceRange::builder()
|
vk::ImageSubresourceRange::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.level_count(1)
|
.level_count(1)
|
||||||
.layer_count(1),
|
.layer_count(1),
|
||||||
)
|
)
|
||||||
.components(
|
.components(
|
||||||
*vk::ComponentMapping::builder()
|
vk::ComponentMapping::default()
|
||||||
.r(vk::ComponentSwizzle::R)
|
.r(vk::ComponentSwizzle::R)
|
||||||
.g(vk::ComponentSwizzle::G)
|
.g(vk::ComponentSwizzle::G)
|
||||||
.b(vk::ComponentSwizzle::B)
|
.b(vk::ComponentSwizzle::B)
|
||||||
|
|
|
@ -55,20 +55,20 @@ impl BindSemantics<NoUniformBinder, Option<()>, RawVulkanBuffer> for FilterPass
|
||||||
device: &Self::DeviceContext,
|
device: &Self::DeviceContext,
|
||||||
) {
|
) {
|
||||||
let sampler = samplers.get(texture.wrap_mode, texture.filter_mode, texture.mip_filter);
|
let sampler = samplers.get(texture.wrap_mode, texture.filter_mode, texture.mip_filter);
|
||||||
let image_info = vk::DescriptorImageInfo::builder()
|
let image_info = vk::DescriptorImageInfo::default()
|
||||||
.sampler(sampler.handle)
|
.sampler(sampler.handle)
|
||||||
.image_view(texture.image_view)
|
.image_view(texture.image_view)
|
||||||
.image_layout(vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL);
|
.image_layout(vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL);
|
||||||
|
|
||||||
let image_info = [*image_info];
|
let image_info = [image_info];
|
||||||
let write_desc = vk::WriteDescriptorSet::builder()
|
let write_desc = vk::WriteDescriptorSet::default()
|
||||||
.dst_set(*descriptors)
|
.dst_set(*descriptors)
|
||||||
.dst_binding(binding.binding)
|
.dst_binding(binding.binding)
|
||||||
.dst_array_element(0)
|
.dst_array_element(0)
|
||||||
.descriptor_type(vk::DescriptorType::COMBINED_IMAGE_SAMPLER)
|
.descriptor_type(vk::DescriptorType::COMBINED_IMAGE_SAMPLER)
|
||||||
.image_info(&image_info);
|
.image_info(&image_info);
|
||||||
unsafe {
|
unsafe {
|
||||||
device.update_descriptor_sets(&[*write_desc], &[]);
|
device.update_descriptor_sets(&[write_desc], &[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,25 @@ pub(crate) struct OutputImage {
|
||||||
|
|
||||||
impl OutputImage {
|
impl OutputImage {
|
||||||
pub fn new(device: &ash::Device, image: VulkanImage) -> error::Result<OutputImage> {
|
pub fn new(device: &ash::Device, image: VulkanImage) -> error::Result<OutputImage> {
|
||||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
let image_subresource = vk::ImageSubresourceRange::default()
|
||||||
.base_mip_level(0)
|
.base_mip_level(0)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.level_count(1)
|
.level_count(1)
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||||
|
|
||||||
let swizzle_components = vk::ComponentMapping::builder()
|
let swizzle_components = vk::ComponentMapping::default()
|
||||||
.r(vk::ComponentSwizzle::R)
|
.r(vk::ComponentSwizzle::R)
|
||||||
.g(vk::ComponentSwizzle::G)
|
.g(vk::ComponentSwizzle::G)
|
||||||
.b(vk::ComponentSwizzle::B)
|
.b(vk::ComponentSwizzle::B)
|
||||||
.a(vk::ComponentSwizzle::A);
|
.a(vk::ComponentSwizzle::A);
|
||||||
|
|
||||||
let view_info = vk::ImageViewCreateInfo::builder()
|
let view_info = vk::ImageViewCreateInfo::default()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(image.format)
|
.format(image.format)
|
||||||
.image(image.image)
|
.image(image.image)
|
||||||
.subresource_range(*image_subresource)
|
.subresource_range(image_subresource)
|
||||||
.components(*swizzle_components);
|
.components(swizzle_components);
|
||||||
|
|
||||||
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@ use std::ffi::CStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
const ENTRY_POINT: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"main\0") };
|
const ENTRY_POINT: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"main\0") };
|
||||||
|
|
||||||
pub struct PipelineDescriptors {
|
pub struct PipelineDescriptors<'a> {
|
||||||
pub replicas: u32,
|
pub replicas: u32,
|
||||||
pub layout_bindings: Vec<vk::DescriptorSetLayoutBinding>,
|
pub layout_bindings: Vec<vk::DescriptorSetLayoutBinding<'a>>,
|
||||||
pub pool_sizes: Vec<vk::DescriptorPoolSize>,
|
pub pool_sizes: Vec<vk::DescriptorPoolSize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PipelineDescriptors {
|
impl PipelineDescriptors<'_> {
|
||||||
pub fn new(duplicates: u32) -> Self {
|
pub fn new(duplicates: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
replicas: duplicates,
|
replicas: duplicates,
|
||||||
|
@ -43,6 +43,7 @@ impl PipelineDescriptors {
|
||||||
descriptor_count: 1,
|
descriptor_count: 1,
|
||||||
stage_flags: ubo_mask,
|
stage_flags: ubo_mask,
|
||||||
p_immutable_samplers: std::ptr::null(),
|
p_immutable_samplers: std::ptr::null(),
|
||||||
|
_marker: Default::default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
self.pool_sizes.push(vk::DescriptorPoolSize {
|
self.pool_sizes.push(vk::DescriptorPoolSize {
|
||||||
|
@ -61,6 +62,7 @@ impl PipelineDescriptors {
|
||||||
descriptor_count: 1,
|
descriptor_count: 1,
|
||||||
stage_flags: texture_mask,
|
stage_flags: texture_mask,
|
||||||
p_immutable_samplers: std::ptr::null(),
|
p_immutable_samplers: std::ptr::null(),
|
||||||
|
_marker: Default::default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
self.pool_sizes.push(vk::DescriptorPoolSize {
|
self.pool_sizes.push(vk::DescriptorPoolSize {
|
||||||
|
@ -80,7 +82,7 @@ impl PipelineDescriptors {
|
||||||
) -> error::Result<vk::DescriptorSetLayout> {
|
) -> error::Result<vk::DescriptorSetLayout> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let layout = device.create_descriptor_set_layout(
|
let layout = device.create_descriptor_set_layout(
|
||||||
&vk::DescriptorSetLayoutCreateInfo::builder().bindings(self.bindings()),
|
&vk::DescriptorSetLayoutCreateInfo::default().bindings(self.bindings()),
|
||||||
None,
|
None,
|
||||||
)?;
|
)?;
|
||||||
Ok(layout)
|
Ok(layout)
|
||||||
|
@ -90,9 +92,9 @@ impl PipelineDescriptors {
|
||||||
|
|
||||||
pub struct PipelineLayoutObjects {
|
pub struct PipelineLayoutObjects {
|
||||||
pub layout: vk::PipelineLayout,
|
pub layout: vk::PipelineLayout,
|
||||||
pub pool: vk::DescriptorPool,
|
|
||||||
pub descriptor_sets: Vec<vk::DescriptorSet>,
|
pub descriptor_sets: Vec<vk::DescriptorSet>,
|
||||||
pub descriptor_set_layout: [vk::DescriptorSetLayout; 1],
|
pub _pool: vk::DescriptorPool,
|
||||||
|
pub _descriptor_set_layout: [vk::DescriptorSetLayout; 1],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PipelineLayoutObjects {
|
impl PipelineLayoutObjects {
|
||||||
|
@ -108,11 +110,11 @@ impl PipelineLayoutObjects {
|
||||||
let descriptor_set_layout = [descriptors.create_descriptor_set_layout(device)?];
|
let descriptor_set_layout = [descriptors.create_descriptor_set_layout(device)?];
|
||||||
|
|
||||||
let pipeline_create_info =
|
let pipeline_create_info =
|
||||||
vk::PipelineLayoutCreateInfo::builder().set_layouts(&descriptor_set_layout);
|
vk::PipelineLayoutCreateInfo::default().set_layouts(&descriptor_set_layout);
|
||||||
|
|
||||||
let push_constant_range = reflection.push_constant.as_ref().map(|push_constant| {
|
let push_constant_range = reflection.push_constant.as_ref().map(|push_constant| {
|
||||||
let stage_mask = util::binding_stage_to_vulkan_stage(push_constant.stage_mask);
|
let stage_mask = util::binding_stage_to_vulkan_stage(push_constant.stage_mask);
|
||||||
[*vk::PushConstantRange::builder()
|
[vk::PushConstantRange::default()
|
||||||
.stage_flags(stage_mask)
|
.stage_flags(stage_mask)
|
||||||
.size(push_constant.size)]
|
.size(push_constant.size)]
|
||||||
});
|
});
|
||||||
|
@ -124,14 +126,14 @@ impl PipelineLayoutObjects {
|
||||||
|
|
||||||
let layout = unsafe { device.create_pipeline_layout(&pipeline_create_info, None)? };
|
let layout = unsafe { device.create_pipeline_layout(&pipeline_create_info, None)? };
|
||||||
|
|
||||||
let pool_info = vk::DescriptorPoolCreateInfo::builder()
|
let pool_info = vk::DescriptorPoolCreateInfo::default()
|
||||||
.max_sets(replicas)
|
.max_sets(replicas)
|
||||||
.pool_sizes(&descriptors.pool_sizes);
|
.pool_sizes(&descriptors.pool_sizes);
|
||||||
|
|
||||||
let pool = unsafe { device.create_descriptor_pool(&pool_info, None)? };
|
let pool = unsafe { device.create_descriptor_pool(&pool_info, None)? };
|
||||||
|
|
||||||
let mut descriptor_sets = Vec::new();
|
let mut descriptor_sets = Vec::new();
|
||||||
let alloc_info = vk::DescriptorSetAllocateInfo::builder()
|
let alloc_info = vk::DescriptorSetAllocateInfo::default()
|
||||||
.descriptor_pool(pool)
|
.descriptor_pool(pool)
|
||||||
.set_layouts(&descriptor_set_layout);
|
.set_layouts(&descriptor_set_layout);
|
||||||
|
|
||||||
|
@ -145,9 +147,9 @@ impl PipelineLayoutObjects {
|
||||||
|
|
||||||
Ok(PipelineLayoutObjects {
|
Ok(PipelineLayoutObjects {
|
||||||
layout,
|
layout,
|
||||||
descriptor_set_layout,
|
_descriptor_set_layout: descriptor_set_layout,
|
||||||
descriptor_sets,
|
descriptor_sets,
|
||||||
pool,
|
_pool: pool,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +196,7 @@ impl VulkanGraphicsPipeline {
|
||||||
fragment_module: &VulkanShaderModule,
|
fragment_module: &VulkanShaderModule,
|
||||||
render_pass: Option<&VulkanRenderPass>,
|
render_pass: Option<&VulkanRenderPass>,
|
||||||
) -> error::Result<vk::Pipeline> {
|
) -> error::Result<vk::Pipeline> {
|
||||||
let input_assembly = vk::PipelineInputAssemblyStateCreateInfo::builder()
|
let input_assembly = vk::PipelineInputAssemblyStateCreateInfo::default()
|
||||||
.topology(vk::PrimitiveTopology::TRIANGLE_STRIP);
|
.topology(vk::PrimitiveTopology::TRIANGLE_STRIP);
|
||||||
|
|
||||||
let vao_state = [
|
let vao_state = [
|
||||||
|
@ -212,17 +214,17 @@ impl VulkanGraphicsPipeline {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let input_binding = vk::VertexInputBindingDescription::builder()
|
let input_binding = vk::VertexInputBindingDescription::default()
|
||||||
.binding(0)
|
.binding(0)
|
||||||
.stride(std::mem::size_of::<VertexInput>() as u32)
|
.stride(std::mem::size_of::<VertexInput>() as u32)
|
||||||
.input_rate(vk::VertexInputRate::VERTEX);
|
.input_rate(vk::VertexInputRate::VERTEX);
|
||||||
|
|
||||||
let input_binding = [*input_binding];
|
let input_binding = [input_binding];
|
||||||
let pipeline_input_state = vk::PipelineVertexInputStateCreateInfo::builder()
|
let pipeline_input_state = vk::PipelineVertexInputStateCreateInfo::default()
|
||||||
.vertex_binding_descriptions(&input_binding)
|
.vertex_binding_descriptions(&input_binding)
|
||||||
.vertex_attribute_descriptions(&vao_state);
|
.vertex_attribute_descriptions(&vao_state);
|
||||||
|
|
||||||
let raster_state = vk::PipelineRasterizationStateCreateInfo::builder()
|
let raster_state = vk::PipelineRasterizationStateCreateInfo::default()
|
||||||
.polygon_mode(vk::PolygonMode::FILL)
|
.polygon_mode(vk::PolygonMode::FILL)
|
||||||
.cull_mode(vk::CullModeFlags::NONE)
|
.cull_mode(vk::CullModeFlags::NONE)
|
||||||
.front_face(vk::FrontFace::COUNTER_CLOCKWISE)
|
.front_face(vk::FrontFace::COUNTER_CLOCKWISE)
|
||||||
|
@ -231,19 +233,19 @@ impl VulkanGraphicsPipeline {
|
||||||
.depth_bias_enable(false)
|
.depth_bias_enable(false)
|
||||||
.line_width(1.0);
|
.line_width(1.0);
|
||||||
|
|
||||||
let attachments = vk::PipelineColorBlendAttachmentState::builder()
|
let attachments = vk::PipelineColorBlendAttachmentState::default()
|
||||||
.blend_enable(false)
|
.blend_enable(false)
|
||||||
.color_write_mask(vk::ColorComponentFlags::from_raw(0xf));
|
.color_write_mask(vk::ColorComponentFlags::from_raw(0xf));
|
||||||
|
|
||||||
let attachments = [*attachments];
|
let attachments = [attachments];
|
||||||
let blend_state =
|
let blend_state =
|
||||||
vk::PipelineColorBlendStateCreateInfo::builder().attachments(&attachments);
|
vk::PipelineColorBlendStateCreateInfo::default().attachments(&attachments);
|
||||||
|
|
||||||
let viewport_state = vk::PipelineViewportStateCreateInfo::builder()
|
let viewport_state = vk::PipelineViewportStateCreateInfo::default()
|
||||||
.viewport_count(1)
|
.viewport_count(1)
|
||||||
.scissor_count(1);
|
.scissor_count(1);
|
||||||
|
|
||||||
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::builder()
|
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::default()
|
||||||
.depth_test_enable(false)
|
.depth_test_enable(false)
|
||||||
.depth_write_enable(false)
|
.depth_write_enable(false)
|
||||||
.stencil_test_enable(false)
|
.stencil_test_enable(false)
|
||||||
|
@ -251,25 +253,24 @@ impl VulkanGraphicsPipeline {
|
||||||
.min_depth_bounds(1.0)
|
.min_depth_bounds(1.0)
|
||||||
.max_depth_bounds(1.0);
|
.max_depth_bounds(1.0);
|
||||||
|
|
||||||
let multisample_state = vk::PipelineMultisampleStateCreateInfo::builder()
|
let multisample_state = vk::PipelineMultisampleStateCreateInfo::default()
|
||||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1);
|
.rasterization_samples(vk::SampleCountFlags::TYPE_1);
|
||||||
|
|
||||||
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
||||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&states);
|
let dynamic_state = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&states);
|
||||||
|
|
||||||
let shader_stages = [
|
let shader_stages = [
|
||||||
vk::PipelineShaderStageCreateInfo::builder()
|
vk::PipelineShaderStageCreateInfo::default()
|
||||||
.stage(vk::ShaderStageFlags::VERTEX)
|
.stage(vk::ShaderStageFlags::VERTEX)
|
||||||
.name(ENTRY_POINT)
|
.name(ENTRY_POINT)
|
||||||
.module(vertex_module.shader),
|
.module(vertex_module.shader),
|
||||||
vk::PipelineShaderStageCreateInfo::builder()
|
vk::PipelineShaderStageCreateInfo::default()
|
||||||
.stage(vk::ShaderStageFlags::FRAGMENT)
|
.stage(vk::ShaderStageFlags::FRAGMENT)
|
||||||
.name(ENTRY_POINT)
|
.name(ENTRY_POINT)
|
||||||
.module(fragment_module.shader),
|
.module(fragment_module.shader),
|
||||||
];
|
];
|
||||||
|
|
||||||
let shader_stages = [*shader_stages[0], *shader_stages[1]];
|
let mut pipeline_info = vk::GraphicsPipelineCreateInfo::default()
|
||||||
let mut pipeline_info = vk::GraphicsPipelineCreateInfo::builder()
|
|
||||||
.stages(&shader_stages)
|
.stages(&shader_stages)
|
||||||
.vertex_input_state(&pipeline_input_state)
|
.vertex_input_state(&pipeline_input_state)
|
||||||
.input_assembly_state(&input_assembly)
|
.input_assembly_state(&input_assembly)
|
||||||
|
@ -288,7 +289,7 @@ impl VulkanGraphicsPipeline {
|
||||||
let pipeline = unsafe {
|
let pipeline = unsafe {
|
||||||
// panic_safety: if this is successful this should return 1 pipelines.
|
// panic_safety: if this is successful this should return 1 pipelines.
|
||||||
device
|
device
|
||||||
.create_graphics_pipelines(*cache, &[*pipeline_info], None)
|
.create_graphics_pipelines(*cache, &[pipeline_info], None)
|
||||||
.map_err(|e| e.1)?[0]
|
.map_err(|e| e.1)?[0]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -306,9 +307,9 @@ impl VulkanGraphicsPipeline {
|
||||||
let pipeline_layout = PipelineLayoutObjects::new(reflection, replicas, device)?;
|
let pipeline_layout = PipelineLayoutObjects::new(reflection, replicas, device)?;
|
||||||
|
|
||||||
let vertex_info =
|
let vertex_info =
|
||||||
vk::ShaderModuleCreateInfo::builder().code(shader_assembly.vertex.as_ref());
|
vk::ShaderModuleCreateInfo::default().code(shader_assembly.vertex.as_ref());
|
||||||
let fragment_info =
|
let fragment_info =
|
||||||
vk::ShaderModuleCreateInfo::builder().code(shader_assembly.fragment.as_ref());
|
vk::ShaderModuleCreateInfo::default().code(shader_assembly.fragment.as_ref());
|
||||||
|
|
||||||
let vertex_module = VulkanShaderModule::new(device, &vertex_info)?;
|
let vertex_module = VulkanShaderModule::new(device, &vertex_info)?;
|
||||||
let fragment_module = VulkanShaderModule::new(device, &fragment_info)?;
|
let fragment_module = VulkanShaderModule::new(device, &fragment_info)?;
|
||||||
|
@ -325,7 +326,7 @@ impl VulkanGraphicsPipeline {
|
||||||
"vulkan",
|
"vulkan",
|
||||||
&[&shader_assembly.vertex, &shader_assembly.fragment],
|
&[&shader_assembly.vertex, &shader_assembly.fragment],
|
||||||
|pipeline_data| {
|
|pipeline_data| {
|
||||||
let mut cache_info = vk::PipelineCacheCreateInfo::builder();
|
let mut cache_info = vk::PipelineCacheCreateInfo::default();
|
||||||
if let Some(pipeline_data) = pipeline_data.as_ref() {
|
if let Some(pipeline_data) = pipeline_data.as_ref() {
|
||||||
cache_info = cache_info.initial_data(pipeline_data);
|
cache_info = cache_info.initial_data(pipeline_data);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +395,7 @@ impl VulkanGraphicsPipeline {
|
||||||
let attachments = [output.output.image_view];
|
let attachments = [output.output.image_view];
|
||||||
let framebuffer = unsafe {
|
let framebuffer = unsafe {
|
||||||
self.device.create_framebuffer(
|
self.device.create_framebuffer(
|
||||||
&vk::FramebufferCreateInfo::builder()
|
&vk::FramebufferCreateInfo::default()
|
||||||
.render_pass(render_pass.handle)
|
.render_pass(render_pass.handle)
|
||||||
.attachments(&attachments)
|
.attachments(&attachments)
|
||||||
.width(output.output.size.width)
|
.width(output.output.size.width)
|
||||||
|
@ -410,7 +411,7 @@ impl VulkanGraphicsPipeline {
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let render_pass_info = vk::RenderPassBeginInfo::builder()
|
let render_pass_info = vk::RenderPassBeginInfo::default()
|
||||||
.framebuffer(framebuffer)
|
.framebuffer(framebuffer)
|
||||||
.render_pass(render_pass.handle)
|
.render_pass(render_pass.handle)
|
||||||
.clear_values(&clear_values)
|
.clear_values(&clear_values)
|
||||||
|
@ -428,14 +429,13 @@ impl VulkanGraphicsPipeline {
|
||||||
}
|
}
|
||||||
Ok(Some(framebuffer))
|
Ok(Some(framebuffer))
|
||||||
} else {
|
} else {
|
||||||
let attachments = vk::RenderingAttachmentInfo::builder()
|
let attachments = [vk::RenderingAttachmentInfo::default()
|
||||||
.load_op(vk::AttachmentLoadOp::DONT_CARE)
|
.load_op(vk::AttachmentLoadOp::DONT_CARE)
|
||||||
.store_op(vk::AttachmentStoreOp::STORE)
|
.store_op(vk::AttachmentStoreOp::STORE)
|
||||||
.image_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
.image_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||||
.image_view(output.output.image_view);
|
.image_view(output.output.image_view)];
|
||||||
let attachments = [*attachments];
|
|
||||||
|
|
||||||
let rendering_info = vk::RenderingInfo::builder()
|
let rendering_info = vk::RenderingInfo::default()
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.render_area(vk::Rect2D {
|
.render_area(vk::Rect2D {
|
||||||
offset: vk::Offset2D { x: 0, y: 0 },
|
offset: vk::Offset2D { x: 0, y: 0 },
|
||||||
|
|
|
@ -20,7 +20,7 @@ impl LutTexture {
|
||||||
image: Image<BGRA8>,
|
image: Image<BGRA8>,
|
||||||
config: &TextureConfig,
|
config: &TextureConfig,
|
||||||
) -> error::Result<LutTexture> {
|
) -> error::Result<LutTexture> {
|
||||||
let image_info = vk::ImageCreateInfo::builder()
|
let image_info = vk::ImageCreateInfo::default()
|
||||||
.image_type(vk::ImageType::TYPE_2D)
|
.image_type(vk::ImageType::TYPE_2D)
|
||||||
.format(vk::Format::B8G8R8A8_UNORM)
|
.format(vk::Format::B8G8R8A8_UNORM)
|
||||||
.extent(image.size.into())
|
.extent(image.size.into())
|
||||||
|
@ -46,23 +46,23 @@ impl LutTexture {
|
||||||
VulkanImageMemory::new(&vulkan.device, &vulkan.alloc, mem_reqs, &texture)?
|
VulkanImageMemory::new(&vulkan.device, &vulkan.alloc, mem_reqs, &texture)?
|
||||||
};
|
};
|
||||||
|
|
||||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
let image_subresource = vk::ImageSubresourceRange::default()
|
||||||
.level_count(image_info.mip_levels)
|
.level_count(image_info.mip_levels)
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||||
|
|
||||||
let swizzle_components = vk::ComponentMapping::builder()
|
let swizzle_components = vk::ComponentMapping::default()
|
||||||
.r(vk::ComponentSwizzle::R)
|
.r(vk::ComponentSwizzle::R)
|
||||||
.g(vk::ComponentSwizzle::G)
|
.g(vk::ComponentSwizzle::G)
|
||||||
.b(vk::ComponentSwizzle::B)
|
.b(vk::ComponentSwizzle::B)
|
||||||
.a(vk::ComponentSwizzle::A);
|
.a(vk::ComponentSwizzle::A);
|
||||||
|
|
||||||
let view_info = vk::ImageViewCreateInfo::builder()
|
let view_info = vk::ImageViewCreateInfo::default()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(vk::Format::B8G8R8A8_UNORM)
|
.format(vk::Format::B8G8R8A8_UNORM)
|
||||||
.image(texture)
|
.image(texture)
|
||||||
.subresource_range(*image_subresource)
|
.subresource_range(image_subresource)
|
||||||
.components(*swizzle_components);
|
.components(swizzle_components);
|
||||||
|
|
||||||
let texture_view = unsafe { vulkan.device.create_image_view(&view_info, None)? };
|
let texture_view = unsafe { vulkan.device.create_image_view(&view_info, None)? };
|
||||||
|
|
||||||
|
@ -95,9 +95,9 @@ impl LutTexture {
|
||||||
vk::QUEUE_FAMILY_IGNORED,
|
vk::QUEUE_FAMILY_IGNORED,
|
||||||
);
|
);
|
||||||
|
|
||||||
let builder = vk::BufferImageCopy::builder()
|
let builder = vk::BufferImageCopy::default()
|
||||||
.image_subresource(
|
.image_subresource(
|
||||||
*vk::ImageSubresourceLayers::builder()
|
vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(0)
|
.mip_level(0)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
|
@ -114,7 +114,7 @@ impl LutTexture {
|
||||||
} else {
|
} else {
|
||||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL
|
||||||
},
|
},
|
||||||
&[*builder],
|
&[builder],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,22 +140,22 @@ impl LutTexture {
|
||||||
z: 1,
|
z: 1,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let src_subresource = vk::ImageSubresourceLayers::builder()
|
let src_subresource = vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(level - 1)
|
.mip_level(level - 1)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.layer_count(1);
|
.layer_count(1);
|
||||||
|
|
||||||
let dst_subresource = vk::ImageSubresourceLayers::builder()
|
let dst_subresource = vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(level)
|
.mip_level(level)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.layer_count(1);
|
.layer_count(1);
|
||||||
|
|
||||||
let image_blit = vk::ImageBlit::builder()
|
let image_blit = vk::ImageBlit::default()
|
||||||
.src_subresource(*src_subresource)
|
.src_subresource(src_subresource)
|
||||||
.src_offsets(src_offsets)
|
.src_offsets(src_offsets)
|
||||||
.dst_subresource(*dst_subresource)
|
.dst_subresource(dst_subresource)
|
||||||
.dst_offsets(dst_offsets);
|
.dst_offsets(dst_offsets);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -181,7 +181,7 @@ impl LutTexture {
|
||||||
vk::ImageLayout::GENERAL,
|
vk::ImageLayout::GENERAL,
|
||||||
texture,
|
texture,
|
||||||
vk::ImageLayout::GENERAL,
|
vk::ImageLayout::GENERAL,
|
||||||
&[*image_blit],
|
&[image_blit],
|
||||||
config.filter_mode.into(),
|
config.filter_mode.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl VulkanBuffer {
|
||||||
size: usize,
|
size: usize,
|
||||||
) -> error::Result<VulkanBuffer> {
|
) -> error::Result<VulkanBuffer> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let buffer_info = vk::BufferCreateInfo::builder()
|
let buffer_info = vk::BufferCreateInfo::default()
|
||||||
.size(size as vk::DeviceSize)
|
.size(size as vk::DeviceSize)
|
||||||
.usage(usage)
|
.usage(usage)
|
||||||
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
||||||
|
@ -161,13 +161,12 @@ impl RawVulkanBuffer {
|
||||||
storage: &impl UniformStorageAccess,
|
storage: &impl UniformStorageAccess,
|
||||||
) -> error::Result<()> {
|
) -> error::Result<()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let buffer_info = vk::DescriptorBufferInfo::builder()
|
let buffer_info = [vk::DescriptorBufferInfo::default()
|
||||||
.buffer(self.buffer.handle)
|
.buffer(self.buffer.handle)
|
||||||
.offset(0)
|
.offset(0)
|
||||||
.range(storage.ubo_slice().len() as vk::DeviceSize);
|
.range(storage.ubo_slice().len() as vk::DeviceSize)];
|
||||||
|
|
||||||
let buffer_info = [*buffer_info];
|
let write_info = vk::WriteDescriptorSet::default()
|
||||||
let write_info = vk::WriteDescriptorSet::builder()
|
|
||||||
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
.descriptor_type(vk::DescriptorType::UNIFORM_BUFFER)
|
||||||
.dst_set(descriptor_set)
|
.dst_set(descriptor_set)
|
||||||
.dst_binding(binding)
|
.dst_binding(binding)
|
||||||
|
@ -176,7 +175,7 @@ impl RawVulkanBuffer {
|
||||||
|
|
||||||
self.buffer
|
self.buffer
|
||||||
.device
|
.device
|
||||||
.update_descriptor_sets(&[*write_info], &[])
|
.update_descriptor_sets(&[write_info], &[])
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct VulkanRenderPass {
|
||||||
impl VulkanRenderPass {
|
impl VulkanRenderPass {
|
||||||
pub fn create_render_pass(device: &ash::Device, format: vk::Format) -> error::Result<Self> {
|
pub fn create_render_pass(device: &ash::Device, format: vk::Format) -> error::Result<Self> {
|
||||||
// format should never be undefined.
|
// format should never be undefined.
|
||||||
let attachment = vk::AttachmentDescription::builder()
|
let attachment = [vk::AttachmentDescription::default()
|
||||||
.flags(vk::AttachmentDescriptionFlags::empty())
|
.flags(vk::AttachmentDescriptionFlags::empty())
|
||||||
.format(format)
|
.format(format)
|
||||||
.samples(SampleCountFlags::TYPE_1)
|
.samples(SampleCountFlags::TYPE_1)
|
||||||
|
@ -21,20 +21,17 @@ impl VulkanRenderPass {
|
||||||
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
|
.stencil_load_op(AttachmentLoadOp::DONT_CARE)
|
||||||
.stencil_store_op(AttachmentStoreOp::DONT_CARE)
|
.stencil_store_op(AttachmentStoreOp::DONT_CARE)
|
||||||
.initial_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
.initial_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||||
.final_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL);
|
.final_layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)];
|
||||||
let attachment = [*attachment];
|
|
||||||
|
|
||||||
let attachment_ref = vk::AttachmentReference::builder()
|
let attachment_ref = [vk::AttachmentReference::default()
|
||||||
.attachment(0)
|
.attachment(0)
|
||||||
.layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL);
|
.layout(ImageLayout::COLOR_ATTACHMENT_OPTIMAL)];
|
||||||
let attachment_ref = [*attachment_ref];
|
|
||||||
|
|
||||||
let subpass = vk::SubpassDescription::builder()
|
let subpass = [vk::SubpassDescription::default()
|
||||||
.pipeline_bind_point(PipelineBindPoint::GRAPHICS)
|
.pipeline_bind_point(PipelineBindPoint::GRAPHICS)
|
||||||
.color_attachments(&attachment_ref);
|
.color_attachments(&attachment_ref)];
|
||||||
let subpass = [*subpass];
|
|
||||||
|
|
||||||
let renderpass_info = vk::RenderPassCreateInfo::builder()
|
let renderpass_info = vk::RenderPassCreateInfo::default()
|
||||||
.flags(vk::RenderPassCreateFlags::empty())
|
.flags(vk::RenderPassCreateFlags::empty())
|
||||||
.attachments(&attachment)
|
.attachments(&attachment)
|
||||||
.subpasses(&subpass);
|
.subpasses(&subpass);
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl VulkanSampler {
|
||||||
filter: FilterMode,
|
filter: FilterMode,
|
||||||
mipmap: FilterMode,
|
mipmap: FilterMode,
|
||||||
) -> error::Result<VulkanSampler> {
|
) -> error::Result<VulkanSampler> {
|
||||||
let create_info = vk::SamplerCreateInfo::builder()
|
let create_info = vk::SamplerCreateInfo::default()
|
||||||
.mip_lod_bias(0.0)
|
.mip_lod_bias(0.0)
|
||||||
.max_anisotropy(1.0)
|
.max_anisotropy(1.0)
|
||||||
.compare_enable(false)
|
.compare_enable(false)
|
||||||
|
|
|
@ -16,9 +16,9 @@ pub struct OwnedImage {
|
||||||
pub allocator: Arc<Mutex<Allocator>>,
|
pub allocator: Arc<Mutex<Allocator>>,
|
||||||
pub image_view: vk::ImageView,
|
pub image_view: vk::ImageView,
|
||||||
pub image: VulkanImage,
|
pub image: VulkanImage,
|
||||||
pub memory: VulkanImageMemory,
|
|
||||||
pub max_miplevels: u32,
|
pub max_miplevels: u32,
|
||||||
pub levels: u32,
|
pub levels: u32,
|
||||||
|
pub _memory: VulkanImageMemory,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -42,7 +42,7 @@ impl OwnedImage {
|
||||||
if format == ImageFormat::Unknown {
|
if format == ImageFormat::Unknown {
|
||||||
format = ImageFormat::R8G8B8A8Unorm
|
format = ImageFormat::R8G8B8A8Unorm
|
||||||
}
|
}
|
||||||
let image_create_info = vk::ImageCreateInfo::builder()
|
let image_create_info = vk::ImageCreateInfo::default()
|
||||||
.image_type(vk::ImageType::TYPE_2D)
|
.image_type(vk::ImageType::TYPE_2D)
|
||||||
.format(format.into())
|
.format(format.into())
|
||||||
.extent(size.into())
|
.extent(size.into())
|
||||||
|
@ -64,25 +64,25 @@ impl OwnedImage {
|
||||||
let mem_reqs = unsafe { device.get_image_memory_requirements(image) };
|
let mem_reqs = unsafe { device.get_image_memory_requirements(image) };
|
||||||
|
|
||||||
let memory = VulkanImageMemory::new(&device, alloc, mem_reqs, &image)?;
|
let memory = VulkanImageMemory::new(&device, alloc, mem_reqs, &image)?;
|
||||||
let image_subresource = vk::ImageSubresourceRange::builder()
|
let image_subresource = vk::ImageSubresourceRange::default()
|
||||||
.base_mip_level(0)
|
.base_mip_level(0)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.level_count(image_create_info.mip_levels)
|
.level_count(image_create_info.mip_levels)
|
||||||
.layer_count(1)
|
.layer_count(1)
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
.aspect_mask(vk::ImageAspectFlags::COLOR);
|
||||||
|
|
||||||
let swizzle_components = vk::ComponentMapping::builder()
|
let swizzle_components = vk::ComponentMapping::default()
|
||||||
.r(vk::ComponentSwizzle::R)
|
.r(vk::ComponentSwizzle::R)
|
||||||
.g(vk::ComponentSwizzle::G)
|
.g(vk::ComponentSwizzle::G)
|
||||||
.b(vk::ComponentSwizzle::B)
|
.b(vk::ComponentSwizzle::B)
|
||||||
.a(vk::ComponentSwizzle::A);
|
.a(vk::ComponentSwizzle::A);
|
||||||
|
|
||||||
let view_info = vk::ImageViewCreateInfo::builder()
|
let view_info = vk::ImageViewCreateInfo::default()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(format.into())
|
.format(format.into())
|
||||||
.image(image)
|
.image(image)
|
||||||
.subresource_range(*image_subresource)
|
.subresource_range(image_subresource)
|
||||||
.components(*swizzle_components);
|
.components(swizzle_components);
|
||||||
|
|
||||||
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
let image_view = unsafe { device.create_image_view(&view_info, None)? };
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ impl OwnedImage {
|
||||||
size,
|
size,
|
||||||
format: format.into(),
|
format: format.into(),
|
||||||
},
|
},
|
||||||
memory,
|
_memory: memory,
|
||||||
max_miplevels,
|
max_miplevels,
|
||||||
levels: std::cmp::min(max_miplevels, size.calculate_miplevels()),
|
levels: std::cmp::min(max_miplevels, size.calculate_miplevels()),
|
||||||
})
|
})
|
||||||
|
@ -182,7 +182,7 @@ impl OwnedImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_mipmaps_and_end_pass(&self, cmd: vk::CommandBuffer) {
|
pub fn generate_mipmaps_and_end_pass(&self, cmd: vk::CommandBuffer) {
|
||||||
let input_barrier = vk::ImageMemoryBarrier::builder()
|
let input_barrier = vk::ImageMemoryBarrier::default()
|
||||||
.src_access_mask(vk::AccessFlags::COLOR_ATTACHMENT_WRITE)
|
.src_access_mask(vk::AccessFlags::COLOR_ATTACHMENT_WRITE)
|
||||||
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||||
.old_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
.old_layout(vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL)
|
||||||
|
@ -198,7 +198,7 @@ impl OwnedImage {
|
||||||
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
||||||
});
|
});
|
||||||
|
|
||||||
let mipchain_barrier = vk::ImageMemoryBarrier::builder()
|
let mipchain_barrier = vk::ImageMemoryBarrier::default()
|
||||||
.src_access_mask(vk::AccessFlags::empty())
|
.src_access_mask(vk::AccessFlags::empty())
|
||||||
.dst_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
.dst_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||||
.old_layout(vk::ImageLayout::UNDEFINED)
|
.old_layout(vk::ImageLayout::UNDEFINED)
|
||||||
|
@ -222,13 +222,13 @@ impl OwnedImage {
|
||||||
vk::DependencyFlags::empty(),
|
vk::DependencyFlags::empty(),
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&[*input_barrier, *mipchain_barrier],
|
&[input_barrier, mipchain_barrier],
|
||||||
);
|
);
|
||||||
|
|
||||||
for level in 1..self.levels {
|
for level in 1..self.levels {
|
||||||
// need to transition from DST to SRC, one level at a time.
|
// need to transition from DST to SRC, one level at a time.
|
||||||
if level > 1 {
|
if level > 1 {
|
||||||
let next_barrier = vk::ImageMemoryBarrier::builder()
|
let next_barrier = vk::ImageMemoryBarrier::default()
|
||||||
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||||
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
.dst_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||||
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
||||||
|
@ -251,7 +251,7 @@ impl OwnedImage {
|
||||||
vk::DependencyFlags::empty(),
|
vk::DependencyFlags::empty(),
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&[*next_barrier],
|
&[next_barrier],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,22 +276,22 @@ impl OwnedImage {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let src_subresource = vk::ImageSubresourceLayers::builder()
|
let src_subresource = vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(level - 1)
|
.mip_level(level - 1)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.layer_count(1);
|
.layer_count(1);
|
||||||
|
|
||||||
let dst_subresource = vk::ImageSubresourceLayers::builder()
|
let dst_subresource = vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(level)
|
.mip_level(level)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.layer_count(1);
|
.layer_count(1);
|
||||||
|
|
||||||
let image_blit = vk::ImageBlit::builder()
|
let image_blit = vk::ImageBlit::default()
|
||||||
.src_subresource(*src_subresource)
|
.src_subresource(src_subresource)
|
||||||
.src_offsets(src_offsets)
|
.src_offsets(src_offsets)
|
||||||
.dst_subresource(*dst_subresource)
|
.dst_subresource(dst_subresource)
|
||||||
.dst_offsets(dst_offsets);
|
.dst_offsets(dst_offsets);
|
||||||
|
|
||||||
self.device.cmd_blit_image(
|
self.device.cmd_blit_image(
|
||||||
|
@ -300,14 +300,14 @@ impl OwnedImage {
|
||||||
vk::ImageLayout::TRANSFER_SRC_OPTIMAL,
|
vk::ImageLayout::TRANSFER_SRC_OPTIMAL,
|
||||||
self.image.image,
|
self.image.image,
|
||||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
||||||
&[*image_blit],
|
&[image_blit],
|
||||||
vk::Filter::LINEAR,
|
vk::Filter::LINEAR,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move everything to SHADER_READ_ONLY_OPTIMAL
|
// move everything to SHADER_READ_ONLY_OPTIMAL
|
||||||
|
|
||||||
let input_barrier = vk::ImageMemoryBarrier::builder()
|
let input_barrier = vk::ImageMemoryBarrier::default()
|
||||||
.src_access_mask(vk::AccessFlags::TRANSFER_READ)
|
.src_access_mask(vk::AccessFlags::TRANSFER_READ)
|
||||||
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
||||||
.old_layout(vk::ImageLayout::TRANSFER_SRC_OPTIMAL)
|
.old_layout(vk::ImageLayout::TRANSFER_SRC_OPTIMAL)
|
||||||
|
@ -323,7 +323,7 @@ impl OwnedImage {
|
||||||
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
layer_count: vk::REMAINING_ARRAY_LAYERS,
|
||||||
});
|
});
|
||||||
|
|
||||||
let mipchain_barrier = vk::ImageMemoryBarrier::builder()
|
let mipchain_barrier = vk::ImageMemoryBarrier::default()
|
||||||
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
.src_access_mask(vk::AccessFlags::TRANSFER_WRITE)
|
||||||
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
.dst_access_mask(vk::AccessFlags::SHADER_READ)
|
||||||
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
.old_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL)
|
||||||
|
@ -348,7 +348,7 @@ impl OwnedImage {
|
||||||
vk::DependencyFlags::empty(),
|
vk::DependencyFlags::empty(),
|
||||||
&[],
|
&[],
|
||||||
&[],
|
&[],
|
||||||
&[*input_barrier, *mipchain_barrier],
|
&[input_barrier, mipchain_barrier],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,16 +360,16 @@ impl OwnedImage {
|
||||||
source: &VulkanImage,
|
source: &VulkanImage,
|
||||||
source_layout: vk::ImageLayout,
|
source_layout: vk::ImageLayout,
|
||||||
) {
|
) {
|
||||||
let region = vk::ImageCopy::builder()
|
let region = vk::ImageCopy::default()
|
||||||
.src_subresource(
|
.src_subresource(
|
||||||
*vk::ImageSubresourceLayers::builder()
|
vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(0)
|
.mip_level(0)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
.layer_count(1),
|
.layer_count(1),
|
||||||
)
|
)
|
||||||
.dst_subresource(
|
.dst_subresource(
|
||||||
*vk::ImageSubresourceLayers::builder()
|
vk::ImageSubresourceLayers::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.mip_level(0)
|
.mip_level(0)
|
||||||
.base_array_layer(0)
|
.base_array_layer(0)
|
||||||
|
@ -401,7 +401,7 @@ impl OwnedImage {
|
||||||
source_layout,
|
source_layout,
|
||||||
self.image.image,
|
self.image.image,
|
||||||
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL,
|
||||||
&[*region],
|
&[region],
|
||||||
);
|
);
|
||||||
util::vulkan_image_layout_transition_levels(
|
util::vulkan_image_layout_transition_levels(
|
||||||
&self.device,
|
&self.device,
|
||||||
|
@ -443,7 +443,7 @@ impl OwnedImage {
|
||||||
&vk::ClearColorValue {
|
&vk::ClearColorValue {
|
||||||
float32: [0.0, 0.0, 0.0, 0.0],
|
float32: [0.0, 0.0, 0.0, 0.0],
|
||||||
},
|
},
|
||||||
&[*vk::ImageSubresourceRange::builder()
|
&[vk::ImageSubresourceRange::default()
|
||||||
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
.aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
.base_mip_level(0)
|
.base_mip_level(0)
|
||||||
.level_count(1)
|
.level_count(1)
|
||||||
|
|
|
@ -14,13 +14,13 @@ impl VulkanCommandPool {
|
||||||
pub fn new(base: &VulkanBase, frames_in_flight: u32) -> VkResult<VulkanCommandPool> {
|
pub fn new(base: &VulkanBase, frames_in_flight: u32) -> VkResult<VulkanCommandPool> {
|
||||||
let indices = find_queue_family(&base.instance, base.physical_device);
|
let indices = find_queue_family(&base.instance, base.physical_device);
|
||||||
|
|
||||||
let create_info = vk::CommandPoolCreateInfo::builder()
|
let create_info = vk::CommandPoolCreateInfo::default()
|
||||||
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
|
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
|
||||||
.queue_family_index(indices.graphics_family());
|
.queue_family_index(indices.graphics_family());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let pool = base.device.create_command_pool(&create_info, None)?;
|
let pool = base.device.create_command_pool(&create_info, None)?;
|
||||||
let buffer_info = vk::CommandBufferAllocateInfo::builder()
|
let buffer_info = vk::CommandBufferAllocateInfo::default()
|
||||||
.command_pool(pool)
|
.command_pool(pool)
|
||||||
.level(vk::CommandBufferLevel::PRIMARY)
|
.level(vk::CommandBufferLevel::PRIMARY)
|
||||||
.command_buffer_count(frames_in_flight);
|
.command_buffer_count(frames_in_flight);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use ash::extensions::ext::DebugUtils;
|
use ash::ext::debug_utils::Instance;
|
||||||
use ash::prelude::VkResult;
|
use ash::prelude::VkResult;
|
||||||
use ash::vk;
|
use ash::vk;
|
||||||
use ash::vk::{DebugUtilsMessengerEXT, PFN_vkDebugUtilsMessengerCallbackEXT};
|
use ash::vk::{DebugUtilsMessengerEXT, PFN_vkDebugUtilsMessengerCallbackEXT};
|
||||||
|
|
||||||
pub struct VulkanDebug {
|
pub struct VulkanDebug {
|
||||||
pub loader: DebugUtils,
|
pub loader: Instance,
|
||||||
messenger: DebugUtilsMessengerEXT,
|
messenger: DebugUtilsMessengerEXT,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ impl VulkanDebug {
|
||||||
instance: &ash::Instance,
|
instance: &ash::Instance,
|
||||||
callback: PFN_vkDebugUtilsMessengerCallbackEXT,
|
callback: PFN_vkDebugUtilsMessengerCallbackEXT,
|
||||||
) -> VkResult<VulkanDebug> {
|
) -> VkResult<VulkanDebug> {
|
||||||
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
|
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::default()
|
||||||
.message_severity(
|
.message_severity(
|
||||||
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
|
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
|
||||||
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING
|
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING
|
||||||
|
@ -28,7 +28,7 @@ impl VulkanDebug {
|
||||||
)
|
)
|
||||||
.pfn_user_callback(callback);
|
.pfn_user_callback(callback);
|
||||||
|
|
||||||
let debug_utils_loader = DebugUtils::new(entry, instance);
|
let debug_utils_loader = Instance::new(entry, instance);
|
||||||
|
|
||||||
dbg!("got to dbg");
|
dbg!("got to dbg");
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl VulkanFramebuffer {
|
||||||
height: u32,
|
height: u32,
|
||||||
) -> VkResult<VulkanFramebuffer> {
|
) -> VkResult<VulkanFramebuffer> {
|
||||||
let attachments = &[*image_view];
|
let attachments = &[*image_view];
|
||||||
let framebuffer_info = vk::FramebufferCreateInfo::builder()
|
let framebuffer_info = vk::FramebufferCreateInfo::default()
|
||||||
.render_pass(*render_pass)
|
.render_pass(*render_pass)
|
||||||
.attachments(attachments)
|
.attachments(attachments)
|
||||||
.width(width)
|
.width(width)
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl VulkanWindow {
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let render_pass_begin = vk::RenderPassBeginInfo::builder()
|
let render_pass_begin = vk::RenderPassBeginInfo::default()
|
||||||
.render_pass(vulkan.pipeline.renderpass)
|
.render_pass(vulkan.pipeline.renderpass)
|
||||||
.framebuffer(framebuffer)
|
.framebuffer(framebuffer)
|
||||||
.render_area(vk::Rect2D {
|
.render_area(vk::Rect2D {
|
||||||
|
@ -284,7 +284,7 @@ impl VulkanWindow {
|
||||||
// vk::QUEUE_FAMILY_IGNORED,
|
// vk::QUEUE_FAMILY_IGNORED,
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// let blit_subresource = vk::ImageSubresourceLayers::builder()
|
// let blit_subresource = vk::ImageSubresourceLayers::default()
|
||||||
// .layer_count(1)
|
// .layer_count(1)
|
||||||
// .aspect_mask(vk::ImageAspectFlags::COLOR)
|
// .aspect_mask(vk::ImageAspectFlags::COLOR)
|
||||||
// ;
|
// ;
|
||||||
|
@ -344,7 +344,7 @@ impl VulkanWindow {
|
||||||
|
|
||||||
let stage_mask = [vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT];
|
let stage_mask = [vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT];
|
||||||
let cmd = [cmd];
|
let cmd = [cmd];
|
||||||
let submit_info = [*vk::SubmitInfo::builder()
|
let submit_info = [vk::SubmitInfo::default()
|
||||||
.wait_dst_stage_mask(&stage_mask)
|
.wait_dst_stage_mask(&stage_mask)
|
||||||
.wait_semaphores(&image_available)
|
.wait_semaphores(&image_available)
|
||||||
.signal_semaphores(&render_finished)
|
.signal_semaphores(&render_finished)
|
||||||
|
@ -358,7 +358,7 @@ impl VulkanWindow {
|
||||||
|
|
||||||
let swapchain_index = [swapchain_index];
|
let swapchain_index = [swapchain_index];
|
||||||
let swapchain = [vulkan.swapchain.swapchain];
|
let swapchain = [vulkan.swapchain.swapchain];
|
||||||
let present_info = vk::PresentInfoKHR::builder()
|
let present_info = vk::PresentInfoKHR::default()
|
||||||
.wait_semaphores(&render_finished)
|
.wait_semaphores(&render_finished)
|
||||||
.swapchains(&swapchain)
|
.swapchains(&swapchain)
|
||||||
.image_indices(&swapchain_index);
|
.image_indices(&swapchain_index);
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl VulkanPipeline {
|
||||||
pub unsafe fn new(base: &VulkanBase, swapchain: &VulkanSwapchain) -> VkResult<VulkanPipeline> {
|
pub unsafe fn new(base: &VulkanBase, swapchain: &VulkanSwapchain) -> VkResult<VulkanPipeline> {
|
||||||
// upload buffers
|
// upload buffers
|
||||||
let index_buffer_data = [0u32, 1, 2];
|
let index_buffer_data = [0u32, 1, 2];
|
||||||
let index_buffer_info = vk::BufferCreateInfo::builder()
|
let index_buffer_info = vk::BufferCreateInfo::default()
|
||||||
.size(std::mem::size_of_val(&index_buffer_data) as u64)
|
.size(std::mem::size_of_val(&index_buffer_data) as u64)
|
||||||
.usage(vk::BufferUsageFlags::INDEX_BUFFER)
|
.usage(vk::BufferUsageFlags::INDEX_BUFFER)
|
||||||
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
||||||
|
@ -150,7 +150,7 @@ impl VulkanPipeline {
|
||||||
let vertex_code =
|
let vertex_code =
|
||||||
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
|
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
|
||||||
let vertex_shader_info = ShaderModule::new(&base.device, vertex_code)?;
|
let vertex_shader_info = ShaderModule::new(&base.device, vertex_code)?;
|
||||||
let vertex_stage_info = vk::PipelineShaderStageCreateInfo::builder()
|
let vertex_stage_info = vk::PipelineShaderStageCreateInfo::default()
|
||||||
.module(vertex_shader_info.module)
|
.module(vertex_shader_info.module)
|
||||||
.stage(vk::ShaderStageFlags::VERTEX)
|
.stage(vk::ShaderStageFlags::VERTEX)
|
||||||
.name(ENTRY_POINT);
|
.name(ENTRY_POINT);
|
||||||
|
@ -160,16 +160,16 @@ impl VulkanPipeline {
|
||||||
let frag_code =
|
let frag_code =
|
||||||
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
|
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
|
||||||
let frag_shader_info = ShaderModule::new(&base.device, frag_code)?;
|
let frag_shader_info = ShaderModule::new(&base.device, frag_code)?;
|
||||||
let frag_stage_info = vk::PipelineShaderStageCreateInfo::builder()
|
let frag_stage_info = vk::PipelineShaderStageCreateInfo::default()
|
||||||
.module(frag_shader_info.module)
|
.module(frag_shader_info.module)
|
||||||
.stage(vk::ShaderStageFlags::FRAGMENT)
|
.stage(vk::ShaderStageFlags::FRAGMENT)
|
||||||
.name(ENTRY_POINT);
|
.name(ENTRY_POINT);
|
||||||
|
|
||||||
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::builder()
|
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::default()
|
||||||
.vertex_attribute_descriptions(&[])
|
.vertex_attribute_descriptions(&[])
|
||||||
.vertex_binding_descriptions(&[]);
|
.vertex_binding_descriptions(&[]);
|
||||||
|
|
||||||
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo::builder()
|
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo::default()
|
||||||
.primitive_restart_enable(false)
|
.primitive_restart_enable(false)
|
||||||
.topology(vk::PrimitiveTopology::TRIANGLE_LIST);
|
.topology(vk::PrimitiveTopology::TRIANGLE_LIST);
|
||||||
|
|
||||||
|
@ -194,13 +194,13 @@ impl VulkanPipeline {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
let states = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
|
||||||
let dynamic_state = vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&states);
|
let dynamic_state = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&states);
|
||||||
|
|
||||||
let viewport_state_info = vk::PipelineViewportStateCreateInfo::builder()
|
let viewport_state_info = vk::PipelineViewportStateCreateInfo::default()
|
||||||
.scissors(&scissors)
|
.scissors(&scissors)
|
||||||
.viewports(&viewports);
|
.viewports(&viewports);
|
||||||
|
|
||||||
let rs_state_info = vk::PipelineRasterizationStateCreateInfo::builder()
|
let rs_state_info = vk::PipelineRasterizationStateCreateInfo::default()
|
||||||
.depth_clamp_enable(false)
|
.depth_clamp_enable(false)
|
||||||
.depth_bias_enable(false)
|
.depth_bias_enable(false)
|
||||||
.rasterizer_discard_enable(false)
|
.rasterizer_discard_enable(false)
|
||||||
|
@ -209,12 +209,12 @@ impl VulkanPipeline {
|
||||||
.cull_mode(vk::CullModeFlags::BACK)
|
.cull_mode(vk::CullModeFlags::BACK)
|
||||||
.front_face(vk::FrontFace::CLOCKWISE);
|
.front_face(vk::FrontFace::CLOCKWISE);
|
||||||
|
|
||||||
let multisample = vk::PipelineMultisampleStateCreateInfo::builder()
|
let multisample = vk::PipelineMultisampleStateCreateInfo::default()
|
||||||
.rasterization_samples(vk::SampleCountFlags::TYPE_1)
|
.rasterization_samples(vk::SampleCountFlags::TYPE_1)
|
||||||
.min_sample_shading(1.0f32)
|
.min_sample_shading(1.0f32)
|
||||||
.sample_shading_enable(false);
|
.sample_shading_enable(false);
|
||||||
|
|
||||||
let color_blend_attachment = [*vk::PipelineColorBlendAttachmentState::builder()
|
let color_blend_attachment = [vk::PipelineColorBlendAttachmentState::default()
|
||||||
.blend_enable(false)
|
.blend_enable(false)
|
||||||
.color_write_mask(vk::ColorComponentFlags::RGBA)
|
.color_write_mask(vk::ColorComponentFlags::RGBA)
|
||||||
.src_color_blend_factor(vk::BlendFactor::ONE)
|
.src_color_blend_factor(vk::BlendFactor::ONE)
|
||||||
|
@ -224,7 +224,7 @@ impl VulkanPipeline {
|
||||||
.dst_alpha_blend_factor(vk::BlendFactor::ZERO)
|
.dst_alpha_blend_factor(vk::BlendFactor::ZERO)
|
||||||
.alpha_blend_op(vk::BlendOp::ADD)];
|
.alpha_blend_op(vk::BlendOp::ADD)];
|
||||||
|
|
||||||
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
|
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
|
||||||
.logic_op(vk::LogicOp::COPY)
|
.logic_op(vk::LogicOp::COPY)
|
||||||
.attachments(&color_blend_attachment);
|
.attachments(&color_blend_attachment);
|
||||||
|
|
||||||
|
@ -252,11 +252,11 @@ impl VulkanPipeline {
|
||||||
// ..Default::default()
|
// ..Default::default()
|
||||||
// }];
|
// }];
|
||||||
|
|
||||||
let subpass = vk::SubpassDescription::builder()
|
let subpass = vk::SubpassDescription::default()
|
||||||
.color_attachments(&color_attachment_refs)
|
.color_attachments(&color_attachment_refs)
|
||||||
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
|
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
|
||||||
|
|
||||||
let renderpass_create_info = vk::RenderPassCreateInfo::builder()
|
let renderpass_create_info = vk::RenderPassCreateInfo::default()
|
||||||
.attachments(&renderpass_attachments)
|
.attachments(&renderpass_attachments)
|
||||||
.subpasses(std::slice::from_ref(&subpass))
|
.subpasses(std::slice::from_ref(&subpass))
|
||||||
.dependencies(&[]);
|
.dependencies(&[]);
|
||||||
|
@ -266,8 +266,8 @@ impl VulkanPipeline {
|
||||||
.create_render_pass(&renderpass_create_info, None)
|
.create_render_pass(&renderpass_create_info, None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let infos = [*vertex_stage_info, *frag_stage_info];
|
let infos = [vertex_stage_info, frag_stage_info];
|
||||||
let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::builder()
|
let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::default()
|
||||||
.stages(&infos)
|
.stages(&infos)
|
||||||
.vertex_input_state(&vertex_input_state_info)
|
.vertex_input_state(&vertex_input_state_info)
|
||||||
.input_assembly_state(&vertex_input_assembly_state_info)
|
.input_assembly_state(&vertex_input_assembly_state_info)
|
||||||
|
@ -278,7 +278,7 @@ impl VulkanPipeline {
|
||||||
.dynamic_state(&dynamic_state)
|
.dynamic_state(&dynamic_state)
|
||||||
.layout(pipeline_layout)
|
.layout(pipeline_layout)
|
||||||
.render_pass(renderpass);
|
.render_pass(renderpass);
|
||||||
let graphic_pipeline_info = [*graphic_pipeline_info];
|
let graphic_pipeline_info = [graphic_pipeline_info];
|
||||||
|
|
||||||
let graphics_pipelines = base
|
let graphics_pipelines = base
|
||||||
.device
|
.device
|
||||||
|
@ -302,7 +302,7 @@ pub struct ShaderModule {
|
||||||
|
|
||||||
impl ShaderModule {
|
impl ShaderModule {
|
||||||
pub fn new(device: &ash::Device, spirv: Vec<u32>) -> VkResult<ShaderModule> {
|
pub fn new(device: &ash::Device, spirv: Vec<u32>) -> VkResult<ShaderModule> {
|
||||||
let create_info = vk::ShaderModuleCreateInfo::builder().code(&spirv);
|
let create_info = vk::ShaderModuleCreateInfo::default().code(&spirv);
|
||||||
|
|
||||||
let module = unsafe { device.create_shader_module(&create_info, None)? };
|
let module = unsafe { device.create_shader_module(&create_info, None)? };
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use ash::vk;
|
||||||
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||||
|
|
||||||
pub struct VulkanSurface {
|
pub struct VulkanSurface {
|
||||||
surface_loader: ash::extensions::khr::Surface,
|
surface_loader: ash::khr::surface::Instance,
|
||||||
pub surface: vk::SurfaceKHR,
|
pub surface: vk::SurfaceKHR,
|
||||||
pub present_queue: vk::Queue,
|
pub present_queue: vk::Queue,
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ impl VulkanSurface {
|
||||||
ash_window::create_surface(
|
ash_window::create_surface(
|
||||||
&base.entry,
|
&base.entry,
|
||||||
&base.instance,
|
&base.instance,
|
||||||
window.raw_display_handle(),
|
window.raw_display_handle().unwrap(),
|
||||||
window.raw_window_handle(),
|
window.raw_window_handle().unwrap(),
|
||||||
None,
|
None,
|
||||||
)?
|
)?
|
||||||
};
|
};
|
||||||
|
|
||||||
let surface_loader = ash::extensions::khr::Surface::new(&base.entry, &base.instance);
|
let surface_loader = ash::khr::surface::Instance::new(&base.entry, &base.instance);
|
||||||
|
|
||||||
let present_queue = unsafe {
|
let present_queue = unsafe {
|
||||||
let queue_family = base
|
let queue_family = base
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
pub struct VulkanSwapchain {
|
pub struct VulkanSwapchain {
|
||||||
pub swapchain: vk::SwapchainKHR,
|
pub swapchain: vk::SwapchainKHR,
|
||||||
pub loader: ash::extensions::khr::Swapchain,
|
pub loader: ash::khr::swapchain::Device,
|
||||||
pub format: vk::SurfaceFormatKHR,
|
pub format: vk::SurfaceFormatKHR,
|
||||||
pub extent: vk::Extent2D,
|
pub extent: vk::Extent2D,
|
||||||
pub mode: vk::PresentModeKHR,
|
pub mode: vk::PresentModeKHR,
|
||||||
|
@ -44,7 +44,7 @@ impl VulkanSwapchain {
|
||||||
panic!("exclusive mode only")
|
panic!("exclusive mode only")
|
||||||
}
|
}
|
||||||
|
|
||||||
let create_info = vk::SwapchainCreateInfoKHR::builder()
|
let create_info = vk::SwapchainCreateInfoKHR::default()
|
||||||
.surface(surface.surface)
|
.surface(surface.surface)
|
||||||
.present_mode(mode)
|
.present_mode(mode)
|
||||||
.min_image_count(image_count)
|
.min_image_count(image_count)
|
||||||
|
@ -59,7 +59,7 @@ impl VulkanSwapchain {
|
||||||
// todo: switch to IMAGE_USAGE_TRANSFER_DST
|
// todo: switch to IMAGE_USAGE_TRANSFER_DST
|
||||||
.image_usage(vk::ImageUsageFlags::COLOR_ATTACHMENT);
|
.image_usage(vk::ImageUsageFlags::COLOR_ATTACHMENT);
|
||||||
|
|
||||||
let loader = ash::extensions::khr::Swapchain::new(&base.instance, &base.device);
|
let loader = ash::khr::swapchain::Device::new(&base.instance, &base.device);
|
||||||
|
|
||||||
let swapchain = unsafe { loader.create_swapchain(&create_info, None)? };
|
let swapchain = unsafe { loader.create_swapchain(&create_info, None)? };
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ impl VulkanSwapchain {
|
||||||
|
|
||||||
// create render imaghes
|
// create render imaghes
|
||||||
for _ in 0..swapchain_images.len() {
|
for _ in 0..swapchain_images.len() {
|
||||||
let create_info = vk::ImageCreateInfo::builder()
|
let create_info = vk::ImageCreateInfo::default()
|
||||||
.extent(Extent3D {
|
.extent(Extent3D {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -104,7 +104,7 @@ impl VulkanSwapchain {
|
||||||
let swapchain_image_views: VkResult<Vec<vk::ImageView>> = swapchain_images
|
let swapchain_image_views: VkResult<Vec<vk::ImageView>> = swapchain_images
|
||||||
.iter()
|
.iter()
|
||||||
.map(|image| {
|
.map(|image| {
|
||||||
let create_info = vk::ImageViewCreateInfo::builder()
|
let create_info = vk::ImageViewCreateInfo::default()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(format.format)
|
.format(format.format)
|
||||||
.components(vk::ComponentMapping {
|
.components(vk::ComponentMapping {
|
||||||
|
@ -128,7 +128,7 @@ impl VulkanSwapchain {
|
||||||
// .loader
|
// .loader
|
||||||
// .set_debug_utils_object_name(
|
// .set_debug_utils_object_name(
|
||||||
// base.device.handle(),
|
// base.device.handle(),
|
||||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||||
// .object_handle(image.as_raw())
|
// .object_handle(image.as_raw())
|
||||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||||
// b"SwapchainImage\0",
|
// b"SwapchainImage\0",
|
||||||
|
@ -141,7 +141,7 @@ impl VulkanSwapchain {
|
||||||
// .loader
|
// .loader
|
||||||
// .set_debug_utils_object_name(
|
// .set_debug_utils_object_name(
|
||||||
// base.device.handle(),
|
// base.device.handle(),
|
||||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||||
// .object_handle(view.as_raw())
|
// .object_handle(view.as_raw())
|
||||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||||
// b"SwapchainImageView\0",
|
// b"SwapchainImageView\0",
|
||||||
|
@ -158,7 +158,7 @@ impl VulkanSwapchain {
|
||||||
let render_image_views: VkResult<Vec<vk::ImageView>> = render_images
|
let render_image_views: VkResult<Vec<vk::ImageView>> = render_images
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(image, _)| {
|
.map(|(image, _)| {
|
||||||
let create_info = vk::ImageViewCreateInfo::builder()
|
let create_info = vk::ImageViewCreateInfo::default()
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
.format(format.format)
|
.format(format.format)
|
||||||
.components(vk::ComponentMapping {
|
.components(vk::ComponentMapping {
|
||||||
|
@ -182,7 +182,7 @@ impl VulkanSwapchain {
|
||||||
// .loader
|
// .loader
|
||||||
// .set_debug_utils_object_name(
|
// .set_debug_utils_object_name(
|
||||||
// base.device.handle(),
|
// base.device.handle(),
|
||||||
// &vk::DebugUtilsObjectNameInfoEXT::builder()
|
// &vk::DebugUtilsObjectNameInfoEXT::default()
|
||||||
// .object_handle(view.as_raw())
|
// .object_handle(view.as_raw())
|
||||||
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
// .object_name(CStr::from_bytes_with_nul_unchecked(
|
||||||
// b"RenderImageView\0",
|
// b"RenderImageView\0",
|
||||||
|
|
|
@ -20,7 +20,7 @@ impl SyncObjects {
|
||||||
render_finished
|
render_finished
|
||||||
.push(device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?);
|
.push(device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?);
|
||||||
in_flight.push(device.create_fence(
|
in_flight.push(device.create_fence(
|
||||||
&vk::FenceCreateInfo::builder().flags(vk::FenceCreateFlags::SIGNALED),
|
&vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED),
|
||||||
None,
|
None,
|
||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct VulkanBase {
|
||||||
|
|
||||||
impl VulkanBase {
|
impl VulkanBase {
|
||||||
pub fn new(entry: ash::Entry) -> VkResult<VulkanBase> {
|
pub fn new(entry: ash::Entry) -> VkResult<VulkanBase> {
|
||||||
let app_info = vk::ApplicationInfo::builder()
|
let app_info = vk::ApplicationInfo::default()
|
||||||
.application_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
.application_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
||||||
.engine_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
.engine_name(unsafe { CStr::from_bytes_with_nul_unchecked(WINDOW_TITLE) })
|
||||||
.engine_version(0)
|
.engine_version(0)
|
||||||
|
@ -37,14 +37,14 @@ impl VulkanBase {
|
||||||
dbg!("entry");
|
dbg!("entry");
|
||||||
// todo: make this xplat
|
// todo: make this xplat
|
||||||
let extensions = [
|
let extensions = [
|
||||||
ash::extensions::khr::Surface::name().as_ptr(),
|
ash::khr::surface::NAME.as_ptr(),
|
||||||
ash::extensions::khr::Win32Surface::name().as_ptr(),
|
ash::khr::win32_surface::NAME.as_ptr(),
|
||||||
ash::extensions::ext::DebugUtils::name().as_ptr(),
|
ash::ext::debug_utils::NAME.as_ptr(),
|
||||||
];
|
];
|
||||||
|
|
||||||
let layers = [KHRONOS_VALIDATION.as_ptr().cast()];
|
let layers = [KHRONOS_VALIDATION.as_ptr().cast()];
|
||||||
|
|
||||||
let create_info = vk::InstanceCreateInfo::builder()
|
let create_info = vk::InstanceCreateInfo::default()
|
||||||
.application_info(&app_info)
|
.application_info(&app_info)
|
||||||
.enabled_layer_names(&layers)
|
.enabled_layer_names(&layers)
|
||||||
.enabled_extension_names(&extensions);
|
.enabled_extension_names(&extensions);
|
||||||
|
@ -84,25 +84,25 @@ impl VulkanBase {
|
||||||
let _debug = [unsafe { CStr::from_bytes_with_nul_unchecked(KHRONOS_VALIDATION).as_ptr() }];
|
let _debug = [unsafe { CStr::from_bytes_with_nul_unchecked(KHRONOS_VALIDATION).as_ptr() }];
|
||||||
|
|
||||||
let indices = find_queue_family(instance, *physical_device);
|
let indices = find_queue_family(instance, *physical_device);
|
||||||
let queue_info = [*vk::DeviceQueueCreateInfo::builder()
|
let queue_info = [vk::DeviceQueueCreateInfo::default()
|
||||||
.queue_family_index(indices.graphics_family())
|
.queue_family_index(indices.graphics_family())
|
||||||
.queue_priorities(&[1.0f32])];
|
.queue_priorities(&[1.0f32])];
|
||||||
|
|
||||||
// let physical_device_features = vk::PhysicalDeviceFeatures::default();
|
// let physical_device_features = vk::PhysicalDeviceFeatures::default();
|
||||||
|
|
||||||
let mut physical_device_features =
|
let mut physical_device_features =
|
||||||
vk::PhysicalDeviceVulkan13Features::builder().dynamic_rendering(true);
|
vk::PhysicalDeviceVulkan13Features::default().dynamic_rendering(true);
|
||||||
|
|
||||||
// let mut physical_device_features =
|
// let mut physical_device_features =
|
||||||
// vk::PhysicalDeviceFeatures2::builder().push_next(&mut physical_device_features)
|
// vk::PhysicalDeviceFeatures2::default().push_next(&mut physical_device_features)
|
||||||
// ;
|
// ;
|
||||||
|
|
||||||
let extensions = [
|
let extensions = [
|
||||||
ash::extensions::khr::Swapchain::name().as_ptr(),
|
ash::khr::swapchain::NAME.as_ptr(),
|
||||||
ash::extensions::khr::DynamicRendering::name().as_ptr(),
|
ash::khr::dynamic_rendering::NAME.as_ptr(),
|
||||||
];
|
];
|
||||||
|
|
||||||
let device_create_info = vk::DeviceCreateInfo::builder()
|
let device_create_info = vk::DeviceCreateInfo::default()
|
||||||
.queue_create_infos(&queue_info)
|
.queue_create_infos(&queue_info)
|
||||||
// .enabled_layer_names(&debug)
|
// .enabled_layer_names(&debug)
|
||||||
.enabled_extension_names(&extensions)
|
.enabled_extension_names(&extensions)
|
||||||
|
|
|
@ -26,7 +26,7 @@ librashader-runtime-gl = { path = "../librashader-runtime-gl", version = "0.2.8"
|
||||||
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.8", optional = true }
|
librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.2.8", optional = true }
|
||||||
librashader-runtime-mtl = { path = "../librashader-runtime-mtl", version = "0.2.8", optional = true }
|
librashader-runtime-mtl = { path = "../librashader-runtime-mtl", version = "0.2.8", optional = true }
|
||||||
|
|
||||||
ash = { version = "0.37", optional = true }
|
ash = { version = "0.38", optional = true }
|
||||||
halfbrown = "0.2.4"
|
halfbrown = "0.2.4"
|
||||||
|
|
||||||
[target.'cfg(not(all(target_vendor="apple", docsrs)))'.dependencies]
|
[target.'cfg(not(all(target_vendor="apple", docsrs)))'.dependencies]
|
||||||
|
|
Loading…
Reference in a new issue