ir3, freedreno: Round up constlen earlier
[mesa.git] / src / freedreno / ir3 / ir3_shader.c
index 0fe51e9378ad24e3e5a2ceb57c5e7281fdc97182..5afb5992851a365a318be52f8e781806c2e97354 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "util/u_atomic.h"
 #include "util/u_string.h"
+#include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/format/u_format.h"
 
@@ -140,6 +141,13 @@ void * ir3_shader_assemble(struct ir3_shader_variant *v)
         */
        v->constlen = MAX2(v->constlen, v->info.max_const + 1);
 
+       /* On a4xx and newer, constlen must be a multiple of 16 dwords even though
+        * uploads are in units of 4 dwords. Round it up here to make calculations
+        * regarding the shared constlen simpler.
+        */
+       if (gpu_id >= 400)
+               v->constlen = align(v->constlen, 4);
+
        fixup_regfootprint(v);
 
        return bin;