mirror of
https://github.com/nothings/stb
synced 2024-12-15 20:32:33 +03:00
Merge branch 'mingwfix' of https://github.com/rygorous/stb into work2
Conflicts: stb_image.h
This commit is contained in:
commit
c83abb051a
20
stb_image.h
20
stb_image.h
@ -631,11 +631,12 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];
|
|||||||
#define STBI_FREE(p) free(p)
|
#define STBI_FREE(p) free(p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// x86/x64 detection
|
||||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
|
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
|
||||||
#define STBI__X86
|
#define STBI_X86_TARGET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(STBI__X86) && !defined(__SSE2__) && !defined(STBI_NO_SIMD)
|
#if defined(__GNUC__) && defined(STBI_X86_TARGET) && !defined(__SSE2__) && !defined(STBI_NO_SIMD)
|
||||||
// gcc doesn't support sse2 intrinsics unless you compile with -msse2,
|
// gcc doesn't support sse2 intrinsics unless you compile with -msse2,
|
||||||
// (but compiling with -msse2 allows the compiler to use SSE2 everywhere;
|
// (but compiling with -msse2 allows the compiler to use SSE2 everywhere;
|
||||||
// this is just broken and gcc are jerks for not fixing it properly
|
// this is just broken and gcc are jerks for not fixing it properly
|
||||||
@ -643,7 +644,20 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];
|
|||||||
#define STBI_NO_SIMD
|
#define STBI_NO_SIMD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(STBI_NO_SIMD) && defined(STBI__X86)
|
#if defined(__MINGW32__) && defined(STBI_X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD)
|
||||||
|
// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the
|
||||||
|
// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant.
|
||||||
|
// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not
|
||||||
|
// simultaneously enabling "-mstackrealign".
|
||||||
|
//
|
||||||
|
// See https://github.com/nothings/stb/issues/81 for more information.
|
||||||
|
//
|
||||||
|
// So default to no SSE2 on 32-bit MinGW. If you've read this far and added
|
||||||
|
// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2.
|
||||||
|
#define STBI_NO_SIMD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(STBI_NO_SIMD) && defined(STBI_X86_TARGET)
|
||||||
#define STBI_SSE2
|
#define STBI_SSE2
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user