summaryrefslogtreecommitdiff
path: root/src/gallium/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_compiler.h12
-rw-r--r--src/gallium/include/pipe/p_context.h10
-rw-r--r--src/gallium/include/pipe/p_defines.h8
-rw-r--r--src/gallium/include/pipe/p_format.h8
-rw-r--r--src/gallium/include/pipe/p_inlines.h9
-rw-r--r--src/gallium/include/pipe/p_pointer.h95
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h2
-rw-r--r--src/gallium/include/pipe/p_state.h10
-rw-r--r--src/gallium/include/pipe/p_util.h44
-rw-r--r--src/gallium/include/pipe/p_winsys.h20
10 files changed, 176 insertions, 42 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 30cd729c56..91f3d2ac2d 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -42,6 +42,14 @@
#endif
+#if defined(__MSC__)
+
+/* Avoid 'expression is always true' warning */
+#pragma warning(disable: 4296)
+
+#endif /* __MSC__ */
+
+
typedef unsigned int uint;
typedef unsigned char ubyte;
typedef unsigned char boolean;
@@ -61,8 +69,10 @@ typedef long long int64_t;
typedef unsigned long long uint64_t;
#if defined(_WIN64)
+typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else
+typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 036c4c8964..f69b52f5e3 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -31,6 +31,11 @@
#include "p_state.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct pipe_state_cache;
/* Opaque driver handles:
@@ -226,4 +231,9 @@ struct pipe_context {
unsigned flags );
};
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* PIPE_CONTEXT_H */
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 0bf53ecb79..d84ddbc27a 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -30,6 +30,10 @@
#include "p_format.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define PIPE_BLENDFACTOR_ONE 0x1
#define PIPE_BLENDFACTOR_SRC_COLOR 0x2
#define PIPE_BLENDFACTOR_SRC_ALPHA 0x3
@@ -267,4 +271,8 @@ enum pipe_texture_target {
#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
#define PIPE_CAP_BITMAP_TEXCOORD_BIAS 20
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index c9ad324315..561d2e5921 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -33,6 +33,10 @@
#include "p_compiler.h"
#include "p_debug.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* The PIPE_FORMAT is a 32-bit wide bitfield that encodes all the information
* needed to uniquely describe a pixel format.
@@ -418,4 +422,8 @@ static INLINE uint pf_get_size( enum pipe_format format ) {
return pf_get_bits(format) / 8;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index ebf6ed86bc..de3fa555c5 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -33,6 +33,11 @@
#include "p_winsys.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
static INLINE void *
pipe_surface_map(struct pipe_surface *surface)
{
@@ -109,4 +114,8 @@ pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* P_INLINES_H */
diff --git a/src/gallium/include/pipe/p_pointer.h b/src/gallium/include/pipe/p_pointer.h
new file mode 100644
index 0000000000..3a1e6be88e
--- /dev/null
+++ b/src/gallium/include/pipe/p_pointer.h
@@ -0,0 +1,95 @@
+/**************************************************************************
+ *
+ * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef P_POINTER_H
+#define P_POINTER_H
+
+#include "p_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static INLINE intptr_t
+pointer_to_intptr( const void *p )
+{
+ union {
+ const void *p;
+ intptr_t i;
+ } pi;
+ pi.p = p;
+ return pi.i;
+}
+
+static INLINE void *
+intptr_to_pointer( intptr_t i )
+{
+ union {
+ void *p;
+ intptr_t i;
+ } pi;
+ pi.i = i;
+ return pi.p;
+}
+
+static INLINE uintptr_t
+pointer_to_uintptr( const void *ptr )
+{
+ union {
+ const void *p;
+ uintptr_t u;
+ } pu;
+ pu.p = ptr;
+ return pu.u;
+}
+
+static INLINE void *
+uintptr_to_pointer( uintptr_t u )
+{
+ union {
+ void *p;
+ uintptr_t u;
+ } pu;
+ pu.u = u;
+ return pu.p;
+}
+
+/**
+ * Return a pointer aligned to next multiple of N bytes.
+ */
+static INLINE void *
+align_pointer( const void *unaligned, uintptr_t alignment )
+{
+ uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1);
+ return uintptr_to_pointer( aligned );
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* P_POINTER_H */
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 10c47e0ef0..1806877f6c 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -50,6 +50,8 @@ struct tgsi_token
#define TGSI_FILE_SAMPLER 5
#define TGSI_FILE_ADDRESS 6
#define TGSI_FILE_IMMEDIATE 7
+#define TGSI_FILE_COUNT 8 /**< how many TGSI_FILE_ types */
+
#define TGSI_DECLARE_RANGE 0
#define TGSI_DECLARE_MASK 1
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 47fa78c31d..15c88881eb 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -42,6 +42,12 @@
#include "p_defines.h"
#include "p_format.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/**
* Implementation limits
*/
@@ -326,4 +332,8 @@ struct pipe_vertex_element
};
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/include/pipe/p_util.h b/src/gallium/include/pipe/p_util.h
index d7da2801c9..3b32ba1d24 100644
--- a/src/gallium/include/pipe/p_util.h
+++ b/src/gallium/include/pipe/p_util.h
@@ -30,16 +30,17 @@
#include "p_compiler.h"
#include "p_debug.h"
+#include "p_pointer.h"
#include <math.h>
-#ifdef WIN32
-
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
+
+#ifdef WIN32
+
void * __stdcall
EngAllocMem(
unsigned long Flags,
@@ -50,10 +51,6 @@ void __stdcall
EngFreeMem(
void *Mem );
-#ifdef __cplusplus
-}
-#endif
-
static INLINE void *
MALLOC( unsigned size )
{
@@ -115,33 +112,6 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
/**
- * Return a pointer aligned to next multiple of N bytes.
- */
-static INLINE void *
-align_pointer( void *unaligned, uint alignment )
-{
- if (sizeof(void *) == 64) {
- union {
- void *p;
- uint64 u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + alignment - 1) & ~(uint64) (alignment - 1);
- return pu.p;
- }
- else {
- /* 32-bit pointers */
- union {
- void *p;
- uint u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + alignment - 1) & ~(alignment - 1);
- return pu.p;
- }
-}
-
-/**
* Return memory on given byte alignment
*/
static INLINE void *
@@ -405,4 +375,8 @@ extern void pipe_copy_rect(ubyte * dst, unsigned cpp, unsigned dst_pitch,
int src_pitch, unsigned src_x, int src_y);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/gallium/include/pipe/p_winsys.h b/src/gallium/include/pipe/p_winsys.h
index 1e81eebd78..e784c92491 100644
--- a/src/gallium/include/pipe/p_winsys.h
+++ b/src/gallium/include/pipe/p_winsys.h
@@ -25,12 +25,6 @@
*
**************************************************************************/
-#ifndef P_WINSYS_H
-#define P_WINSYS_H
-
-
-#include "p_format.h"
-
/**
* \file
* This is the interface that Gallium3D requires any window system
@@ -38,6 +32,17 @@
* which is public.
*/
+#ifndef P_WINSYS_H
+#define P_WINSYS_H
+
+
+#include "p_format.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** Opaque type */
struct pipe_fence_handle;
@@ -156,5 +161,8 @@ struct pipe_winsys
};
+#ifdef __cplusplus
+}
+#endif
#endif /* P_WINSYS_H */