iris: don't trip on param asserts
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 9 Nov 2018 20:49:49 +0000 (12:49 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:10 +0000 (10:26 -0800)
I'd rather not rewrite i965's compute system value handling right now :(

src/gallium/drivers/iris/iris_program.c

index 9634075196e31510f73fbf51c12d7972e95b6bc1..10b41e3e457e7964ac8a276386c7aa741706ec6a 100644 (file)
@@ -415,6 +415,13 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
                     enum brw_param_builtin **out_system_values,
                     unsigned *out_num_system_values)
 {
+   /* We don't use params[], but fs_visitor::nir_setup_uniforms() asserts
+    * about it for compute shaders, so go ahead and make some fake ones
+    * which the backend will dead code eliminate.
+    */
+   prog_data->nr_params = nir->num_uniforms;
+   prog_data->param = rzalloc_array(mem_ctx, uint32_t, prog_data->nr_params);
+
    /* The intel compiler assumes that num_uniforms is in bytes. For
     * scalar that means 4 bytes per uniform slot.
     *
@@ -422,9 +429,6 @@ iris_setup_uniforms(const struct brw_compiler *compiler,
     */
    nir->num_uniforms *= 4;
 
-   prog_data->nr_params = 0;
-   prog_data->param = rzalloc_array(mem_ctx, uint32_t, 1);
-
    const unsigned IRIS_MAX_SYSTEM_VALUES = 32;
    enum brw_param_builtin *system_values =
       rzalloc_array(mem_ctx, enum brw_param_builtin, IRIS_MAX_SYSTEM_VALUES);