mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
vulkan: fix C2099 error with VS2019
As VK_FORMAT_FEATURE_2_xxx are defined as static const variable, the vscoce C compiler prevents the initialization of the vk_usage_map structure with error "C2099: initializer is not a constant". Init the structure separately. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
This commit is contained in:
parent
759857c203
commit
6920166af4
1 changed files with 26 additions and 18 deletions
|
@ -509,32 +509,40 @@ gst_vulkan_format_from_video_info (GstVideoInfo * v_info, guint plane)
|
|||
}
|
||||
|
||||
#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 195)
|
||||
/* *INDENT-OFF* */
|
||||
const static struct {
|
||||
VkFormatFeatureFlagBits2KHR feature;
|
||||
|
||||
struct vkUsage
|
||||
{
|
||||
const VkFormatFeatureFlagBits2 feature;
|
||||
VkImageUsageFlags usage;
|
||||
} vk_usage_map[] = {
|
||||
{ VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR, VK_IMAGE_USAGE_SAMPLED_BIT },
|
||||
{ VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR, VK_IMAGE_USAGE_TRANSFER_SRC_BIT },
|
||||
{ VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR, VK_IMAGE_USAGE_TRANSFER_DST_BIT },
|
||||
{ VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR, VK_IMAGE_USAGE_STORAGE_BIT },
|
||||
{ VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT },
|
||||
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
|
||||
{ VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR, VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR },
|
||||
{ VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR, VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR },
|
||||
#ifdef VK_ENABLE_BETA_EXTENSIONS
|
||||
{ VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR, VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR },
|
||||
{ VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR, VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR },
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static VkImageUsageFlags
|
||||
_get_usage (guint64 feature)
|
||||
{
|
||||
int i;
|
||||
VkImageUsageFlags usage = 0;
|
||||
/* *INDENT-OFF* */
|
||||
const struct vkUsage vk_usage_map[] = {
|
||||
{VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR, VK_IMAGE_USAGE_SAMPLED_BIT},
|
||||
{VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR, VK_IMAGE_USAGE_TRANSFER_SRC_BIT},
|
||||
{VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR, VK_IMAGE_USAGE_TRANSFER_DST_BIT},
|
||||
{VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR, VK_IMAGE_USAGE_STORAGE_BIT},
|
||||
{VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR,
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT},
|
||||
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
|
||||
{VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR,
|
||||
VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR},
|
||||
{VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR,
|
||||
VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR},
|
||||
#ifdef VK_ENABLE_BETA_EXTENSIONS
|
||||
{VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR,
|
||||
VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR},
|
||||
{VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR,
|
||||
VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vk_usage_map); i++) {
|
||||
if (vk_usage_map[i].feature & feature)
|
||||
|
|
Loading…
Reference in a new issue