mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-22 07:01:29 +11:00
Update gfx with image_format_properties
This commit is contained in:
parent
0cbabce1e6
commit
7fed8abd57
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,5 +2,6 @@
|
|||
/target/
|
||||
conformance/*.xml
|
||||
conformance/*.qpa
|
||||
conformance/*.txt
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
|
|
9
Makefile
9
Makefile
|
@ -5,6 +5,8 @@ NATIVE_DIR=target/native
|
|||
TARGET=$(NATIVE_DIR)/test
|
||||
OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
|
||||
LIB_EXTENSION=
|
||||
TEST_LIST=conformance/deqp.txt
|
||||
TEST_LIST_SOURCE=$(CTS_DIR)/external/vulkancts/mustpass/1.0.3/vk-default.txt
|
||||
|
||||
RUST_BACKTRACE:=1
|
||||
BACKEND:=gl
|
||||
|
@ -57,8 +59,11 @@ $(TARGET): $(LIBRARY) $(OBJECTS) Makefile
|
|||
run: $(TARGET)
|
||||
$(TARGET)
|
||||
|
||||
cts: $(TARGET)
|
||||
-LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(CTS_DIR)/build/external/vulkancts/modules/vulkan/deqp-vk
|
||||
$(TEST_LIST): $(TEST_LIST_SOURCE)
|
||||
cat $(TEST_LIST_SOURCE) | grep -v -e ".event" -e "query" >$(TEST_LIST)
|
||||
|
||||
cts: $(TARGET) $(TEST_LIST)
|
||||
-LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(CTS_DIR)/build/external/vulkancts/modules/vulkan/deqp-vk --deqp-caselist-file=$(TEST_LIST)
|
||||
python $(CTS_DIR)/scripts/log/log_to_xml.py TestResults.qpa conformance/last.xml
|
||||
mv TestResults.qpa conformance/last.qpa
|
||||
firefox conformance/last.xml
|
||||
|
|
|
@ -8,12 +8,13 @@ This is a prototype library implementing [Vulkan Portability Initiative](https:/
|
|||
|
||||
| gfx-rs Backend | Total cases | Pass | Fail | Quality warning | Compatibility warning | Not supported | Resource error | Internal error | Timeout | Crash |
|
||||
| -------------- | -- | -- | -- | - | - | - | - | - | - | - |
|
||||
| *Vulkan* | 3589 | 665 | 676 | 0 | 0 | 2248 | 0 | 0 | 0 | 0 |
|
||||
| *Vulkan* | 3742 | 1393 | 101 | 0 | 0 | 2248 | 0 | 0 | 0 | 0 |
|
||||
| *DX12* | 3563 | 1243 | 73 | 0 | 0 | 2247 | 0 | 0 | 0 | 0 |
|
||||
|
||||
Currently crashing on event handling.
|
||||
Currently stopping with:
|
||||
> Unable to create Vulkan instance: VkError(ErrorIncompatibleDriver)
|
||||
|
||||
Please visit [our wiki](https://github.com/gfx-rs/portability/wiki/Vulkan-CTS-status) for CTS hookup instructions. Once everything is set, you can generate the new results by calling `make cts`.
|
||||
Please visit [our wiki](https://github.com/gfx-rs/portability/wiki/Vulkan-CTS-status) for CTS hookup instructions. Once everything is set, you can generate the new results by calling `make cts` on Unix systems.
|
||||
|
||||
## Check out
|
||||
```
|
||||
|
|
|
@ -25,19 +25,19 @@ optional = true
|
|||
|
||||
[dependencies.gfx-hal]
|
||||
git = "https://github.com/gfx-rs/gfx"
|
||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
||||
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||
|
||||
[target.'cfg(not(target_os = "macos"))'.dependencies.gfx-backend-vulkan]
|
||||
git = "https://github.com/gfx-rs/gfx"
|
||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
||||
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||
optional = true
|
||||
|
||||
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
|
||||
git = "https://github.com/gfx-rs/gfx"
|
||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
||||
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||
optional = true
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies.gfx-backend-metal]
|
||||
git = "https://github.com/gfx-rs/gfx"
|
||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
||||
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||
optional = true
|
||||
|
|
|
@ -18,18 +18,13 @@ pub fn format_properties_from_hal(properties: format::Properties) -> VkFormatPro
|
|||
}
|
||||
}
|
||||
|
||||
pub fn image_format_properties_from_hal(_properties: format::Properties) -> VkImageFormatProperties {
|
||||
//TODO
|
||||
pub fn image_format_properties_from_hal(properties: image::FormatProperties) -> VkImageFormatProperties {
|
||||
VkImageFormatProperties {
|
||||
maxExtent: VkExtent3D {
|
||||
width: 1<<12,
|
||||
height: 1<<12,
|
||||
depth: 1<<8,
|
||||
},
|
||||
maxMipLevels: 1,
|
||||
maxArrayLayers: 1,
|
||||
sampleCounts: 1,
|
||||
maxResourceSize: 1<<24,
|
||||
maxExtent: extent3d_from_hal(properties.max_extent),
|
||||
maxMipLevels: properties.max_levels as _,
|
||||
maxArrayLayers: properties.max_layers as _,
|
||||
sampleCounts: properties.sample_count_mask as _,
|
||||
maxResourceSize: properties.max_resource_size as _,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +99,14 @@ pub fn extent2d_from_hal(extent: window::Extent2D) -> VkExtent2D {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn extent3d_from_hal(extent: image::Extent) -> VkExtent3D {
|
||||
VkExtent3D {
|
||||
width: extent.width,
|
||||
height: extent.height,
|
||||
depth: extent.depth,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_swizzle(components: VkComponentMapping) -> format::Swizzle {
|
||||
format::Swizzle(
|
||||
map_swizzle_component(components.r, format::Component::R),
|
||||
|
@ -195,8 +198,8 @@ pub fn map_view_kind(ty: VkImageViewType) -> image::ViewKind {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn map_image_layout(layout: VkImageLayout) -> image::ImageLayout {
|
||||
use hal::image::ImageLayout::*;
|
||||
pub fn map_image_layout(layout: VkImageLayout) -> image::Layout {
|
||||
use hal::image::Layout::*;
|
||||
match layout {
|
||||
VkImageLayout::VK_IMAGE_LAYOUT_UNDEFINED => Undefined,
|
||||
VkImageLayout::VK_IMAGE_LAYOUT_GENERAL => General,
|
||||
|
@ -234,10 +237,10 @@ pub fn map_image_usage(usage: VkImageUsageFlags) -> image::Usage {
|
|||
flags |= image::Usage::DEPTH_STENCIL_ATTACHMENT;
|
||||
}
|
||||
if usage & VkImageUsageFlagBits::VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT as u32 != 0 {
|
||||
unimplemented!()
|
||||
warn!("VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT is not supported yet");
|
||||
}
|
||||
if usage & VkImageUsageFlagBits::VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT as u32 != 0 {
|
||||
unimplemented!()
|
||||
warn!("VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT is not supported yet");
|
||||
}
|
||||
|
||||
flags
|
||||
|
@ -397,8 +400,7 @@ pub fn map_descriptor_type(ty: VkDescriptorType) -> pso::DescriptorType {
|
|||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER => pso::DescriptorType::UniformBuffer,
|
||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER => pso::DescriptorType::StorageBuffer,
|
||||
VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT => pso::DescriptorType::InputAttachment,
|
||||
|
||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER |
|
||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER => pso::DescriptorType::CombinedImageSampler,
|
||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC |
|
||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC => unimplemented!(),
|
||||
_ => panic!("Unexpected descriptor type: {:?}", ty),
|
||||
|
@ -575,7 +577,7 @@ pub fn map_blend_op(
|
|||
#[inline]
|
||||
pub fn map_cmd_buffer_usage(flags: VkCommandBufferUsageFlags) -> command::CommandBufferFlags {
|
||||
// Vulkan and HAL flags are equal
|
||||
unsafe { mem::transmute(flags as u16) }
|
||||
unsafe { mem::transmute(flags) }
|
||||
}
|
||||
|
||||
pub fn map_filter(filter: VkFilter) -> image::Filter {
|
||||
|
@ -644,3 +646,11 @@ pub fn map_viewport(vp: &VkViewport) -> pso::Viewport {
|
|||
depth: vp.minDepth .. vp.maxDepth,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_tiling(tiling: VkImageTiling) -> image::Tiling {
|
||||
match tiling {
|
||||
VkImageTiling::VK_IMAGE_TILING_OPTIMAL => image::Tiling::Optimal,
|
||||
VkImageTiling::VK_IMAGE_TILING_LINEAR => image::Tiling::Linear,
|
||||
_ => panic!("Unexpected tiling: {:?}", tiling),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,17 +207,31 @@ pub extern "C" fn gfxGetPhysicalDeviceFormatProperties(
|
|||
pub extern "C" fn gfxGetPhysicalDeviceImageFormatProperties(
|
||||
adapter: VkPhysicalDevice,
|
||||
format: VkFormat,
|
||||
_type_: VkImageType,
|
||||
_tiling: VkImageTiling,
|
||||
_usage: VkImageUsageFlags,
|
||||
_flags: VkImageCreateFlags,
|
||||
typ: VkImageType,
|
||||
tiling: VkImageTiling,
|
||||
usage: VkImageUsageFlags,
|
||||
create_flags: VkImageCreateFlags,
|
||||
pImageFormatProperties: *mut VkImageFormatProperties,
|
||||
) -> VkResult {
|
||||
let properties = adapter.physical_device.format_properties(conv::map_format(format));
|
||||
unsafe {
|
||||
*pImageFormatProperties = conv::image_format_properties_from_hal(properties);
|
||||
let properties = adapter.physical_device.image_format_properties(
|
||||
conv::map_format(format).unwrap(),
|
||||
match typ {
|
||||
VkImageType::VK_IMAGE_TYPE_1D => 1,
|
||||
VkImageType::VK_IMAGE_TYPE_2D => 2,
|
||||
VkImageType::VK_IMAGE_TYPE_3D => 3,
|
||||
_ => panic!("Unexpected image type: {:?}", typ),
|
||||
},
|
||||
conv::map_tiling(tiling),
|
||||
conv::map_image_usage(usage),
|
||||
unsafe { mem::transmute(create_flags) },
|
||||
);
|
||||
match properties {
|
||||
Some(props) => unsafe {
|
||||
*pImageFormatProperties = conv::image_format_properties_from_hal(props);
|
||||
VkResult::VK_SUCCESS
|
||||
},
|
||||
None => VkResult::VK_ERROR_FORMAT_NOT_SUPPORTED
|
||||
}
|
||||
VkResult::VK_SUCCESS
|
||||
}
|
||||
#[inline]
|
||||
pub extern "C" fn gfxGetPhysicalDeviceProperties(
|
||||
|
@ -1133,6 +1147,7 @@ pub extern "C" fn gfxCreateImage(
|
|||
),
|
||||
info.mipLevels as _,
|
||||
conv::map_format(info.format).unwrap(),
|
||||
conv::map_tiling(info.tiling),
|
||||
conv::map_image_usage(info.usage),
|
||||
unsafe { mem::transmute(info.flags) },
|
||||
)
|
||||
|
@ -1764,7 +1779,9 @@ pub extern "C" fn gfxCreateDescriptorSetLayout(
|
|||
let bindings = layout_bindings
|
||||
.iter()
|
||||
.map(|binding| {
|
||||
assert!(binding.pImmutableSamplers.is_null()); // TODO
|
||||
if !binding.pImmutableSamplers.is_null() {
|
||||
warn!("immutable samplers are not supported yet");
|
||||
}
|
||||
|
||||
pso::DescriptorSetLayoutBinding {
|
||||
binding: binding.binding as _,
|
||||
|
@ -1798,7 +1815,9 @@ pub extern "C" fn gfxCreateDescriptorPool(
|
|||
pDescriptorPool: *mut VkDescriptorPool,
|
||||
) -> VkResult {
|
||||
let info = unsafe { &*pCreateInfo };
|
||||
assert_eq!(info.flags, 0); // TODO
|
||||
if info.flags != 0 {
|
||||
warn!("gfxCreateDescriptorPool flags are not supported: 0x{:x}", info.flags);
|
||||
}
|
||||
|
||||
let pool_sizes = unsafe {
|
||||
slice::from_raw_parts(info.pPoolSizes, info.poolSizeCount as _)
|
||||
|
@ -1864,12 +1883,13 @@ pub extern "C" fn gfxAllocateDescriptorSets(
|
|||
}
|
||||
#[inline]
|
||||
pub extern "C" fn gfxFreeDescriptorSets(
|
||||
device: VkDevice,
|
||||
descriptorPool: VkDescriptorPool,
|
||||
descriptorSetCount: u32,
|
||||
pDescriptorSets: *const VkDescriptorSet,
|
||||
_device: VkDevice,
|
||||
_descriptorPool: VkDescriptorPool,
|
||||
_descriptorSetCount: u32,
|
||||
_pDescriptorSets: *const VkDescriptorSet,
|
||||
) -> VkResult {
|
||||
unimplemented!()
|
||||
error!("gfxFreeDescriptorSets not implemented");
|
||||
VkResult::VK_NOT_READY
|
||||
}
|
||||
#[inline]
|
||||
pub extern "C" fn gfxUpdateDescriptorSets(
|
||||
|
|
Loading…
Reference in a new issue