Mesa (master): draw: Do not use LLVM's opaque types.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jan 24 17:27:27 UTC 2011


Module: Mesa
Branch: master
Commit: 92badb4c8c6f603ff823d4aeb87c27582648ba6d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=92badb4c8c6f603ff823d4aeb87c27582648ba6d

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Jan 24 09:48:45 2011 +0000

draw: Do not use LLVM's opaque types.

Contrary what the name may suggest, LLVM's opaque types are used for
recursive types -- types whose definition refers itself -- so opaque
types correspond to pre-declaring a structure in C. E.g.:

   struct node;

   struct link {
      ....
      struct node *next;
   };

   struct node {
      struct link link;
   }

Void pointers are also disallowed by LLVM. So the suggested way of creating
what's commonly referred as "opaque pointers" is using byte pointer (i.e.,
uint8_t * ).

---

 src/gallium/auxiliary/draw/draw_llvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 0c51aa8..a73bdd7 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -220,7 +220,7 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm)
    elem_types[0] =
    elem_types[1] =
    elem_types[2] = LLVMInt32TypeInContext(gallivm->context);
-   elem_types[3] = LLVMPointerType(LLVMOpaqueTypeInContext(gallivm->context), 0); /* vs_constants */
+   elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */
 
    vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
                                      Elements(elem_types), 0);




More information about the mesa-commit mailing list