summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-01-12 18:47:44 +0100
committerRoland Scheidegger <[email protected]>2016-01-13 02:43:04 +0100
commit9422999e4041d4e984acbd2f44813d5928d20f18 (patch)
tree5ecb3dd529bc6aef99b465bd519058327ba9c88d /src/gallium/auxiliary/draw/draw_llvm.c
parent6143e2d65168a628aeb54db4cfecd1bb1d53b8aa (diff)
draw: fix key comparison with uninitialized value
Discovered by accident, valgrind was complaining (could have possibly caused us to create redundant geometry shader variants). v2: convinced by Brian and Jose, just use memset for both gs and vs keys, just as easy and less error prone.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index f25dafef954..142d78ae49d 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1861,6 +1861,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key = (struct draw_llvm_variant_key *)store;
+ memset(key, 0, offsetof(struct draw_llvm_variant_key, vertex_element[0]));
+
key->clamp_vertex_color = llvm->draw->rasterizer->clamp_vertex_color; /**/
/* Presumably all variants of the shader should have the same
@@ -1883,7 +1885,6 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable;
key->has_gs = llvm->draw->gs.geometry_shader != NULL;
key->num_outputs = draw_total_vs_outputs(llvm->draw);
- key->pad1 = 0;
/* All variants of this shader will have the same value for
* nr_samplers. Not yet trying to compact away holes in the
@@ -2315,6 +2316,8 @@ draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key = (struct draw_gs_llvm_variant_key *)store;
+ memset(key, 0, offsetof(struct draw_gs_llvm_variant_key, samplers[0]));
+
key->num_outputs = draw_total_gs_outputs(llvm->draw);
/* All variants of this shader will have the same value for