nir/algebraic: trivially enable existing 32-bit patterns for all bit sizes
[mesa.git] / src / compiler / nir / nir_lower_uniforms_to_ubo.c
index 565410cf0cc0cef79bc9237b8aed993a8d78207a..bdee9e927cbf11f4e2cbd04033096c8d2ff6ecb8 100644 (file)
@@ -103,8 +103,31 @@ nir_lower_uniforms_to_ubo(nir_shader *shader, int multiplier)
       }
    }
 
+   if (progress) {
+      if (!shader->info.first_ubo_is_default_ubo) {
+         nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo)
+            var->data.binding++;
+      }
+      shader->info.num_ubos++;
+
+      if (shader->num_uniforms > 0) {
+         const struct glsl_type *type = glsl_array_type(glsl_vec4_type(),
+                                                        shader->num_uniforms, 0);
+         nir_variable *ubo = nir_variable_create(shader, nir_var_mem_ubo, type,
+                                                 "uniform_0");
+         ubo->data.binding = 0;
+
+         struct glsl_struct_field field = {
+            .type = type,
+            .name = "data",
+            .location = -1,
+         };
+         ubo->interface_type =
+               glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                                   false, "__ubo0_interface");
+      }
+   }
+
    shader->info.first_ubo_is_default_ubo = true;
    return progress;
 }
-
-