etnaviv: dynamically partition the constant memory in unfied uniform mode
Unified uniform mode allows to dynamically partition the constant memory by specifying the start of VS and FS constants within the memory area. Use this to place the FS uniforms directly behind the VS uniforms, potentially making more space available to FS uniforms. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32983>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user