1 // 2 // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // platform.h: Operating system specific includes and defines. 8 9 #ifndef COMMON_PLATFORM_H_ 10 #define COMMON_PLATFORM_H_ 11 12 #if defined(_WIN32) || defined(_WIN64) 13 # define ANGLE_PLATFORM_WINDOWS 1 14 #elif defined(__APPLE__) 15 # define ANGLE_PLATFORM_APPLE 1 16 # define ANGLE_PLATFORM_POSIX 1 17 #elif defined(ANDROID) 18 # define ANGLE_PLATFORM_ANDROID 1 19 # define ANGLE_PLATFORM_POSIX 1 20 #elif defined(__linux__) || defined(EMSCRIPTEN) 21 # define ANGLE_PLATFORM_LINUX 1 22 # define ANGLE_PLATFORM_POSIX 1 23 #elif defined(__FreeBSD__) || \ 24 defined(__OpenBSD__) || \ 25 defined(__NetBSD__) || \ 26 defined(__DragonFly__) || \ 27 defined(__sun) || \ 28 defined(__GLIBC__) || \ 29 defined(__GNU__) || \ 30 defined(__QNX__) || \ 31 defined(__Fuchsia__) || \ 32 defined(__HAIKU__) 33 # define ANGLE_PLATFORM_POSIX 1 34 #else 35 # error Unsupported platform. 36 #endif 37 38 #ifdef ANGLE_PLATFORM_WINDOWS 39 # ifndef STRICT 40 # define STRICT 1 41 # endif 42 # ifndef WIN32_LEAN_AND_MEAN 43 # define WIN32_LEAN_AND_MEAN 1 44 # endif 45 # ifndef NOMINMAX 46 # define NOMINMAX 1 47 # endif 48 49 # include <windows.h> 50 # include <intrin.h> 51 52 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) 53 # define ANGLE_ENABLE_WINDOWS_STORE 1 54 # endif 55 56 # if defined(ANGLE_ENABLE_D3D9) 57 # include <d3d9.h> 58 # include <d3dcompiler.h> 59 # endif 60 61 # if defined(ANGLE_ENABLE_D3D11) 62 #include <d3d10_1.h> 63 #include <d3d11.h> 64 #include <d3d11_3.h> 65 #include <d3dcompiler.h> 66 #include <dxgi.h> 67 #include <dxgi1_2.h> 68 # endif 69 70 #if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11) 71 #include <wrl.h> 72 #endif 73 74 # if defined(ANGLE_ENABLE_WINDOWS_STORE) 75 # include <dxgi1_3.h> 76 # if defined(_DEBUG) 77 # include <DXProgrammableCapture.h> 78 # include <dxgidebug.h> 79 # endif 80 # endif 81 82 # undef near 83 # undef far 84 #endif 85 86 #if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) 87 #include <intrin.h> 88 #define ANGLE_USE_SSE 89 #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__) 90 #include <x86intrin.h> 91 #define ANGLE_USE_SSE 92 #endif 93 94 // Mips and arm devices need to include stddef for size_t. 95 #if defined(__mips__) || defined(__arm__) || defined(__aarch64__) 96 #include <stddef.h> 97 #endif 98 99 // The MemoryBarrier function name collides with a macro under Windows 100 // We will undef the macro so that the function name does not get replaced 101 #undef MemoryBarrier 102 103 #endif // COMMON_PLATFORM_H_ 104