aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ian@LunarG.com>2015-02-18 12:38:04 -0700
committerIan Elliott <ian@LunarG.com>2015-02-18 15:47:24 -0700
commitf5f63f827731faff2925537ddde65ff34af7ea89 (patch)
tree2f9948892c93b03340fe536d41413da6b436ec85
parent501349c19afe120602f4e68dda76d440e8614846 (diff)
downloadusermoji-f5f63f827731faff2925537ddde65ff34af7ea89.tar.xz
Win: Can now use "static inline" on Windows (i.e. no code mods).
-rw-r--r--icd/common/icd-format.h10
-rw-r--r--icd/common/icd-utils.h14
-rw-r--r--icd/nulldrv/nulldrv.h8
-rw-r--r--include/xglIcd.h4
-rw-r--r--include/xglPlatform.h8
-rwxr-xr-xxgl-generate.py6
-rwxr-xr-xxgl_helper.py11
7 files changed, 24 insertions, 37 deletions
diff --git a/icd/common/icd-format.h b/icd/common/icd-format.h
index 7aa50019..28c2dcae 100644
--- a/icd/common/icd-format.h
+++ b/icd/common/icd-format.h
@@ -31,14 +31,14 @@
#include <stdbool.h>
#include "icd.h"
-STATIC_INLINE bool icd_format_is_undef(XGL_FORMAT format)
+static inline bool icd_format_is_undef(XGL_FORMAT format)
{
return (format == XGL_FMT_UNDEFINED);
}
bool icd_format_is_ds(XGL_FORMAT format);
-STATIC_INLINE bool icd_format_is_color(XGL_FORMAT format)
+static inline bool icd_format_is_color(XGL_FORMAT format)
{
return !(icd_format_is_undef(format) || icd_format_is_ds(format));
}
@@ -53,13 +53,13 @@ bool icd_format_is_srgb(XGL_FORMAT format);
bool icd_format_is_compressed(XGL_FORMAT format);
-STATIC_INLINE int icd_format_get_block_width(XGL_FORMAT format)
+static inline int icd_format_get_block_width(XGL_FORMAT format)
{
/* all compressed formats use 4x4 blocks */
return (icd_format_is_compressed(format)) ? 4 : 1;
}
-STATIC_INLINE bool icd_blend_mode_is_dual_src(XGL_BLEND mode)
+static inline bool icd_blend_mode_is_dual_src(XGL_BLEND mode)
{
return (mode == XGL_BLEND_SRC1_COLOR) ||
(mode == XGL_BLEND_SRC1_ALPHA) ||
@@ -67,7 +67,7 @@ STATIC_INLINE bool icd_blend_mode_is_dual_src(XGL_BLEND mode)
(mode == XGL_BLEND_ONE_MINUS_SRC1_ALPHA);
}
-STATIC_INLINE bool icd_pipeline_cb_att_needs_dual_source_blending(const XGL_PIPELINE_CB_ATTACHMENT_STATE *att)
+static inline bool icd_pipeline_cb_att_needs_dual_source_blending(const XGL_PIPELINE_CB_ATTACHMENT_STATE *att)
{
if (icd_blend_mode_is_dual_src(att->srcBlendColor) ||
icd_blend_mode_is_dual_src(att->srcBlendAlpha) ||
diff --git a/icd/common/icd-utils.h b/icd/common/icd-utils.h
index aad6c3e5..fa9c3237 100644
--- a/icd/common/icd-utils.h
+++ b/icd/common/icd-utils.h
@@ -65,12 +65,12 @@
/**
* Return true if val is power of two, or zero.
*/
-STATIC_INLINE bool u_is_pow2(unsigned int val)
+static inline bool u_is_pow2(unsigned int val)
{
return ((val & (val - 1)) == 0);
}
-STATIC_INLINE int u_ffs(int val)
+static inline int u_ffs(int val)
{
#if defined(PLATFORM_LINUX)
return ffs(val);
@@ -79,18 +79,18 @@ STATIC_INLINE int u_ffs(int val)
#endif
}
-STATIC_INLINE unsigned int u_align(unsigned int val, unsigned alignment)
+static inline unsigned int u_align(unsigned int val, unsigned alignment)
{
assert(alignment && u_is_pow2(alignment));
return (val + alignment - 1) & ~(alignment - 1);
}
-STATIC_INLINE unsigned int u_minify(unsigned int val, unsigned level)
+static inline unsigned int u_minify(unsigned int val, unsigned level)
{
return (val >> level) ? val >> level : 1;
}
-STATIC_INLINE uint32_t u_fui(float f)
+static inline uint32_t u_fui(float f)
{
union {
float f;
@@ -100,7 +100,7 @@ STATIC_INLINE uint32_t u_fui(float f)
return u.ui;
}
-STATIC_INLINE float u_uif(uint32_t ui)
+static inline float u_uif(uint32_t ui)
{
union {
float f;
@@ -110,7 +110,7 @@ STATIC_INLINE float u_uif(uint32_t ui)
return u.f;
}
-STATIC_INLINE int u_iround(float f)
+static inline int u_iround(float f)
{
if (f >= 0.0f)
return (int) (f + 0.5f);
diff --git a/icd/nulldrv/nulldrv.h b/icd/nulldrv/nulldrv.h
index b32cbb77..70168c3b 100644
--- a/icd/nulldrv/nulldrv.h
+++ b/icd/nulldrv/nulldrv.h
@@ -40,14 +40,6 @@
#include <xglWsiWinExt.h>
#endif
-#ifndef STATIC_INLINE
-#if defined(PLATFORM_LINUX)
-#define STATIC_INLINE static inline
-#else
-#define STATIC_INLINE static
-#endif
-#endif
-
#include "icd.h"
#include "icd-alloc.h"
diff --git a/include/xglIcd.h b/include/xglIcd.h
index 3efffe6d..1c25936d 100644
--- a/include/xglIcd.h
+++ b/include/xglIcd.h
@@ -18,12 +18,12 @@ typedef union _XGL_LOADER_DATA {
void *loaderData;
} XGL_LOADER_DATA;
-STATIC_INLINE void set_loader_magic_value(void *pNewObject) {
+static inline void set_loader_magic_value(void *pNewObject) {
XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
loader_info->loaderMagic = ICD_LOADER_MAGIC;
}
-STATIC_INLINE bool valid_loader_magic_value(void *pNewObject) {
+static inline bool valid_loader_magic_value(void *pNewObject) {
const XGL_LOADER_DATA *loader_info = (XGL_LOADER_DATA *) pNewObject;
return loader_info->loaderMagic == ICD_LOADER_MAGIC;
}
diff --git a/include/xglPlatform.h b/include/xglPlatform.h
index af006a24..aff2e5b3 100644
--- a/include/xglPlatform.h
+++ b/include/xglPlatform.h
@@ -44,13 +44,13 @@ extern "C"
#define XGLAPI __stdcall
// C99:
- #define STATIC_INLINE static
+#ifndef __cplusplus
+ #undef inline
+ #define inline __inline
+#endif // __cplusplus
#elif defined(__GNUC__)
// On other platforms using GCC, XGLAPI stays undefined
#define XGLAPI
-
- // C99:
- #define STATIC_INLINE static inline
#else
// Unsupported Platform!
#error "Unsupported OS Platform detected!"
diff --git a/xgl-generate.py b/xgl-generate.py
index 202b30f2..9164cda6 100755
--- a/xgl-generate.py
+++ b/xgl-generate.py
@@ -275,7 +275,7 @@ class DispatchTableOpsSubcommand(Subcommand):
stmts.append("#endif")
func = []
- func.append("STATIC_INLINE void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
+ func.append("static inline void %s_initialize_dispatch_table(XGL_LAYER_DISPATCH_TABLE *table,"
% self.prefix)
func.append("%s xglGetProcAddrType gpa,"
% (" " * len(self.prefix)))
@@ -298,7 +298,7 @@ class DispatchTableOpsSubcommand(Subcommand):
lookups.append("#endif")
func = []
- func.append("STATIC_INLINE void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
+ func.append("static inline void *%s_lookup_dispatch_table(const XGL_LAYER_DISPATCH_TABLE *table,"
% self.prefix)
func.append("%s const char *name)"
% (" " * len(self.prefix)))
@@ -419,7 +419,7 @@ class LayerInterceptProcSubcommand(Subcommand):
lookups.append("#endif")
body = []
- body.append("STATIC_INLINE %s layer_intercept_proc(const char *name)" %
+ body.append("static inline %s layer_intercept_proc(const char *name)" %
self.gpa.ret)
body.append("{")
body.append(generate_get_proc_addr_check("name"))
diff --git a/xgl_helper.py b/xgl_helper.py
index 630a6c4b..19dbc436 100755
--- a/xgl_helper.py
+++ b/xgl_helper.py
@@ -1015,7 +1015,7 @@ class EnumCodeGen:
body = []
for bet in self.et_dict:
fet = self.tf_dict[bet]
- body.append("STATIC_INLINE uint32_t validate_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
+ body.append("static inline uint32_t validate_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
for e in sorted(self.et_dict[bet]):
if (self.ev_dict[e]['unique']):
body.append(' case %s:' % (e))
@@ -1028,7 +1028,7 @@ class EnumCodeGen:
# bet == base_enum_type, fet == final_enum_type
for bet in self.et_dict:
fet = self.tf_dict[bet]
- body.append("STATIC_INLINE const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
+ body.append("static inline const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\n {" % (fet, fet, fet))
for e in sorted(self.et_dict[bet]):
if (self.ev_dict[e]['unique']):
body.append(' case %s:\n return "%s";' % (e, e))
@@ -1038,12 +1038,7 @@ class EnumCodeGen:
def _generateSHHeader(self):
header = []
header.append('#pragma once\n')
- header.append('#include <%s>\n' % self.in_file)
- header.append('#if defined(_WIN32)')
- header.append('#define STATIC_INLINE static')
- header.append('#else // defined(_WIN32)')
- header.append('#define STATIC_INLINE static inline')
- header.append('#endif // defined(_WIN32)\n\n\n')
+ header.append('#include <%s>\n\n\n' % self.in_file)
return "\n".join(header)