replace _mesa_logbase2 with util_logbase2
[mesa.git] / src / mesa / state_tracker / st_nir_lower_builtin.c
index ab74d3183dc49336410e92b8dd43e9da3e1aaef3..4227ee5529a954dc1db0d1bfd0162fb608098004 100644 (file)
@@ -138,7 +138,7 @@ get_variable(lower_builtin_state *state, nir_deref_path *path,
       nir_variable_create(shader, nir_var_uniform, glsl_vec4_type(), name);
 
    var->num_state_slots = 1;
-   var->state_slots = ralloc_array(var, nir_state_slot, 1);
+   var->state_slots = rzalloc_array(var, nir_state_slot, 1);
    memcpy(var->state_slots[0].tokens, tokens,
           sizeof(var->state_slots[0].tokens));
 
@@ -204,12 +204,12 @@ lower_builtin_block(lower_builtin_state *state, nir_block *block)
       nir_ssa_def *def = nir_load_var(b, new_var);
 
       /* swizzle the result: */
-      unsigned swiz[4];
+      unsigned swiz[NIR_MAX_VEC_COMPONENTS] = {0};
       for (unsigned i = 0; i < 4; i++) {
          swiz[i] = GET_SWZ(element->swizzle, i);
          assert(swiz[i] <= SWIZZLE_W);
       }
-      def = nir_swizzle(b, def, swiz, intrin->num_components, true);
+      def = nir_swizzle(b, def, swiz, intrin->num_components);
 
       /* and rewrite uses of original instruction: */
       assert(intrin->dest.is_ssa);