draw: Ensure that the vertex_header type size matches expectation.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 15 Jun 2012 13:02:31 +0000 (14:02 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 18 Jun 2012 11:06:23 +0000 (12:06 +0100)
This is failing sometimes, probably because TargetData keeps a structure layout
cache, which can becomes bogus, ever since the InvalidateStructLayoutInfo API
was removed in LLVM r135245.

This change merely makes the problem easier to diagnose (an assertion
failure instead of a random crash).

src/gallium/auxiliary/draw/draw_llvm.c

index 4058e1194b09bcc4beefda6a436ba0c0a6c25f66..e1df2f1c267bdc86bb5b6e9f5ab0b6753bd2d79a 100644 (file)
@@ -305,6 +305,9 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
                           target, vertex_header,
                           DRAW_JIT_VERTEX_DATA);
 
+   assert(LLVMABISizeOfType(target, vertex_header) ==
+          offsetof(struct vertex_header, data[data_elems]));
+
    return vertex_header;
 }