mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-22 15:01:31 +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/
|
/target/
|
||||||
conformance/*.xml
|
conformance/*.xml
|
||||||
conformance/*.qpa
|
conformance/*.qpa
|
||||||
|
conformance/*.txt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -5,6 +5,8 @@ NATIVE_DIR=target/native
|
||||||
TARGET=$(NATIVE_DIR)/test
|
TARGET=$(NATIVE_DIR)/test
|
||||||
OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
|
OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
|
||||||
LIB_EXTENSION=
|
LIB_EXTENSION=
|
||||||
|
TEST_LIST=conformance/deqp.txt
|
||||||
|
TEST_LIST_SOURCE=$(CTS_DIR)/external/vulkancts/mustpass/1.0.3/vk-default.txt
|
||||||
|
|
||||||
RUST_BACKTRACE:=1
|
RUST_BACKTRACE:=1
|
||||||
BACKEND:=gl
|
BACKEND:=gl
|
||||||
|
@ -57,8 +59,11 @@ $(TARGET): $(LIBRARY) $(OBJECTS) Makefile
|
||||||
run: $(TARGET)
|
run: $(TARGET)
|
||||||
$(TARGET)
|
$(TARGET)
|
||||||
|
|
||||||
cts: $(TARGET)
|
$(TEST_LIST): $(TEST_LIST_SOURCE)
|
||||||
-LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(CTS_DIR)/build/external/vulkancts/modules/vulkan/deqp-vk
|
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
|
python $(CTS_DIR)/scripts/log/log_to_xml.py TestResults.qpa conformance/last.xml
|
||||||
mv TestResults.qpa conformance/last.qpa
|
mv TestResults.qpa conformance/last.qpa
|
||||||
firefox conformance/last.xml
|
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 |
|
| 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 |
|
| *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
|
## Check out
|
||||||
```
|
```
|
||||||
|
|
|
@ -25,19 +25,19 @@ optional = true
|
||||||
|
|
||||||
[dependencies.gfx-hal]
|
[dependencies.gfx-hal]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "macos"))'.dependencies.gfx-backend-vulkan]
|
[target.'cfg(not(target_os = "macos"))'.dependencies.gfx-backend-vulkan]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
|
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies.gfx-backend-metal]
|
[target.'cfg(target_os = "macos")'.dependencies.gfx-backend-metal]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
rev = "adbf496f9b56d70cecb4a02aab6ad316e59a391d"
|
rev = "4538593758d826cdcfc9f2de95dfc03c68624d05"
|
||||||
optional = true
|
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 {
|
pub fn image_format_properties_from_hal(properties: image::FormatProperties) -> VkImageFormatProperties {
|
||||||
//TODO
|
|
||||||
VkImageFormatProperties {
|
VkImageFormatProperties {
|
||||||
maxExtent: VkExtent3D {
|
maxExtent: extent3d_from_hal(properties.max_extent),
|
||||||
width: 1<<12,
|
maxMipLevels: properties.max_levels as _,
|
||||||
height: 1<<12,
|
maxArrayLayers: properties.max_layers as _,
|
||||||
depth: 1<<8,
|
sampleCounts: properties.sample_count_mask as _,
|
||||||
},
|
maxResourceSize: properties.max_resource_size as _,
|
||||||
maxMipLevels: 1,
|
|
||||||
maxArrayLayers: 1,
|
|
||||||
sampleCounts: 1,
|
|
||||||
maxResourceSize: 1<<24,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
pub fn map_swizzle(components: VkComponentMapping) -> format::Swizzle {
|
||||||
format::Swizzle(
|
format::Swizzle(
|
||||||
map_swizzle_component(components.r, format::Component::R),
|
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 {
|
pub fn map_image_layout(layout: VkImageLayout) -> image::Layout {
|
||||||
use hal::image::ImageLayout::*;
|
use hal::image::Layout::*;
|
||||||
match layout {
|
match layout {
|
||||||
VkImageLayout::VK_IMAGE_LAYOUT_UNDEFINED => Undefined,
|
VkImageLayout::VK_IMAGE_LAYOUT_UNDEFINED => Undefined,
|
||||||
VkImageLayout::VK_IMAGE_LAYOUT_GENERAL => General,
|
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;
|
flags |= image::Usage::DEPTH_STENCIL_ATTACHMENT;
|
||||||
}
|
}
|
||||||
if usage & VkImageUsageFlagBits::VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT as u32 != 0 {
|
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 {
|
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
|
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_UNIFORM_BUFFER => pso::DescriptorType::UniformBuffer,
|
||||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER => pso::DescriptorType::StorageBuffer,
|
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER => pso::DescriptorType::StorageBuffer,
|
||||||
VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT => pso::DescriptorType::InputAttachment,
|
VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT => pso::DescriptorType::InputAttachment,
|
||||||
|
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER => pso::DescriptorType::CombinedImageSampler,
|
||||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER |
|
|
||||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC |
|
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC |
|
||||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC => unimplemented!(),
|
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC => unimplemented!(),
|
||||||
_ => panic!("Unexpected descriptor type: {:?}", ty),
|
_ => panic!("Unexpected descriptor type: {:?}", ty),
|
||||||
|
@ -575,7 +577,7 @@ pub fn map_blend_op(
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn map_cmd_buffer_usage(flags: VkCommandBufferUsageFlags) -> command::CommandBufferFlags {
|
pub fn map_cmd_buffer_usage(flags: VkCommandBufferUsageFlags) -> command::CommandBufferFlags {
|
||||||
// Vulkan and HAL flags are equal
|
// Vulkan and HAL flags are equal
|
||||||
unsafe { mem::transmute(flags as u16) }
|
unsafe { mem::transmute(flags) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_filter(filter: VkFilter) -> image::Filter {
|
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,
|
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(
|
pub extern "C" fn gfxGetPhysicalDeviceImageFormatProperties(
|
||||||
adapter: VkPhysicalDevice,
|
adapter: VkPhysicalDevice,
|
||||||
format: VkFormat,
|
format: VkFormat,
|
||||||
_type_: VkImageType,
|
typ: VkImageType,
|
||||||
_tiling: VkImageTiling,
|
tiling: VkImageTiling,
|
||||||
_usage: VkImageUsageFlags,
|
usage: VkImageUsageFlags,
|
||||||
_flags: VkImageCreateFlags,
|
create_flags: VkImageCreateFlags,
|
||||||
pImageFormatProperties: *mut VkImageFormatProperties,
|
pImageFormatProperties: *mut VkImageFormatProperties,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
let properties = adapter.physical_device.format_properties(conv::map_format(format));
|
let properties = adapter.physical_device.image_format_properties(
|
||||||
unsafe {
|
conv::map_format(format).unwrap(),
|
||||||
*pImageFormatProperties = conv::image_format_properties_from_hal(properties);
|
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]
|
#[inline]
|
||||||
pub extern "C" fn gfxGetPhysicalDeviceProperties(
|
pub extern "C" fn gfxGetPhysicalDeviceProperties(
|
||||||
|
@ -1133,6 +1147,7 @@ pub extern "C" fn gfxCreateImage(
|
||||||
),
|
),
|
||||||
info.mipLevels as _,
|
info.mipLevels as _,
|
||||||
conv::map_format(info.format).unwrap(),
|
conv::map_format(info.format).unwrap(),
|
||||||
|
conv::map_tiling(info.tiling),
|
||||||
conv::map_image_usage(info.usage),
|
conv::map_image_usage(info.usage),
|
||||||
unsafe { mem::transmute(info.flags) },
|
unsafe { mem::transmute(info.flags) },
|
||||||
)
|
)
|
||||||
|
@ -1764,7 +1779,9 @@ pub extern "C" fn gfxCreateDescriptorSetLayout(
|
||||||
let bindings = layout_bindings
|
let bindings = layout_bindings
|
||||||
.iter()
|
.iter()
|
||||||
.map(|binding| {
|
.map(|binding| {
|
||||||
assert!(binding.pImmutableSamplers.is_null()); // TODO
|
if !binding.pImmutableSamplers.is_null() {
|
||||||
|
warn!("immutable samplers are not supported yet");
|
||||||
|
}
|
||||||
|
|
||||||
pso::DescriptorSetLayoutBinding {
|
pso::DescriptorSetLayoutBinding {
|
||||||
binding: binding.binding as _,
|
binding: binding.binding as _,
|
||||||
|
@ -1798,7 +1815,9 @@ pub extern "C" fn gfxCreateDescriptorPool(
|
||||||
pDescriptorPool: *mut VkDescriptorPool,
|
pDescriptorPool: *mut VkDescriptorPool,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
let info = unsafe { &*pCreateInfo };
|
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 {
|
let pool_sizes = unsafe {
|
||||||
slice::from_raw_parts(info.pPoolSizes, info.poolSizeCount as _)
|
slice::from_raw_parts(info.pPoolSizes, info.poolSizeCount as _)
|
||||||
|
@ -1864,12 +1883,13 @@ pub extern "C" fn gfxAllocateDescriptorSets(
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub extern "C" fn gfxFreeDescriptorSets(
|
pub extern "C" fn gfxFreeDescriptorSets(
|
||||||
device: VkDevice,
|
_device: VkDevice,
|
||||||
descriptorPool: VkDescriptorPool,
|
_descriptorPool: VkDescriptorPool,
|
||||||
descriptorSetCount: u32,
|
_descriptorSetCount: u32,
|
||||||
pDescriptorSets: *const VkDescriptorSet,
|
_pDescriptorSets: *const VkDescriptorSet,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
unimplemented!()
|
error!("gfxFreeDescriptorSets not implemented");
|
||||||
|
VkResult::VK_NOT_READY
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub extern "C" fn gfxUpdateDescriptorSets(
|
pub extern "C" fn gfxUpdateDescriptorSets(
|
||||||
|
|
Loading…
Reference in a new issue