From bcb8dd743278f4cff693b4e54515bd220986bdc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Thu, 20 Aug 2020 11:51:41 +0200 Subject: [PATCH] broadcom/common: increase V3D_MAX_TEXTURE_SAMPLERS, add specific OpenGL limit This is needed due Vulkan because by spec (31.1. Limit Requirements) the minimum value for the following limits are the following ones: maxPerStageDescriptorSampledImages 16 maxPerStageDescriptorStorageImages 4 maxPerStageDescriptorInputAttachments 4 And we are using v3d textures for all of them, so current limit would not be enough for some cases. Note that as the current comment explains there is not exactly a HW limit for it, so we could bump to 32 for example, but let's just be conservative and ask the minimum required. It is worth to note that we needed to maintain the same value for the OpenGL case, as it gets a register allocation failure on some GL cases. We tried to fix that with small changes on the nir scheduler, but we found that it would require some non-trivial effort to get it done (that eventually we would need to). Fixes tests like: dEQP-VK.binding_model.descriptorset_random.sets16.constant.ubolimitlow.sbolimitlow.imglimitlow.noiub.uab.comp.noia.0 v2: keep the previous limit for Opengl (Eric) Reviewed-by: Eric Anholt Part-of: --- src/broadcom/common/v3d_limits.h | 13 ++++++++++++- src/gallium/drivers/v3d/v3d_screen.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/broadcom/common/v3d_limits.h b/src/broadcom/common/v3d_limits.h index e02582035f1..66b1fcc5b5f 100644 --- a/src/broadcom/common/v3d_limits.h +++ b/src/broadcom/common/v3d_limits.h @@ -36,10 +36,21 @@ V3D_MAX_GS_INPUTS, \ V3D_MAX_FS_INPUTS) +/* For now we need to maintain a different limits for OpenGL and Vulkan due + * some OpenGL CTS tests hitting register allocation when trying to use all + * the texture available. + * + * FIXME: nir_schedule should be able to handle that. When fixed it would be + * simpler to keep just one limit + */ +#define V3D_VULKAN_MAX_TEXTURE_SAMPLERS 24 +#define V3D_OPENGL_MAX_TEXTURE_SAMPLERS 16 + /* Not specifically a hardware limit, just coordination between compiler and * driver. */ -#define V3D_MAX_TEXTURE_SAMPLERS 16 +#define V3D_MAX_TEXTURE_SAMPLERS MAX2(V3D_VULKAN_MAX_TEXTURE_SAMPLERS, \ + V3D_OPENGL_MAX_TEXTURE_SAMPLERS) /* The HW can do 16384 (15), but we run into hangs when we expose that. */ #define V3D_MAX_MIP_LEVELS 13 diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 63309e9c8d1..e45a684117e 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -387,7 +387,7 @@ v3d_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: - return V3D_MAX_TEXTURE_SAMPLERS; + return V3D_OPENGL_MAX_TEXTURE_SAMPLERS; case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS: if (screen->has_cache_flush) {