freedreno/ir3: fix lowered ubo region alignment
authorRob Clark <robdclark@chromium.org>
Thu, 2 May 2019 16:25:36 +0000 (09:25 -0700)
committerRob Clark <robdclark@chromium.org>
Thu, 2 May 2019 18:19:22 +0000 (11:19 -0700)
Since we emit UBO regions INDIRECTly (ie. not copied into cmdstream but
emit by EXT_SRC_ADDR) we need to keep them 4*vec4 aligned.  Which the
code already mostly did, except for aligning the first UBO region itself
(ie. the one after block==0 which is the "real" uniforms).

Fixes: 893425a607a freedreno/ir3: Push UBOs to constant file
Fixes: 3c8779af325 freedreno/ir3: Enable PIPE_CAP_PACKED_UNIFORMS
Signed-off-by: Rob Clark <robdclark@chromium.org>
src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c

index aaa2a8684a2d7dc000e40c0b0144cbf597781d04..a79b1a30bf9829a43143ff49be12e1d0b7e6fd35 100644 (file)
@@ -126,7 +126,7 @@ ir3_nir_analyze_ubo_ranges(nir_shader *nir, struct ir3_shader *shader)
        struct ir3_ubo_analysis_state *state = &shader->ubo_state;
 
        memset(state, 0, sizeof(*state));
-       state->range[0].end = nir->num_uniforms * 16;
+       state->range[0].end = align(nir->num_uniforms * 16, 16 * 4); /* align to 4*vec4 */
 
        nir_foreach_function(function, nir) {
                if (function->impl) {