From d91a549b67f3a13c4763d82e333e50395c300507 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 12 Apr 2021 17:16:12 +0200 Subject: [PATCH] lavapipe: check all vertex-stages We should really check for the minimum of all supported vertex-stages here, not just the vertex-shader. This shouldn't make any real-world difference, because we really only support LLVMpipe here, and that driver has the same limits for all stages. But it seems better to actually check all stages instead of just assuming. Fixes: b38879f8c5f ("vallium: initial import of the vulkan frontend") Reviewed-By: Mike Blumenkrantz Reviewed-by: Eric Anholt Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index b9ecf5b..db68267 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -378,6 +378,21 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_EnumeratePhysicalDeviceGroups( return vk_outarray_status(&out); } +static int +min_vertex_pipeline_param(struct pipe_screen *pscreen, enum pipe_shader_cap param) +{ + int val = INT_MAX; + for (int i = 0; i < PIPE_SHADER_COMPUTE; ++i) { + if (i == PIPE_SHADER_FRAGMENT || + !pscreen->get_shader_param(pscreen, i, + PIPE_SHADER_CAP_MAX_INSTRUCTIONS)) + continue; + + val = MAX2(val, pscreen->get_shader_param(pscreen, i, param)); + } + return val; +} + VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures( VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) @@ -411,7 +426,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures( .textureCompressionBC = true, .occlusionQueryPrecise = true, .pipelineStatisticsQuery = true, - .vertexPipelineStoresAndAtomics = (pdevice->pscreen->get_shader_param(pdevice->pscreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS) != 0), + .vertexPipelineStoresAndAtomics = (min_vertex_pipeline_param(pdevice->pscreen, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS) != 0), .fragmentStoresAndAtomics = (pdevice->pscreen->get_shader_param(pdevice->pscreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS) != 0), .shaderTessellationAndGeometryPointSize = true, .shaderImageGatherExtended = true, -- 2.7.4