From f219b9e14aea02b241d6189e4f2aa856afffbced Mon Sep 17 00:00:00 2001 From: Ian Forbes Date: Fri, 12 Dec 2025 10:01:58 -0600 Subject: [PATCH] svga: Increase max_combined_shader_output_resources and SSBO limit to 16 The gl43 capability indicates we have a DX11.1+ device which supports 64 UAVs shared across all stages. This limit is roughly equivalent to GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES which is controlled by caps.max_combined_shader_output_resources which we currently set to SVGA_MAX_SHADER_BUFFERS (8) which is probably too low since this limit is also supposed to include render targets which we also set to 8. The shader linker will validate that the pipeline does not exceed this combined limit so we don't have to worry about the sum of the max for all stages (16*5=80) now exceeding it. Increasing the combined limt and the number of SSBOs from 8 to 16 allows Blender to run as it requires 12 SSBOs. In theory we could increase the combined limit to 56 but these limits are poorly documented and implemented. Signed-off-by: Ian Forbes --- src/gallium/drivers/svga/svga_context.h | 5 +++-- src/gallium/drivers/svga/svga_shader.h | 8 ++++---- src/gallium/drivers/svga/svga_shader_buffer.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index bbb1d2ae5e9..1a209f76538 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -85,9 +85,10 @@ enum svga_hud { #define CONST0_UPLOAD_ALIGNMENT 256 #define SVGA_MAX_UAVIEWS SVGA3D_DX11_1_MAX_UAVIEWS #define SVGA_MAX_IMAGES SVGA3D_DX11_MAX_UAVIEWS -#define SVGA_MAX_SHADER_BUFFERS SVGA3D_DX11_MAX_UAVIEWS +#define SVGA_MAX_SHADER_BUFFERS 16 #define SVGA_MAX_ATOMIC_BUFFERS SVGA3D_DX11_MAX_UAVIEWS + enum svga_surface_state { SVGA_SURFACE_STATE_CREATED, @@ -365,7 +366,7 @@ struct svga_state /* HW atomic buffers */ unsigned num_atomic_buffers; - struct svga_shader_buffer atomic_buffers[SVGA_MAX_SHADER_BUFFERS]; + struct svga_shader_buffer atomic_buffers[SVGA_MAX_ATOMIC_BUFFERS]; struct { /* Determine the layout of the grid (in block units) to be used. */ diff --git a/src/gallium/drivers/svga/svga_shader.h b/src/gallium/drivers/svga/svga_shader.h index ec81d7be335..4a23ca21b1e 100644 --- a/src/gallium/drivers/svga/svga_shader.h +++ b/src/gallium/drivers/svga/svga_shader.h @@ -131,10 +131,10 @@ struct svga_compile_key unsigned sampler_index:5; } tex[PIPE_MAX_SAMPLERS]; - unsigned uav_splice_index:4; /* starting uav index */ - unsigned srv_raw_constbuf_index:8; /* start index for srv raw buffers */ - unsigned srv_raw_shaderbuf_index:8; /* start index for srv raw shader bufs */ - unsigned image_size_used:1; + uint8_t uav_splice_index; /* starting uav index */ + uint8_t srv_raw_constbuf_index; /* start index for srv raw buffers */ + uint8_t srv_raw_shaderbuf_index; /* start index for srv raw shader bufs */ + bool image_size_used; uint16_t raw_constbufs; /* bitmask of raw constant buffers */ uint64_t raw_shaderbufs; /* bitmask of raw shader buffers */ diff --git a/src/gallium/drivers/svga/svga_shader_buffer.h b/src/gallium/drivers/svga/svga_shader_buffer.h index a6c4774ae97..d77701c093c 100644 --- a/src/gallium/drivers/svga/svga_shader_buffer.h +++ b/src/gallium/drivers/svga/svga_shader_buffer.h @@ -11,8 +11,8 @@ struct svga_shader_buffer { struct pipe_shader_buffer desc; struct pipe_resource *resource; - unsigned uav_index; struct svga_winsys_surface *handle; + unsigned uav_index; bool writeAccess; };