summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.h30
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_conv.c14
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_format.c16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_printf.c15
5 files changed, 8 insertions, 70 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 8dee0413019..8d06e65725f 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -169,36 +169,6 @@ typedef void
uint32_t *counter);
-/** cast wrapper to avoid compiler warnings */
-static INLINE lp_jit_frag_func
-cast_voidptr_to_lp_jit_frag_func(void *v)
-{
- union {
- void *v;
- lp_jit_frag_func f;
- } u;
- assert(sizeof(u.v) == sizeof(u.f));
- u.v = v;
- return u.f;
-}
-
-
-/** cast wrapper */
-static INLINE void *
-cast_lp_jit_frag_func_to_voidptr(lp_jit_frag_func f)
-{
- union {
- void *v;
- lp_jit_frag_func f;
- } u;
- assert(sizeof(u.v) == sizeof(u.f));
- u.f = f;
- return u.v;
-}
-
-
-
-
void
lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index a7e7451983e..0e5fd179743 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -64,6 +64,7 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
+#include "util/u_pointer.h"
#include "util/u_format.h"
#include "util/u_dump.h"
#include "os/os_time.h"
@@ -873,7 +874,7 @@ generate_fragment(struct llvmpipe_context *lp,
{
void *f = LLVMGetPointerToGlobal(screen->engine, function);
- variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f);
+ variant->jit_function[do_tri_test] = (lp_jit_frag_func)pointer_to_func(f);
if (gallivm_debug & GALLIVM_DEBUG_ASM) {
lp_disassemble(f);
diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c
index 254f0daea3b..cb0d02ab32c 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_conv.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c
@@ -34,6 +34,7 @@
*/
+#include "util/u_pointer.h"
#include "gallivm/lp_bld_type.h"
#include "gallivm/lp_bld_const.h"
#include "gallivm/lp_bld_conv.h"
@@ -43,17 +44,6 @@
typedef void (*conv_test_ptr_t)(const void *src, const void *dst);
-/** cast wrapper */
-static conv_test_ptr_t
-voidptr_to_conv_test_ptr_t(void *p)
-{
- union {
- void *v;
- conv_test_ptr_t f;
- } u;
- u.v = p;
- return u.f;
-}
void
write_tsv_header(FILE *fp)
@@ -234,7 +224,7 @@ test_one(unsigned verbose,
LLVMDumpModule(module);
code = LLVMGetPointerToGlobal(engine, func);
- conv_test_ptr = voidptr_to_conv_test_ptr_t(code);
+ conv_test_ptr = (conv_test_ptr_t)pointer_to_func(code);
if(verbose >= 2)
lp_disassemble(code);
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
index e5f8bf96330..7c0d7d2e656 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
@@ -37,6 +37,7 @@
#include <llvm-c/Transforms/Scalar.h>
#include "util/u_memory.h"
+#include "util/u_pointer.h"
#include "util/u_format.h"
#include "util/u_format_tests.h"
#include "util/u_format_s3tc.h"
@@ -73,19 +74,6 @@ typedef void
(*fetch_ptr_t)(float *, const void *packed,
unsigned i, unsigned j);
-/** cast wrapper to avoid warnings */
-static fetch_ptr_t
-void_to_fetch_ptr_t(void *p)
-{
- union {
- void *v;
- fetch_ptr_t f;
- } u;
- u.v = p;
- return u.f;
-}
-
-
static LLVMValueRef
add_fetch_rgba_test(LLVMModuleRef lp_build_module,
@@ -162,7 +150,7 @@ test_format(unsigned verbose, FILE *fp,
(void)pass;
#endif
- fetch_ptr = void_to_fetch_ptr_t(LLVMGetPointerToGlobal(lp_build_engine, fetch));
+ fetch_ptr = (fetch_ptr_t)pointer_to_func(LLVMGetPointerToGlobal(lp_build_engine, fetch));
for (i = 0; i < desc->block.height; ++i) {
for (j = 0; j < desc->block.width; ++j) {
diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c
index 13485c37748..d99ca816387 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_printf.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "util/u_pointer.h"
#include "gallivm/lp_bld.h"
#include "gallivm/lp_bld_printf.h"
@@ -58,18 +59,6 @@ write_tsv_header(FILE *fp)
typedef void (*test_printf_t)(int i);
-/** cast wrapper */
-static test_printf_t
-voidptr_to_test_printf_t(void *p)
-{
- union {
- void *v;
- test_printf_t f;
- } u;
- u.v = p;
- return u.f;
-}
-
static LLVMValueRef
add_printf_test(LLVMModuleRef module)
@@ -140,7 +129,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
#endif
code = LLVMGetPointerToGlobal(engine, test);
- test_printf = voidptr_to_test_printf_t(code);
+ test_printf = (test_printf_t)pointer_to_func(code);
memset(unpacked, 0, sizeof unpacked);
packed = 0;