Bug 1633472 - Update gfx-backend-vulkan 3rd party r=groves

we are handling the case where the driver technically knows about Vulkan, but no hardware supports it.

Differential Revision: https://phabricator.services.mozilla.com/D72726
This commit is contained in:
Dzmitry Malyshau 2020-04-28 14:09:50 +00:00
Родитель 83d8e3a96a
Коммит c969ade19a
12 изменённых файлов: 6299 добавлений и 6301 удалений

4
Cargo.lock сгенерированный
Просмотреть файл

@ -1727,9 +1727,9 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.5.2"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd1dee09bd8d8f1ba52c5ba22d1f70c7ffa990c5eb245eb3ef2d0206f631673"
checksum = "45ff36feae801fa23d29acd74082603a0145a697a23595757dd4e78828ab33da"
dependencies = [
"arrayvec",
"ash",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"b0bb273d2dc664f6e8cf5aa24775ebfd56d27b51b169517ef9e9d9f38e7717a2","README.md":"8ac155de510fa20cfceb7a9c9a9891abb28b11a0bd930470c3fd145dbaea2d2b","src/command.rs":"0d51171269e626d5a198f6d04e7e27435edc9ee3fd06e79bbc41c1b9abe07b95","src/conv.rs":"0548ce0fec00e91d214fe0b04691173235b04bb0040d6e60338f4ceb869047e3","src/device.rs":"d3bab36762a929cfcf7c9c6d7b78f70ed8402389cd8e80863359cbedec63e58a","src/info.rs":"5f278828dc418fc052e6bf9d2baa6396270646d78148a62e0787082a30787899","src/lib.rs":"8b51447dc0a12836ca75f201db588f3e8b5e7b7179a35ecdfd1405b72eca8ceb","src/native.rs":"d7eb53631db7a1a59a3880602e67c27bb39a4385f5bffcf659fc39499156effe","src/pool.rs":"b964b974063e64113233645199daa96fa453851bb7fe566ec7bc9b254b2728d2","src/window.rs":"bfad91e51eecae9d4d534b362dafa244e28c864d3cef5ce53d3798e39cb5bffc"},"package":"ebd1dee09bd8d8f1ba52c5ba22d1f70c7ffa990c5eb245eb3ef2d0206f631673"}
{"files":{"Cargo.toml":"40880324b21dbbbca40c1362e4b3ea445d7600f773b7146e8284c48a3c9352cf","README.md":"8cc42e022567870c58a53ff1cb6f94e961482e789fe5e22f9960408a43cf8405","src/command.rs":"b8af184eec394220b3e2365c9df7d134b848f44c97d01ff54c1e27ce499ce6fa","src/conv.rs":"e7117e38380c568faa843e4ede990580bf67e8d3c56ead7923b73336e107f862","src/device.rs":"e64c9cd4af13e974d77cdb9d646e6e9ab7d4ad8f60d79227af7610fc3552e047","src/info.rs":"4a21b54f85ff73c538ca2f57f4d371eb862b5a28f126cd0ecafd37fc6dfd1318","src/lib.rs":"26e21f46d470a64f9133b8bf8a2d265ecadc475d73ddba8b3218f90646654efd","src/native.rs":"097330f1866f9128abfc8efc001f4809fe499d854b0fb11b9ee7b1622151bb3f","src/pool.rs":"acf5785b9841655cbbed469899a80d87fa9ed4c1e5b6b3a3ee35b57d728e3da4","src/window.rs":"ff8c3a9921d4bb5a06361e2f113420c901efdd446ff897b49539e48804495b86"},"package":"45ff36feae801fa23d29acd74082603a0145a697a23595757dd4e78828ab33da"}

Просмотреть файл

@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "gfx-backend-vulkan"
version = "0.5.2"
version = "0.5.6"
authors = ["The Gfx-rs Developers"]
description = "Vulkan API backend for gfx-rs"
homepage = "https://github.com/gfx-rs/gfx"

