diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index 42e3329c3e9..50fd8903476 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -714,7 +714,7 @@ etna_emit_state(struct etna_context *ctx) if (screen->specs.has_unified_uniforms) { etna_set_state(stream, VIVS_VS_UNIFORM_BASE, 0); - etna_set_state(stream, VIVS_PS_UNIFORM_BASE, screen->specs.max_vs_uniforms); + etna_set_state(stream, VIVS_PS_UNIFORM_BASE, ctx->shader.vs->uniforms.count / 4); } if (do_uniform_flush) diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 186689e6f30..3cebd36bc02 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -907,17 +907,13 @@ etna_get_specs(struct etna_screen *screen) if (screen->info->halti >= 5) { screen->specs.has_unified_uniforms = true; screen->specs.vs_uniforms_offset = VIVS_SH_HALTI5_UNIFORMS_MIRROR(0); - screen->specs.ps_uniforms_offset = VIVS_SH_HALTI5_UNIFORMS(screen->specs.max_vs_uniforms*4); + screen->specs.ps_uniforms_offset = VIVS_SH_HALTI5_UNIFORMS(0); } else if (screen->info->halti >= 1) { /* unified uniform memory on GC3000 - HALTI1 feature bit is just a guess */ screen->specs.has_unified_uniforms = true; screen->specs.vs_uniforms_offset = VIVS_SH_UNIFORMS(0); - /* hardcode PS uniforms to start after end of VS uniforms - - * for more flexibility this offset could be variable based on the - * shader. - */ - screen->specs.ps_uniforms_offset = VIVS_SH_UNIFORMS(screen->specs.max_vs_uniforms*4); + screen->specs.ps_uniforms_offset = VIVS_SH_UNIFORMS(0); } else { screen->specs.has_unified_uniforms = false; screen->specs.vs_uniforms_offset = VIVS_VS_UNIFORMS(0); diff --git a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c index 74d4f9aeed3..ef8b54783d1 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c +++ b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c @@ -118,6 +118,9 @@ etna_uniforms_write(const struct etna_context *ctx, bool frag = (sobj == ctx->shader.fs); uint32_t base = frag ? screen->specs.ps_uniforms_offset : screen->specs.vs_uniforms_offset; + if (screen->specs.has_unified_uniforms && frag) + base += ctx->shader.vs->uniforms.count * 4; + if (!uinfo->count) return;