From 0eb588a37cc0427fd5c6a1ed2b212ed5d68f4dab Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 29 Jan 2013 08:39:09 -0800 Subject: draw: fix draw_llvm_variant_key struct padding to avoid recompiles The struct padding got broken by c789b981b244333cfc903bcd1e2fefc010500013. This caused serious performance regression because part of the key was uninitialized and hence the shader always recompiled (at least on release builds...). While here also fix key size calculation when the number of samplers and the number of sampler views are different. v2: add comment Reviewed-by: Jose Fonseca Reviewed-by: Brian Paul --- src/gallium/auxiliary/draw/draw_llvm.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/draw/draw_llvm.h') diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index a664857..17ca304 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -206,8 +206,13 @@ struct draw_llvm_variant_key unsigned clip_halfz:1; unsigned bypass_viewport:1; unsigned need_edgeflags:1; + /* + * it is important there are no holes in this struct + * (and all padding gets zeroed). + */ + unsigned pad1:1; unsigned ucp_enable:PIPE_MAX_CLIP_PLANES; - unsigned pad:33-PIPE_MAX_CLIP_PLANES; + unsigned pad2:32-PIPE_MAX_CLIP_PLANES; /* Variable number of vertex elements: */ -- cgit v1.1