rendervulkan: build list of supported wl_shm formats

This commit is contained in:
Simon Ser 2021-02-09 11:24:26 +01:00
parent a325cf193b
commit 6fbabb94b3

View file

@ -116,6 +116,7 @@ std::vector< VulkanSamplerCacheEntry_t > g_vecVulkanSamplerCache;
VulkanTexture_t g_emptyTex;
static std::map< VkFormat, std::map< uint64_t, VkDrmFormatModifierPropertiesEXT > > DRMModifierProps = {};
static std::vector< uint32_t > sampledShmFormats{};
static struct wlr_drm_format_set sampledDRMFormats = {};
static LogScope vk_log("vulkan");
@ -759,6 +760,8 @@ bool vulkan_init_formats()
continue;
}
sampledShmFormats.push_back( drmFormat );
if ( !g_vulkanSupportsModifiers )
{
if ( BIsNested() == false && !wlr_drm_format_set_has( &g_DRM.formats, drmFormat, DRM_FORMAT_MOD_INVALID ) )
@ -2349,8 +2352,8 @@ static void renderer_render_quad_with_matrix( struct wlr_renderer *renderer, con
static const uint32_t *renderer_get_shm_texture_formats( struct wlr_renderer *wlr_renderer, size_t *len
)
{
VulkanRenderer_t *renderer = (VulkanRenderer_t *) wlr_renderer;
return wlr_renderer_get_shm_texture_formats( renderer->parent, len );
*len = sampledShmFormats.size();
return sampledShmFormats.data();
}
static struct wlr_texture *renderer_texture_from_pixels( struct wlr_renderer *wlr_renderer, uint32_t shmFormat, uint32_t stride, uint32_t width, uint32_t height, const void *src )