From 29c775e5575c39ea399ec8c2ef7efba5e2d97b73 Mon Sep 17 00:00:00 2001 From: nullprop Date: Wed, 20 Nov 2024 18:15:30 +0200 Subject: [PATCH] rendervulkan: Fix initializing drm formats Gather the supported DRM formats even if backend doesn't use modifiers. --- src/rendervulkan.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp index 54d7608dd..d566bbd12 100644 --- a/src/rendervulkan.cpp +++ b/src/rendervulkan.cpp @@ -2059,7 +2059,7 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, uint32_t depth, uin assert( drmFormat == pDMA->format ); } - if ( GetBackend()->UsesModifiers() && g_device.supportsModifiers() && pDMA && pDMA->modifier != DRM_FORMAT_MOD_INVALID ) + if ( g_device.supportsModifiers() && pDMA && pDMA->modifier != DRM_FORMAT_MOD_INVALID ) { VkExternalImageFormatProperties externalImageProperties = { .sType = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES, @@ -2781,14 +2781,14 @@ bool vulkan_init_format(VkFormat format, uint32_t drmFormat) uint64_t modifier = modifierProps[j].drmFormatModifier; if ( !is_image_format_modifier_supported( format, drmFormat, modifier ) ) - continue; + continue; if ( ( modifierProps[j].drmFormatModifierTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT ) == 0 ) { continue; } - if ( !gamescope::Algorithm::Contains( GetBackend()->GetSupportedModifiers( drmFormat ), modifier ) ) + if ( GetBackend()->UsesModifiers() && !gamescope::Algorithm::Contains( GetBackend()->GetSupportedModifiers( drmFormat ), modifier ) ) continue; wlr_drm_format_set_add( &sampledDRMFormats, drmFormat, modifier ); @@ -2799,7 +2799,7 @@ bool vulkan_init_format(VkFormat format, uint32_t drmFormat) } else { - if ( !GetBackend()->SupportsFormat( drmFormat ) ) + if ( GetBackend()->UsesModifiers() && !GetBackend()->SupportsFormat( drmFormat ) ) return false; wlr_drm_format_set_add( &sampledDRMFormats, drmFormat, DRM_FORMAT_MOD_INVALID );