Sfoglia il codice sorgente

Fixed alignment macro.

Branimir Karadžić 11 anni fa
parent
commit
725386821a
5 ha cambiato i file con 57 aggiunte e 51 eliminazioni
  1. 2 0
      include/bx/float4_ni.h
  2. 1 1
      include/bx/float4_t.h
  3. 1 1
      include/bx/float4x4_t.h
  4. 5 7
      include/bx/macros.h
  5. 48 42
      include/bx/platform.h

+ 2 - 0
include/bx/float4_ni.h

@@ -8,6 +8,8 @@
 
 namespace bx
 {
+	BX_FLOAT4_INLINE float4_t float4_rcp_ni(float4_t _a);
+
 	BX_FLOAT4_INLINE float4_t float4_shuf_xAzC_ni(float4_t _a, float4_t _b)
 	{
 		const float4_t xAyB   = float4_shuf_xAyB(_a, _b);

+ 1 - 1
include/bx/float4_t.h

@@ -15,7 +15,7 @@
 #	include "float4_sse.h"
 #elif defined(__ARM_NEON__) && !BX_COMPILER_CLANG
 #	include "float4_neon.h"
-#elif 0 // BX_COMPILER_CLANG
+#elif BX_COMPILER_CLANG
 #	include "float4_langext.h"
 #else
 #	ifndef BX_FLOAT4_WARN_REFERENCE_IMPL

+ 1 - 1
include/bx/float4x4_t.h

@@ -10,7 +10,7 @@
 
 namespace bx
 {
-	BX_ALIGN_STRUCT_16(struct) float4x4_t
+	BX_ALIGN_DECL_16(struct) float4x4_t
 	{
 		float4_t col[4];
 	};

+ 5 - 7
include/bx/macros.h

@@ -42,7 +42,7 @@
 #define BX_ALIGNOF(_type) __alignof(_type)
 
 #if BX_COMPILER_GCC || BX_COMPILER_CLANG
-#	define BX_ALIGN_STRUCT(_align, _struct) _struct __attribute__( (aligned(_align) ) )
+#	define BX_ALIGN_DECL(_align, _decl) _decl __attribute__( (aligned(_align) ) )
 #	define BX_ALLOW_UNUSED __attribute__( (unused) )
 #	define BX_FORCE_INLINE __extension__ static __inline __attribute__( (__always_inline__) )
 #	define BX_FUNCTION __PRETTY_FUNCTION__
@@ -58,7 +58,7 @@
 #	endif // BX_COMPILER_CLANG
 #	define BX_ATTRIBUTE(_x) __attribute__( (_x) )
 #elif BX_COMPILER_MSVC
-#	define BX_ALIGN_STRUCT(_align, _struct) __declspec(align(_align) ) _struct
+#	define BX_ALIGN_DECL(_align, _decl) __declspec(align(_align) ) _decl
 #	define BX_ALLOW_UNUSED
 #	define BX_FORCE_INLINE __forceinline
 #	define BX_FUNCTION __FUNCTION__
@@ -76,11 +76,9 @@
 // #define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__)
 #define BX_STATIC_ASSERT(_condition, ...) typedef char BX_CONCATENATE(BX_STATIC_ASSERT_, __LINE__)[1][(_condition)] BX_ATTRIBUTE(unused)
 
-#define BX_CACHE_LINE_ALIGN_MARKER() BX_ALIGN_STRUCT(BX_CACHE_LINE_SIZE, struct) BX_CONCATENATE(bx_cache_line_marker_compiler_stfu, __COUNTER__) {}
-#define BX_CACHE_LINE_ALIGN(_def) BX_CACHE_LINE_ALIGN_MARKER(); _def; BX_CACHE_LINE_ALIGN_MARKER()
-
-#define BX_ALIGN_STRUCT_16(_struct) BX_ALIGN_STRUCT(16, _struct)
-#define BX_ALIGN_STRUCT_256(_struct) BX_ALIGN_STRUCT(256, _struct)
+#define BX_ALIGN_DECL_16(_decl) BX_ALIGN_DECL(16, _decl)
+#define BX_ALIGN_DECL_256(_decl) BX_ALIGN_DECL(256, _decl)
+#define BX_ALIGN_DECL_CACHE_LINE(_decl) BX_ALIGN_DECL(BX_CACHE_LINE_SIZE, _decl)
 
 #define BX_MACRO_BLOCK_BEGIN for(;;) {
 #define BX_MACRO_BLOCK_END break; }

+ 48 - 42
include/bx/platform.h

@@ -50,6 +50,45 @@
 #	error "BX_COMPILER_* is not defined!"
 #endif //
 
+// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures
+#if defined(__arm__) || defined(_M_ARM)
+#	undef BX_CPU_ARM
+#	define BX_CPU_ARM 1
+#	define BX_CACHE_LINE_SIZE 64
+#elif defined(__MIPSEL__) || defined(__mips_isa_rev) // defined(mips)
+#	undef BX_CPU_MIPS
+#	define BX_CPU_MIPS 1
+#	define BX_CACHE_LINE_SIZE 64
+#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc64__)
+#	undef BX_CPU_PPC
+#	define BX_CPU_PPC 1
+#	define BX_CACHE_LINE_SIZE 128
+#elif defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__)
+#	undef BX_CPU_X86
+#	define BX_CPU_X86 1
+#	define BX_CACHE_LINE_SIZE 64
+#else // PNaCl doesn't have CPU defined.
+#	undef BX_CPU_JIT
+#	define BX_CPU_JIT 1
+#	define BX_CACHE_LINE_SIZE 64
+#endif //
+
+#if defined(__x86_64__) || defined(_M_X64) || defined(__64BIT__) || defined(__powerpc64__) || defined(__ppc64__)
+#	undef BX_ARCH_64BIT
+#	define BX_ARCH_64BIT 64
+#else
+#	undef BX_ARCH_32BIT
+#	define BX_ARCH_32BIT 32
+#endif //
+
+#if BX_CPU_PPC
+#	undef BX_CPU_ENDIAN_BIG
+#	define BX_CPU_ENDIAN_BIG 1
+#else
+#	undef BX_CPU_ENDIAN_LITTLE
+#	define BX_CPU_ENDIAN_LITTLE 1
+#endif // BX_PLATFORM_
+
 // http://sourceforge.net/apps/mediawiki/predef/index.php?title=Operating_Systems
 #if defined(_XBOX_VER)
 #	undef BX_PLATFORM_XBOX360
@@ -59,9 +98,15 @@
 #	if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
 #		undef BX_PLATFORM_WINDOWS
 #		if !defined(WINVER) && !defined(_WIN32_WINNT)
-		// Windows Server 2003 with SP1, Windows XP with SP2 and above
-#			define WINVER 0x0502
-#			define _WIN32_WINNT 0x0502
+#			if BX_ARCH_64BIT
+//				When building 64-bit target Win7 and above.
+#				define WINVER 0x0601
+#				define _WIN32_WINNT 0x0601
+#			else
+//				Windows Server 2003 with SP1, Windows XP with SP2 and above
+#				define WINVER 0x0502
+#				define _WIN32_WINNT 0x0502
+#			endif // BX_ARCH_64BIT
 #		endif // !defined(WINVER) && !defined(_WIN32_WINNT)
 #		define BX_PLATFORM_WINDOWS _WIN32_WINNT
 #	else
@@ -114,45 +159,6 @@
 						|| BX_PLATFORM_RPI \
 						)
 
-// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures
-#if defined(__arm__) || defined(_M_ARM)
-#	undef BX_CPU_ARM
-#	define BX_CPU_ARM 1
-#	define BX_CACHE_LINE_SIZE 64
-#elif defined(__MIPSEL__) || defined(__mips_isa_rev) // defined(mips)
-#	undef BX_CPU_MIPS
-#	define BX_CPU_MIPS 1
-#	define BX_CACHE_LINE_SIZE 64
-#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc64__)
-#	undef BX_CPU_PPC
-#	define BX_CPU_PPC 1
-#	define BX_CACHE_LINE_SIZE 128
-#elif defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__)
-#	undef BX_CPU_X86
-#	define BX_CPU_X86 1
-#	define BX_CACHE_LINE_SIZE 64
-#else // PNaCl doesn't have CPU defined.
-#	undef BX_CPU_JIT
-#	define BX_CPU_JIT 1
-#	define BX_CACHE_LINE_SIZE 64
-#endif // 
-
-#if defined(__x86_64__) || defined(_M_X64) || defined(__64BIT__) || defined(__powerpc64__) || defined(__ppc64__)
-#	undef BX_ARCH_64BIT
-#	define BX_ARCH_64BIT 64
-#else
-#	undef BX_ARCH_32BIT
-#	define BX_ARCH_32BIT 32
-#endif //
-
-#if BX_CPU_PPC
-#	undef BX_CPU_ENDIAN_BIG
-#	define BX_CPU_ENDIAN_BIG 1
-#else
-#	undef BX_CPU_ENDIAN_LITTLE
-#	define BX_CPU_ENDIAN_LITTLE 1
-#endif // BX_PLATFORM_
-
 #ifndef  BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
 #	define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
 #endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS