[Mesa-dev] [PATCH 03/14] mesa: don't include compute resources in MAX_COMBINED_* limits

Marek Olšák maraeo at gmail.com
Wed Aug 8 23:55:12 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

5 is the maximum number of shader stages that can be used by 1 execution
call at the same time (e.g. a draw call). The limit ensures that each
stage can use all of its binding points.

Compute is separate and doesn't need the 5x multiplier.
---
 src/mesa/main/config.h | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index fdf90d8956f..10c3f7d7725 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -163,31 +163,33 @@
  * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader
  * and GLSL shader names for the same thing.  They should \b always have the
  * same value.  Each refers to the number of vec4 values supplied as
  * per-program parameters.
  */
 /*@{*/
 #define MAX_PROGRAM_LOCAL_PARAMS       4096
 #define MAX_UNIFORMS                   4096
 #define MAX_UNIFORM_BUFFERS            15 /* + 1 default uniform buffer */
 #define MAX_SHADER_STORAGE_BUFFERS     16
-/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
-#define MAX_COMBINED_UNIFORM_BUFFERS   (MAX_UNIFORM_BUFFERS * 6)
-#define MAX_COMBINED_SHADER_STORAGE_BUFFERS   (MAX_SHADER_STORAGE_BUFFERS * 6)
+/* 5 is for vertex, hull, domain, geometry, and fragment shader. Don't
+ * include compute.
+ */
+#define MAX_COMBINED_UNIFORM_BUFFERS   (MAX_UNIFORM_BUFFERS * 5)
+#define MAX_COMBINED_SHADER_STORAGE_BUFFERS   (MAX_SHADER_STORAGE_BUFFERS * 5)
 #define MAX_ATOMIC_COUNTERS            4096
-/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
-#define MAX_COMBINED_ATOMIC_BUFFERS    (MAX_UNIFORM_BUFFERS * 6)
+/* 5 is for vertex, hull, domain, geometry, and fragment shader. */
+#define MAX_COMBINED_ATOMIC_BUFFERS    (MAX_UNIFORM_BUFFERS * 5)
 /* Size of an atomic counter in bytes according to ARB_shader_atomic_counters */
 #define ATOMIC_COUNTER_SIZE            4
 #define MAX_IMAGE_UNIFORMS             32
-/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
-#define MAX_IMAGE_UNITS                (MAX_IMAGE_UNIFORMS * 6)
+/* 5 is for vertex, hull, domain, geometry, and fragment shader. */
+#define MAX_IMAGE_UNITS                (MAX_IMAGE_UNIFORMS * 5)
 /*@}*/
 
 /**
  * Per-context constants (power of two)
  *
  * \note
  * This value should always be less than or equal to \c MAX_PROGRAM_LOCAL_PARAMS
  * and \c MAX_VERTEX_PROGRAM_PARAMS.  Otherwise some applications will make
  * incorrect assumptions.
  */
@@ -212,22 +214,24 @@
 /** For GL_ARB_fragment_program */
 /*@{*/
 #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0
 #define MAX_FRAGMENT_PROGRAM_PARAMS       64
 #define MAX_FRAGMENT_PROGRAM_INPUTS       12
 /*@}*/
 
 /** For GL_ARB_vertex_shader */
 /*@{*/
 #define MAX_VERTEX_GENERIC_ATTRIBS 16
-/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
-#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 6)
+/* 5 is the number of shader stages that can be used at the same time.
+ * compute can't be used at the same time as other shaders.
+ */
+#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 5)
 /*@}*/
 
 
 /** For GL_ARB_draw_buffers */
 /*@{*/
 #define MAX_DRAW_BUFFERS 8
 /*@}*/
 
 
 /** For GL_EXT_framebuffer_object */
-- 
2.17.1



More information about the mesa-dev mailing list