Module: Mesa Branch: master Commit: b44c48fd2121986d42d3faeb64027082cadccc51 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b44c48fd2121986d42d3faeb64027082cadccc51
Author: Mike Blumenkrantz <[email protected]> Date: Wed Oct 7 12:46:38 2020 -0400 zink: use pre-fetched format properties everywhere this is a noticeable perf improvement Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9293> --- src/gallium/drivers/zink/zink_resource.c | 6 ++---- src/gallium/drivers/zink/zink_screen.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index a1830429af9..4f4845df8bc 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -153,8 +153,7 @@ resource_create(struct pipe_screen *pscreen, VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT; - VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(screen->pdev, zink_get_format(screen, templ->format), &props); + VkFormatProperties props = screen->format_props[templ->format]; if (props.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT) bci.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT; } @@ -260,8 +259,7 @@ resource_create(struct pipe_screen *pscreen, if ((templ->nr_samples <= 1 || screen->info.feats.features.shaderStorageImageMultisample) && (templ->bind & PIPE_BIND_SHADER_IMAGE || (templ->bind & PIPE_BIND_SAMPLER_VIEW && templ->flags & PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY))) { - VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(screen->pdev, res->format, &props); + VkFormatProperties props = screen->format_props[templ->format]; /* gallium doesn't provide any way to actually know whether this will be used as a shader image, * so we have to just assume and set the bit if it's available */ diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 42eb3a25c9d..7624c828ab1 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -775,8 +775,7 @@ zink_is_format_supported(struct pipe_screen *pscreen, } } - VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(screen->pdev, vkformat, &props); + VkFormatProperties props = screen->format_props[format]; if (target == PIPE_BUFFER) { if (bind & PIPE_BIND_VERTEX_BUFFER && _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
