From 89b2229c0df4725d6397ee428567ce848a4d9398 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 12 Jan 2025 16:57:52 +0100 Subject: [PATCH] etnaviv: memcpy varying setup from stack Use memcpy to transfer the varying setup from stack arrays into the compiled shader state. Resulting code is less verbose and the compiler is smart enough to optimize away the function call anyway. Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_shader.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 71790459f97..9b1617da92b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -244,12 +244,8 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs, cs->GL_VARYING_TOTAL_COMPONENTS = VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM(align(total_components, 2)); - cs->GL_VARYING_NUM_COMPONENTS[0] = num_components[0]; - cs->GL_VARYING_NUM_COMPONENTS[1] = num_components[1]; - cs->GL_VARYING_COMPONENT_USE[0] = component_use[0]; - cs->GL_VARYING_COMPONENT_USE[1] = component_use[1]; - cs->GL_VARYING_COMPONENT_USE[2] = component_use[2]; - cs->GL_VARYING_COMPONENT_USE[3] = component_use[3]; + memcpy(cs->GL_VARYING_NUM_COMPONENTS, num_components, sizeof(uint32_t) * 2); + memcpy(cs->GL_VARYING_COMPONENT_USE, component_use, sizeof(uint32_t) * 4); cs->GL_HALTI5_SH_SPECIALS = 0x7f7f0000 | /* unknown bits, probably other PS inputs */