aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-05-16 15:00:23 +0100
committerJosé Fonseca <[email protected]>2012-05-16 15:00:23 +0100
commit9af1ba565dfd5cef9ee938bb7c04767d14878fbf (patch)
tree216f1c22bcdafa496ded08d0fe4b059173a6f791 /src/gallium/auxiliary/draw
parent982df3c1a5e99e43f28f849419d4379e6e5d5d05 (diff)
draw,llvmpipe: Avoid named struct types on LLVM 3.0 and later.
Starting with LLVM 3.0, named structures are meant not for debugging, but for recursive data types, previously also known as opaque types. The recursive nature of these types leads to several memory management difficulties. Given that we don't actually need recursive types, avoid them altogether. This is an attempt to address fdo bugs 41791 and 44466. The issue is somewhat random so there's no easy way to check how effective this is.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 7bf9d5e5d7a..4058e1194b0 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -123,14 +123,10 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
-#if HAVE_LLVM >= 0x0300
- texture_type = LLVMStructCreateNamed(gallivm->context, struct_name);
- LLVMStructSetBody(texture_type, elem_types,
- Elements(elem_types), 0);
-#else
texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
+#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, struct_name, texture_type);
/* Make sure the target's struct layout cache doesn't return
@@ -201,13 +197,9 @@ create_jit_context_type(struct gallivm_state *gallivm,
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
PIPE_MAX_VERTEX_SAMPLERS); /* textures */
-#if HAVE_LLVM >= 0x0300
- context_type = LLVMStructCreateNamed(gallivm->context, struct_name);
- LLVMStructSetBody(context_type, elem_types,
- Elements(elem_types), 0);
-#else
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
+#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, struct_name, context_type);
LLVMInvalidateStructLayout(gallivm->target, context_type);
@@ -244,13 +236,9 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm, const char *struct_
elem_types[2] =
elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */
-#if HAVE_LLVM >= 0x0300
- vb_type = LLVMStructCreateNamed(gallivm->context, struct_name);
- LLVMStructSetBody(vb_type, elem_types,
- Elements(elem_types), 0);
-#else
vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
+#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, struct_name, vb_type);
LLVMInvalidateStructLayout(gallivm->target, vb_type);
@@ -285,13 +273,9 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
elem_types[DRAW_JIT_VERTEX_PRE_CLIP_POS] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
elem_types[DRAW_JIT_VERTEX_DATA] = LLVMArrayType(elem_types[1], data_elems);
-#if HAVE_LLVM >= 0x0300
- vertex_header = LLVMStructCreateNamed(gallivm->context, struct_name);
- LLVMStructSetBody(vertex_header, elem_types,
- Elements(elem_types), 0);
-#else
vertex_header = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
+#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, struct_name, vertex_header);
LLVMInvalidateStructLayout(gallivm->target, vertex_header);