freedreno: Only upload UBO pointers for UBOs that haven't been lowered.
authorEric Anholt <eric@anholt.net>
Wed, 5 Jun 2019 22:39:22 +0000 (15:39 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 22 Jun 2019 00:14:43 +0000 (17:14 -0700)
total constlen in shared programs: 2485933 -> 2462236 (-0.95%)

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/freedreno/ir3/ir3_nir.c

index cb97a2202ed667db3044ab4985824b9d30c2e09c..1ef47aa3e069f348e65ddc53e19a7c1edf53f512 100644 (file)
@@ -328,6 +328,13 @@ ir3_nir_scan_driver_consts(nir_shader *shader,
                                                layout->image_dims.count;
                                        layout->image_dims.count += 3; /* three const per */
                                        break;
+                               case nir_intrinsic_load_ubo:
+                                       if (nir_src_is_const(intr->src[0])) {
+                                               layout->num_ubos = MAX2(layout->num_ubos,
+                                                               nir_src_as_uint(intr->src[0]) + 1);
+                                       } else {
+                                               layout->num_ubos = shader->info.num_ubos;
+                                       }
                                default:
                                        break;
                                }
@@ -347,7 +354,6 @@ ir3_setup_const_state(struct ir3_shader *shader, nir_shader *nir)
        ir3_nir_scan_driver_consts(nir, const_state);
 
        const_state->num_uniforms = nir->num_uniforms;
-       const_state->num_ubos = nir->info.num_ubos;
 
        debug_assert((shader->ubo_state.size % 16) == 0);
        unsigned constoff = align(shader->ubo_state.size / 16, 4);