26
third_party/rust/gfx-backend-vulkan/README.md поставляемый
Просмотреть файл

@ -1,13 +1,13 @@
# gfx-backend-vulkan
[Vulkan](https://www.khronos.org/vulkan/) backend for gfx-rs.
## Normalized Coordinates
Render | Depth | Texture
-------|-------|--------
![render_coordinates](../../../info/vk_render_coordinates.png) | ![depth_coordinates](../../../info/dx_depth_coordinates.png) | ![texture_coordinates](../../../info/dx_texture_coordinates.png)
## Mirroring
HAL is modelled after Vulkan, so everything should be 1:1.
# gfx-backend-vulkan
[Vulkan](https://www.khronos.org/vulkan/) backend for gfx-rs.
## Normalized Coordinates
Render | Depth | Texture
-------|-------|--------
![render_coordinates](../../../info/vk_render_coordinates.png) | ![depth_coordinates](../../../info/dx_depth_coordinates.png) | ![texture_coordinates](../../../info/dx_texture_coordinates.png)
## Mirroring
HAL is modelled after Vulkan, so everything should be 1:1.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1218
third_party/rust/gfx-backend-vulkan/src/conv.rs поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,5 +1,5 @@
pub mod intel {
pub const VENDOR: u32 = 0x8086;
pub const DEVICE_KABY_LAKE_MASK: u32 = 0x5900;
pub const DEVICE_SKY_LAKE_MASK: u32 = 0x1900;
}
pub mod intel {
pub const VENDOR: u32 = 0x8086;
pub const DEVICE_KABY_LAKE_MASK: u32 = 0x5900;
pub const DEVICE_SKY_LAKE_MASK: u32 = 0x1900;
}

3020
third_party/rust/gfx-backend-vulkan/src/lib.rs поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,180 +1,180 @@
use crate::{window::FramebufferCachePtr, Backend, RawDevice};
use ash::{version::DeviceV1_0, vk};
use hal::{image::SubresourceRange, pso};
use std::{borrow::Borrow, sync::Arc};
#[derive(Debug, Hash)]
pub struct Semaphore(pub vk::Semaphore);
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct Fence(pub vk::Fence);
#[derive(Debug, Hash)]
pub struct Event(pub vk::Event);
#[derive(Debug, Hash)]
pub struct GraphicsPipeline(pub vk::Pipeline);
#[derive(Debug, Hash)]
pub struct ComputePipeline(pub vk::Pipeline);
#[derive(Debug, Hash)]
pub struct Memory {
pub(crate) raw: vk::DeviceMemory,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Buffer {
pub(crate) raw: vk::Buffer,
}
unsafe impl Sync for Buffer {}
unsafe impl Send for Buffer {}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct BufferView {
pub(crate) raw: vk::BufferView,
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct Image {
pub(crate) raw: vk::Image,
pub(crate) ty: vk::ImageType,
pub(crate) flags: vk::ImageCreateFlags,
pub(crate) extent: vk::Extent3D,
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub enum ImageViewOwner {
User,
Surface(FramebufferCachePtr),
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct ImageView {
pub(crate) image: vk::Image,
pub(crate) view: vk::ImageView,
pub(crate) range: SubresourceRange,
pub(crate) owner: ImageViewOwner,
}
#[derive(Debug, Hash)]
pub struct Sampler(pub vk::Sampler);
#[derive(Debug, Hash)]
pub struct RenderPass {
pub raw: vk::RenderPass,
pub clear_attachments_mask: u64,
}
#[derive(Debug, Hash)]
pub struct Framebuffer {
pub(crate) raw: vk::Framebuffer,
pub(crate) owned: bool,
}
#[derive(Debug)]
pub struct DescriptorSetLayout {
pub(crate) raw: vk::DescriptorSetLayout,
pub(crate) bindings: Arc<Vec<pso::DescriptorSetLayoutBinding>>,
}
#[derive(Debug)]
pub struct DescriptorSet {
pub(crate) raw: vk::DescriptorSet,
pub(crate) bindings: Arc<Vec<pso::DescriptorSetLayoutBinding>>,
}
#[derive(Debug, Hash)]
pub struct PipelineLayout {
pub(crate) raw: vk::PipelineLayout,
}
#[derive(Debug)]
pub struct PipelineCache {
pub(crate) raw: vk::PipelineCache,
}
#[derive(Debug, Eq, Hash, PartialEq)]
pub struct ShaderModule {
pub(crate) raw: vk::ShaderModule,
}
#[derive(Debug)]
pub struct DescriptorPool {
pub(crate) raw: vk::DescriptorPool,
pub(crate) device: Arc<RawDevice>,
/// This vec only exists to re-use allocations when `DescriptorSet`s are freed.
pub(crate) set_free_vec: Vec<vk::DescriptorSet>,
}
impl pso::DescriptorPool<Backend> for DescriptorPool {
unsafe fn allocate<I, E>(
&mut self,
layout_iter: I,
list: &mut E,
) -> Result<(), pso::AllocationError>
where
I: IntoIterator,
I::Item: Borrow<DescriptorSetLayout>,
E: Extend<DescriptorSet>,
{
use std::ptr;
let mut raw_layouts = Vec::new();
let mut layout_bindings = Vec::new();
for layout in layout_iter {
raw_layouts.push(layout.borrow().raw);
layout_bindings.push(layout.borrow().bindings.clone());
}
let info = vk::DescriptorSetAllocateInfo {
s_type: vk::StructureType::DESCRIPTOR_SET_ALLOCATE_INFO,
p_next: ptr::null(),
descriptor_pool: self.raw,
descriptor_set_count: raw_layouts.len() as u32,
p_set_layouts: raw_layouts.as_ptr(),
};
self.device
.raw
.allocate_descriptor_sets(&info)
.map(|sets| {
list.extend(
sets.into_iter()
.zip(layout_bindings)
.map(|(raw, bindings)| DescriptorSet { raw, bindings }),
)
})
.map_err(|err| match err {
vk::Result::ERROR_OUT_OF_HOST_MEMORY => pso::AllocationError::Host,
vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => pso::AllocationError::Device,
vk::Result::ERROR_OUT_OF_POOL_MEMORY => pso::AllocationError::OutOfPoolMemory,
_ => pso::AllocationError::FragmentedPool,
})
}
unsafe fn free_sets<I>(&mut self, descriptor_sets: I)
where
I: IntoIterator<Item = DescriptorSet>,
{
self.set_free_vec.clear();
self.set_free_vec
.extend(descriptor_sets.into_iter().map(|d| d.raw));
self.device
.raw
.free_descriptor_sets(self.raw, &self.set_free_vec);
}
unsafe fn reset(&mut self) {
assert_eq!(
Ok(()),
self.device
.raw
.reset_descriptor_pool(self.raw, vk::DescriptorPoolResetFlags::empty())
);
}
}
#[derive(Debug, Hash)]
pub struct QueryPool(pub vk::QueryPool);
use crate::{window::FramebufferCachePtr, Backend, RawDevice};
use ash::{version::DeviceV1_0, vk};
use hal::{image::SubresourceRange, pso};
use std::{borrow::Borrow, sync::Arc};
#[derive(Debug, Hash)]
pub struct Semaphore(pub vk::Semaphore);
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct Fence(pub vk::Fence);
#[derive(Debug, Hash)]
pub struct Event(pub vk::Event);
#[derive(Debug, Hash)]
pub struct GraphicsPipeline(pub vk::Pipeline);
#[derive(Debug, Hash)]
pub struct ComputePipeline(pub vk::Pipeline);
#[derive(Debug, Hash)]
pub struct Memory {
pub(crate) raw: vk::DeviceMemory,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Buffer {
pub(crate) raw: vk::Buffer,
}
unsafe impl Sync for Buffer {}
unsafe impl Send for Buffer {}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct BufferView {
pub(crate) raw: vk::BufferView,
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct Image {
pub(crate) raw: vk::Image,
pub(crate) ty: vk::ImageType,
pub(crate) flags: vk::ImageCreateFlags,
pub(crate) extent: vk::Extent3D,
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub enum ImageViewOwner {
User,
Surface(FramebufferCachePtr),
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct ImageView {
pub(crate) image: vk::Image,
pub(crate) view: vk::ImageView,
pub(crate) range: SubresourceRange,
pub(crate) owner: ImageViewOwner,
}
#[derive(Debug, Hash)]
pub struct Sampler(pub vk::Sampler);
#[derive(Debug, Hash)]
pub struct RenderPass {
pub raw: vk::RenderPass,
pub clear_attachments_mask: u64,
}
#[derive(Debug, Hash)]
pub struct Framebuffer {
pub(crate) raw: vk::Framebuffer,
pub(crate) owned: bool,
}
#[derive(Debug)]
pub struct DescriptorSetLayout {
pub(crate) raw: vk::DescriptorSetLayout,
pub(crate) bindings: Arc<Vec<pso::DescriptorSetLayoutBinding>>,
}
#[derive(Debug)]
pub struct DescriptorSet {
pub(crate) raw: vk::DescriptorSet,
pub(crate) bindings: Arc<Vec<pso::DescriptorSetLayoutBinding>>,
}
#[derive(Debug, Hash)]
pub struct PipelineLayout {
pub(crate) raw: vk::PipelineLayout,
}
#[derive(Debug)]
pub struct PipelineCache {
pub(crate) raw: vk::PipelineCache,
}
#[derive(Debug, Eq, Hash, PartialEq)]
pub struct ShaderModule {
pub(crate) raw: vk::ShaderModule,
}
#[derive(Debug)]
pub struct DescriptorPool {
pub(crate) raw: vk::DescriptorPool,
pub(crate) device: Arc<RawDevice>,
/// This vec only exists to re-use allocations when `DescriptorSet`s are freed.
pub(crate) set_free_vec: Vec<vk::DescriptorSet>,
}
impl pso::DescriptorPool<Backend> for DescriptorPool {
unsafe fn allocate<I, E>(
&mut self,
layout_iter: I,
list: &mut E,
) -> Result<(), pso::AllocationError>
where
I: IntoIterator,
I::Item: Borrow<DescriptorSetLayout>,
E: Extend<DescriptorSet>,
{
use std::ptr;
let mut raw_layouts = Vec::new();
let mut layout_bindings = Vec::new();
for layout in layout_iter {
raw_layouts.push(layout.borrow().raw);
layout_bindings.push(layout.borrow().bindings.clone());
}
let info = vk::DescriptorSetAllocateInfo {
s_type: vk::StructureType::DESCRIPTOR_SET_ALLOCATE_INFO,
p_next: ptr::null(),
descriptor_pool: self.raw,
descriptor_set_count: raw_layouts.len() as u32,
p_set_layouts: raw_layouts.as_ptr(),
};
self.device
.raw
.allocate_descriptor_sets(&info)
.map(|sets| {
list.extend(
sets.into_iter()
.zip(layout_bindings)
.map(|(raw, bindings)| DescriptorSet { raw, bindings }),
)
})
.map_err(|err| match err {
vk::Result::ERROR_OUT_OF_HOST_MEMORY => pso::AllocationError::Host,
vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => pso::AllocationError::Device,
vk::Result::ERROR_OUT_OF_POOL_MEMORY => pso::AllocationError::OutOfPoolMemory,
_ => pso::AllocationError::FragmentedPool,
})
}
unsafe fn free_sets<I>(&mut self, descriptor_sets: I)
where
I: IntoIterator<Item = DescriptorSet>,
{
self.set_free_vec.clear();
self.set_free_vec
.extend(descriptor_sets.into_iter().map(|d| d.raw));
self.device
.raw
.free_descriptor_sets(self.raw, &self.set_free_vec);
}
unsafe fn reset(&mut self) {
assert_eq!(
Ok(()),
self.device
.raw
.reset_descriptor_pool(self.raw, vk::DescriptorPoolResetFlags::empty())
);
}
}
#[derive(Debug, Hash)]
pub struct QueryPool(pub vk::QueryPool);

Просмотреть файл

@ -1,64 +1,64 @@
use ash::version::DeviceV1_0;
use ash::vk;
use smallvec::SmallVec;
use std::ptr;
use std::sync::Arc;
use crate::command::CommandBuffer;
use crate::conv;
use crate::{Backend, RawDevice};
use hal::{command, pool};
#[derive(Debug)]
pub struct RawCommandPool {
pub(crate) raw: vk::CommandPool,
pub(crate) device: Arc<RawDevice>,
}
impl pool::CommandPool<Backend> for RawCommandPool {
unsafe fn reset(&mut self, release_resources: bool) {
let flags = if release_resources {
vk::CommandPoolResetFlags::RELEASE_RESOURCES
} else {
vk::CommandPoolResetFlags::empty()
};
assert_eq!(Ok(()), self.device.raw.reset_command_pool(self.raw, flags));
}
unsafe fn allocate<E>(&mut self, num: usize, level: command::Level, list: &mut E)
where
E: Extend<CommandBuffer>,
{
let info = vk::CommandBufferAllocateInfo {
s_type: vk::StructureType::COMMAND_BUFFER_ALLOCATE_INFO,
p_next: ptr::null(),
command_pool: self.raw,
level: conv::map_command_buffer_level(level),
command_buffer_count: num as u32,
};
let device = &self.device;
list.extend(
device
.raw
.allocate_command_buffers(&info)
.expect("Error on command buffer allocation")
.into_iter()
.map(|buffer| CommandBuffer {
raw: buffer,
device: Arc::clone(device),
}),
);
}
unsafe fn free<I>(&mut self, cbufs: I)
where
I: IntoIterator<Item = CommandBuffer>,
{
let buffers: SmallVec<[vk::CommandBuffer; 16]> =
cbufs.into_iter().map(|buffer| buffer.raw).collect();
self.device.raw.free_command_buffers(self.raw, &buffers);
}
}
use ash::version::DeviceV1_0;
use ash::vk;
use smallvec::SmallVec;
use std::ptr;
use std::sync::Arc;
use crate::command::CommandBuffer;
use crate::conv;
use crate::{Backend, RawDevice};
use hal::{command, pool};
#[derive(Debug)]
pub struct RawCommandPool {
pub(crate) raw: vk::CommandPool,
pub(crate) device: Arc<RawDevice>,
}
impl pool::CommandPool<Backend> for RawCommandPool {
unsafe fn reset(&mut self, release_resources: bool) {
let flags = if release_resources {
vk::CommandPoolResetFlags::RELEASE_RESOURCES
} else {
vk::CommandPoolResetFlags::empty()
};
assert_eq!(Ok(()), self.device.raw.reset_command_pool(self.raw, flags));
}
unsafe fn allocate<E>(&mut self, num: usize, level: command::Level, list: &mut E)
where
E: Extend<CommandBuffer>,
{
let info = vk::CommandBufferAllocateInfo {
s_type: vk::StructureType::COMMAND_BUFFER_ALLOCATE_INFO,
p_next: ptr::null(),
command_pool: self.raw,
level: conv::map_command_buffer_level(level),
command_buffer_count: num as u32,
};
let device = &self.device;
list.extend(
device
.raw
.allocate_command_buffers(&info)
.expect("Error on command buffer allocation")
.into_iter()
.map(|buffer| CommandBuffer {
raw: buffer,
device: Arc::clone(device),
}),
);
}
unsafe fn free<I>(&mut self, cbufs: I)
where
I: IntoIterator<Item = CommandBuffer>,
{
let buffers: SmallVec<[vk::CommandBuffer; 16]> =
cbufs.into_iter().map(|buffer| buffer.raw).collect();
self.device.raw.free_command_buffers(self.raw, &buffers);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу