Update to latest gfx with new limits

This commit is contained in:
Dzmitry Malyshau 2021-03-14 00:17:06 -05:00
parent 4318b4bd4d
commit 414ae9d596
3 changed files with 100 additions and 49 deletions

102
Cargo.lock generated
View file

@ -27,7 +27,7 @@ version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38"
dependencies = [ dependencies = [
"libloading", "libloading 0.6.5",
] ]
[[package]] [[package]]
@ -222,11 +222,10 @@ dependencies = [
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.3.2" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e"
checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"libloading", "libloading 0.7.0",
"winapi", "winapi",
] ]
@ -236,7 +235,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
dependencies = [ dependencies = [
"libloading", "libloading 0.6.5",
] ]
[[package]] [[package]]
@ -252,6 +251,12 @@ dependencies = [
"termcolor", "termcolor",
] ]
[[package]]
name = "fixedbitset"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
version = "0.3.2" version = "0.3.2"
@ -290,7 +295,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.8.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -300,13 +305,13 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"gfx-auxil", "gfx-auxil",
"gfx-hal", "gfx-hal",
"libloading", "libloading 0.7.0",
"log", "log",
"parking_lot", "parking_lot",
"range-alloc", "range-alloc",
@ -321,7 +326,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -335,13 +340,14 @@ dependencies = [
"raw-window-handle", "raw-window-handle",
"smallvec", "smallvec",
"spirv_cross", "spirv_cross",
"thunderdome",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -351,20 +357,20 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"gfx-auxil", "fxhash",
"gfx-hal", "gfx-hal",
"glow", "glow",
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libloading", "libloading 0.7.0",
"log", "log",
"naga",
"parking_lot", "parking_lot",
"raw-window-handle", "raw-window-handle",
"spirv_cross",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
] ]
@ -372,7 +378,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -380,22 +386,22 @@ dependencies = [
"cocoa-foundation", "cocoa-foundation",
"copyless", "copyless",
"foreign-types", "foreign-types",
"gfx-auxil", "fxhash",
"gfx-hal", "gfx-hal",
"log", "log",
"metal", "metal",
"naga",
"objc", "objc",
"parking_lot", "parking_lot",
"range-alloc", "range-alloc",
"raw-window-handle", "raw-window-handle",
"spirv_cross",
"storage-map", "storage-map",
] ]
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -414,7 +420,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"naga", "naga",
@ -488,6 +494,12 @@ dependencies = [
"x11-dl", "x11-dl",
] ]
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.17" version = "0.1.17"
@ -503,6 +515,16 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "inplace_it" name = "inplace_it"
version = "0.3.3" version = "0.3.3"
@ -538,12 +560,12 @@ dependencies = [
[[package]] [[package]]
name = "khronos-egl" name = "khronos-egl"
version = "3.0.0" version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8020ff3b84f9ac87461216ad0501bc09b33c1cbe17404d8ea405160fd164bab" checksum = "7e8cc4d128654d2191681ab98140c4d99e4bd9333efe1526e033586a5a061e1e"
dependencies = [ dependencies = [
"libc", "libc",
"libloading", "libloading 0.7.0",
] ]
[[package]] [[package]]
@ -586,6 +608,16 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "libloading"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a"
dependencies = [
"cfg-if 1.0.0",
"winapi",
]
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.1" version = "0.4.1"
@ -651,13 +683,15 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.3.1" version = "0.3.1"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-9#c12003f5648fcade5f20c01debc4cb12bd47073e" source = "git+https://github.com/gfx-rs/naga?tag=gfx-15#196523de7820d4907a14bd22517c4d572d26b0be"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
"fxhash", "fxhash",
"log", "log",
"num-traits", "num-traits",
"petgraph",
"spirv_headers",
"thiserror", "thiserror",
] ]
@ -730,6 +764,16 @@ 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 = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
name = "petgraph"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.19" version = "0.3.19"
@ -837,7 +881,7 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.2" version = "0.1.2"
source = "git+https://github.com/gfx-rs/gfx#dd034e6cc94c175195137c12bd35d5fa98f51dba" source = "git+https://github.com/gfx-rs/gfx#a8db9a81097d33308c3cc34b0c8c3c0ff5c072cf"
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
@ -934,6 +978,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "spirv_headers"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f5b132530b1ac069df335577e3581765995cba5a13995cdbbdbc8fb057c532c"
dependencies = [
"bitflags",
"num-traits",
]
[[package]] [[package]]
name = "storage-map" name = "storage-map"
version = "0.3.0" version = "0.3.0"

View file

@ -9,6 +9,7 @@ use super::*;
pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits { pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
let viewport_size = limits.max_viewport_dimensions[0].max(limits.max_viewport_dimensions[1]); let viewport_size = limits.max_viewport_dimensions[0].max(limits.max_viewport_dimensions[1]);
let dl = limits.descriptor_limits;
VkPhysicalDeviceLimits { VkPhysicalDeviceLimits {
maxImageDimension1D: limits.max_image_1d_size, maxImageDimension1D: limits.max_image_1d_size,
maxImageDimension2D: limits.max_image_2d_size, maxImageDimension2D: limits.max_image_2d_size,
@ -24,26 +25,21 @@ pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
bufferImageGranularity: limits.buffer_image_granularity, bufferImageGranularity: limits.buffer_image_granularity,
sparseAddressSpaceSize: 0, sparseAddressSpaceSize: 0,
maxBoundDescriptorSets: limits.max_bound_descriptor_sets as _, maxBoundDescriptorSets: limits.max_bound_descriptor_sets as _,
maxPerStageDescriptorSamplers: limits.max_per_stage_descriptor_samplers as _, maxPerStageDescriptorSamplers: dl.max_per_stage_descriptor_samplers,
maxPerStageDescriptorUniformBuffers: limits.max_per_stage_descriptor_uniform_buffers as _, maxPerStageDescriptorUniformBuffers: dl.max_per_stage_descriptor_uniform_buffers,
maxPerStageDescriptorStorageBuffers: limits.max_per_stage_descriptor_storage_buffers as _, maxPerStageDescriptorStorageBuffers: dl.max_per_stage_descriptor_storage_buffers,
maxPerStageDescriptorSampledImages: limits.max_per_stage_descriptor_sampled_images as _, maxPerStageDescriptorSampledImages: dl.max_per_stage_descriptor_sampled_images,
maxPerStageDescriptorStorageImages: limits.max_per_stage_descriptor_storage_images as _, maxPerStageDescriptorStorageImages: dl.max_per_stage_descriptor_storage_images,
maxPerStageDescriptorInputAttachments: limits.max_per_stage_descriptor_input_attachments maxPerStageDescriptorInputAttachments: dl.max_per_stage_descriptor_input_attachments,
as _, maxPerStageResources: dl.max_per_stage_resources,
maxPerStageResources: limits.max_per_stage_resources as _, maxDescriptorSetSamplers: dl.max_descriptor_set_samplers,
maxDescriptorSetSamplers: limits.max_descriptor_set_samplers as _, maxDescriptorSetUniformBuffers: dl.max_descriptor_set_uniform_buffers,
maxDescriptorSetUniformBuffers: limits.max_descriptor_set_uniform_buffers as _, maxDescriptorSetUniformBuffersDynamic: dl.max_descriptor_set_uniform_buffers_dynamic.max(1),
maxDescriptorSetUniformBuffersDynamic: limits maxDescriptorSetStorageBuffers: dl.max_descriptor_set_storage_buffers,
.max_descriptor_set_uniform_buffers_dynamic maxDescriptorSetStorageBuffersDynamic: dl.max_descriptor_set_storage_buffers_dynamic.max(1),
.max(1) as _, maxDescriptorSetSampledImages: dl.max_descriptor_set_sampled_images,
maxDescriptorSetStorageBuffers: limits.max_descriptor_set_storage_buffers as _, maxDescriptorSetStorageImages: dl.max_descriptor_set_storage_images,
maxDescriptorSetStorageBuffersDynamic: limits maxDescriptorSetInputAttachments: dl.max_descriptor_set_input_attachments,
.max_descriptor_set_storage_buffers_dynamic
.max(1) as _,
maxDescriptorSetSampledImages: limits.max_descriptor_set_sampled_images as _,
maxDescriptorSetStorageImages: limits.max_descriptor_set_storage_images as _,
maxDescriptorSetInputAttachments: limits.max_descriptor_set_input_attachments as _,
maxVertexInputAttributes: limits.max_vertex_input_attributes as _, maxVertexInputAttributes: limits.max_vertex_input_attributes as _,
maxVertexInputBindings: limits.max_vertex_input_bindings as _, maxVertexInputBindings: limits.max_vertex_input_bindings as _,
maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _, maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _,
@ -689,7 +685,6 @@ pub fn map_err_device_creation(err: device::CreationError) -> VkResult {
device::CreationError::OutOfMemory(Host) => VkResult::VK_ERROR_OUT_OF_HOST_MEMORY, device::CreationError::OutOfMemory(Host) => VkResult::VK_ERROR_OUT_OF_HOST_MEMORY,
device::CreationError::OutOfMemory(Device) => VkResult::VK_ERROR_OUT_OF_DEVICE_MEMORY, device::CreationError::OutOfMemory(Device) => VkResult::VK_ERROR_OUT_OF_DEVICE_MEMORY,
device::CreationError::InitializationFailed => VkResult::VK_ERROR_INITIALIZATION_FAILED, device::CreationError::InitializationFailed => VkResult::VK_ERROR_INITIALIZATION_FAILED,
device::CreationError::MissingExtension => VkResult::VK_ERROR_EXTENSION_NOT_PRESENT,
device::CreationError::MissingFeature => VkResult::VK_ERROR_FEATURE_NOT_PRESENT, device::CreationError::MissingFeature => VkResult::VK_ERROR_FEATURE_NOT_PRESENT,
device::CreationError::TooManyObjects => VkResult::VK_ERROR_TOO_MANY_OBJECTS, device::CreationError::TooManyObjects => VkResult::VK_ERROR_TOO_MANY_OBJECTS,
device::CreationError::DeviceLost => VkResult::VK_ERROR_DEVICE_LOST, device::CreationError::DeviceLost => VkResult::VK_ERROR_DEVICE_LOST,

View file

@ -434,7 +434,7 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceProperties(
pProperties: *mut VkPhysicalDeviceProperties, pProperties: *mut VkPhysicalDeviceProperties,
) { ) {
let adapter_info = &adapter.info; let adapter_info = &adapter.info;
let limits = conv::limits_from_hal(adapter.physical_device.limits()); let limits = conv::limits_from_hal(adapter.physical_device.properties().limits);
let sparse_properties = mem::zeroed(); // TODO let sparse_properties = mem::zeroed(); // TODO
let (major, minor, patch) = VERSION; let (major, minor, patch) = VERSION;
@ -487,7 +487,7 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceProperties2KHR(
let data = let data =
(ptr as *mut VkPhysicalDevicePortabilitySubsetPropertiesKHR).as_mut().unwrap() (ptr as *mut VkPhysicalDevicePortabilitySubsetPropertiesKHR).as_mut().unwrap()
; ;
let limits = adapter.physical_device.limits(); let limits = adapter.physical_device.properties().limits;
data.minVertexInputBindingStrideAlignment = limits.min_vertex_input_binding_stride_alignment as u32; data.minVertexInputBindingStrideAlignment = limits.min_vertex_input_binding_stride_alignment as u32;
data.pNext data.pNext
} }
@ -1721,11 +1721,11 @@ pub unsafe extern "C" fn gfxCreateBuffer(
) -> VkResult { ) -> VkResult {
let info = &*pCreateInfo; let info = &*pCreateInfo;
assert_eq!(info.sharingMode, VkSharingMode::VK_SHARING_MODE_EXCLUSIVE); // TODO assert_eq!(info.sharingMode, VkSharingMode::VK_SHARING_MODE_EXCLUSIVE); // TODO
assert_eq!(info.flags, 0); // TODO
let sparse_flags = hal::memory::SparseFlags::from_bits_truncate(info.flags);
let buffer = gpu let buffer = gpu
.device .device
.create_buffer(info.size, conv::map_buffer_usage(info.usage)) .create_buffer(info.size, conv::map_buffer_usage(info.usage), sparse_flags)
.expect("Error on creating buffer"); .expect("Error on creating buffer");
*pBuffer = Handle::new(buffer); *pBuffer = Handle::new(buffer);
VkResult::VK_SUCCESS VkResult::VK_SUCCESS
@ -1795,6 +1795,7 @@ pub unsafe extern "C" fn gfxCreateImage(
warn!("unexpected initial layout: {:?}", info.initialLayout); warn!("unexpected initial layout: {:?}", info.initialLayout);
} }
let sparse_flags = hal::memory::SparseFlags::from_bits_truncate(info.flags);
let kind = conv::map_image_kind( let kind = conv::map_image_kind(
info.imageType, info.imageType,
info.extent, info.extent,
@ -1819,6 +1820,7 @@ pub unsafe extern "C" fn gfxCreateImage(
format, format,
conv::map_tiling(info.tiling), conv::map_tiling(info.tiling),
usage, usage,
sparse_flags,
view_caps, view_caps,
) )
.expect("Error on creating image"); .expect("Error on creating image");