mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Support DXGI_FORMAT_B4G4R4A4_UNORM.
This commit is contained in:
parent
8879521679
commit
742288127f
Notes:
Alexandre Julliard
2024-04-17 23:29:57 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/788
@ -5427,6 +5427,13 @@ static const struct vkd3d_format *vkd3d_fixup_clear_uav_uint_colour(struct d3d12
|
||||
| ((colour->uint32[3] & 0x1) << 15);
|
||||
return vkd3d_get_format(device, DXGI_FORMAT_R16_UINT, false);
|
||||
|
||||
case DXGI_FORMAT_B4G4R4A4_UNORM:
|
||||
colour->uint32[0] = (colour->uint32[2] & 0xf)
|
||||
| ((colour->uint32[1] & 0xf) << 4)
|
||||
| ((colour->uint32[0] & 0xf) << 8)
|
||||
| ((colour->uint32[3] & 0xf) << 12);
|
||||
return vkd3d_get_format(device, DXGI_FORMAT_R16_UINT, false);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
|
||||
VK_EXTENSION(KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE, KHR_sampler_mirror_clamp_to_edge),
|
||||
VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore),
|
||||
/* EXT extensions */
|
||||
VK_EXTENSION(EXT_4444_FORMATS, EXT_4444_formats),
|
||||
VK_EXTENSION(EXT_CALIBRATED_TIMESTAMPS, EXT_calibrated_timestamps),
|
||||
VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering),
|
||||
VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker),
|
||||
@ -810,6 +811,7 @@ struct vkd3d_physical_device_info
|
||||
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features;
|
||||
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features;
|
||||
VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT mutable_features;
|
||||
VkPhysicalDevice4444FormatsFeaturesEXT formats4444_features;
|
||||
|
||||
VkPhysicalDeviceFeatures2 features2;
|
||||
};
|
||||
@ -833,6 +835,7 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
|
||||
VkPhysicalDeviceMaintenance3Properties *maintenance3_properties;
|
||||
VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb_properties;
|
||||
VkPhysicalDevice physical_device = device->vk_physical_device;
|
||||
VkPhysicalDevice4444FormatsFeaturesEXT *formats4444_features;
|
||||
VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb_features;
|
||||
struct vkd3d_vulkan_info *vulkan_info = &device->vk_info;
|
||||
|
||||
@ -851,6 +854,7 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
|
||||
vertex_divisor_properties = &info->vertex_divisor_properties;
|
||||
timeline_semaphore_features = &info->timeline_semaphore_features;
|
||||
mutable_features = &info->mutable_features;
|
||||
formats4444_features = &info->formats4444_features;
|
||||
xfb_features = &info->xfb_features;
|
||||
xfb_properties = &info->xfb_properties;
|
||||
|
||||
@ -878,6 +882,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
|
||||
vk_prepend_struct(&info->features2, timeline_semaphore_features);
|
||||
mutable_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT;
|
||||
vk_prepend_struct(&info->features2, mutable_features);
|
||||
formats4444_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT;
|
||||
vk_prepend_struct(&info->features2, formats4444_features);
|
||||
|
||||
if (vulkan_info->KHR_get_physical_device_properties2)
|
||||
VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2));
|
||||
@ -1667,6 +1673,8 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
||||
if (!physical_device_info->timeline_semaphore_features.timelineSemaphore)
|
||||
vulkan_info->KHR_timeline_semaphore = false;
|
||||
|
||||
physical_device_info->formats4444_features.formatA4B4G4R4 = VK_FALSE;
|
||||
|
||||
vulkan_info->texel_buffer_alignment_properties = physical_device_info->texel_buffer_alignment_properties;
|
||||
|
||||
if (get_spec_version(vk_extensions, count, VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME) >= 3)
|
||||
|
@ -118,6 +118,9 @@ static const struct vkd3d_format vkd3d_formats[] =
|
||||
{DXGI_FORMAT_BC7_UNORM_SRGB, VK_FORMAT_BC7_SRGB_BLOCK, 1, 4, 4, 16, COLOR, 1},
|
||||
};
|
||||
|
||||
static const struct vkd3d_format format_b4g4r4a4 =
|
||||
{DXGI_FORMAT_B4G4R4A4_UNORM, VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT, 2, 1, 1, 1, COLOR, 1};
|
||||
|
||||
/* Each depth/stencil format is only compatible with itself in Vulkan. */
|
||||
static const struct vkd3d_format vkd3d_depth_stencil_formats[] =
|
||||
{
|
||||
@ -451,6 +454,11 @@ const struct vkd3d_format *vkd3d_get_format(const struct d3d12_device *device,
|
||||
return &vkd3d_formats[i];
|
||||
}
|
||||
|
||||
/* Do not check VkPhysicalDevice4444FormatsFeaturesEXT because apps
|
||||
* should query format support, which returns more detailed info. */
|
||||
if (dxgi_format == format_b4g4r4a4.dxgi_format && device->vk_info.EXT_4444_formats)
|
||||
return &format_b4g4r4a4;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,7 @@ struct vkd3d_vulkan_info
|
||||
bool KHR_sampler_mirror_clamp_to_edge;
|
||||
bool KHR_timeline_semaphore;
|
||||
/* EXT device extensions */
|
||||
bool EXT_4444_formats;
|
||||
bool EXT_calibrated_timestamps;
|
||||
bool EXT_conditional_rendering;
|
||||
bool EXT_debug_marker;
|
||||
|
@ -542,7 +542,6 @@ static bool is_typed_uav_format_supported(ID3D12Device *device, DXGI_FORMAT form
|
||||
format_support.Format = format;
|
||||
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FORMAT_SUPPORT,
|
||||
&format_support, sizeof(format_support));
|
||||
todo
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
return format_support.Support1 & D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW;
|
||||
@ -955,7 +954,7 @@ static void test_check_feature_support(void)
|
||||
|| format == DXGI_FORMAT_R8G8_B8G8_UNORM
|
||||
|| format == DXGI_FORMAT_G8R8_G8B8_UNORM
|
||||
|| format == DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
|
||||
|| (DXGI_FORMAT_AYUV <= format && format <= DXGI_FORMAT_B4G4R4A4_UNORM);
|
||||
|| (DXGI_FORMAT_AYUV <= format && format <= DXGI_FORMAT_A8P8);
|
||||
|
||||
memset(&format_info, 0, sizeof(format_info));
|
||||
format_info.Format = format;
|
||||
@ -5750,7 +5749,7 @@ static void test_clear_unordered_access_view_image(void)
|
||||
{DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001},
|
||||
{DXGI_FORMAT_B5G6R5_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00000843},
|
||||
{DXGI_FORMAT_B5G5R5A1_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 1}, 0x00008443},
|
||||
{DXGI_FORMAT_B4G4R4A4_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 1}, 0x00001123, false, true, true},
|
||||
{DXGI_FORMAT_B4G4R4A4_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 1}, 0x00001123, false, false, true},
|
||||
/* Test float clears with formats. */
|
||||
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
|
||||
{0x3e800000 /* 0.25f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff4000, true},
|
||||
@ -5771,7 +5770,7 @@ static void test_clear_unordered_access_view_image(void)
|
||||
0xc104, true},
|
||||
{DXGI_FORMAT_B4G4R4A4_UNORM, 1, 1, 0, 0, 1, 0, {},
|
||||
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0x40000000 /* 2.0f */, 0x40000000 /* -1.0f */},
|
||||
0xf8ff, true, true, true},
|
||||
0xf8ff, true, false, true},
|
||||
};
|
||||
|
||||
static const struct
|
||||
|
Loading…
Reference in New Issue
Block a user