Define SDL_PLATFORM_* macros instead of underscored ones (#8875)
This commit is contained in:
committed by
GitHub
parent
ceccf24519
commit
31d133db40
@@ -56,7 +56,7 @@ typedef struct CONDITION_VARIABLE
|
||||
} CONDITION_VARIABLE, *PCONDITION_VARIABLE;
|
||||
#endif
|
||||
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
#define pWakeConditionVariable WakeConditionVariable
|
||||
#define pWakeAllConditionVariable WakeAllConditionVariable
|
||||
#define pSleepConditionVariableSRW SleepConditionVariableSRW
|
||||
@@ -186,7 +186,7 @@ static const SDL_cond_impl_t SDL_cond_impl_cv = {
|
||||
};
|
||||
|
||||
|
||||
#ifndef __WINRT__
|
||||
#ifndef SDL_PLATFORM_WINRT
|
||||
/* Generic Condition Variable implementation using SDL_Mutex and SDL_Semaphore */
|
||||
static const SDL_cond_impl_t SDL_cond_impl_generic = {
|
||||
&SDL_CreateCondition_generic,
|
||||
@@ -213,7 +213,7 @@ SDL_Condition *SDL_CreateCondition(void)
|
||||
SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID);
|
||||
}
|
||||
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Link statically on this platform */
|
||||
impl = &SDL_cond_impl_cv;
|
||||
#else
|
||||
|
||||
@@ -39,7 +39,7 @@ SDL_mutex_impl_t SDL_mutex_impl_active = { 0 };
|
||||
* Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer.
|
||||
*/
|
||||
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Functions are guaranteed to be available */
|
||||
#define pInitializeSRWLock InitializeSRWLock
|
||||
#define pReleaseSRWLockExclusive ReleaseSRWLockExclusive
|
||||
@@ -143,7 +143,7 @@ static SDL_Mutex *SDL_CreateMutex_cs(void)
|
||||
if (mutex) {
|
||||
// Initialize
|
||||
// On SMP systems, a non-zero spin count generally helps performance
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
|
||||
#else
|
||||
InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
|
||||
@@ -197,7 +197,7 @@ SDL_Mutex *SDL_CreateMutex(void)
|
||||
const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs;
|
||||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) {
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
// Link statically on this platform
|
||||
impl = &SDL_mutex_impl_srw;
|
||||
#else
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef VOID(WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
|
||||
typedef VOID(WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
|
||||
typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
|
||||
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Functions are guaranteed to be available */
|
||||
#define pTryAcquireSRWLockExclusive TryAcquireSRWLockExclusive
|
||||
#define pInitializeSRWLock InitializeSRWLock
|
||||
@@ -163,7 +163,7 @@ static const SDL_rwlock_impl_t SDL_rwlock_impl_srw = {
|
||||
&SDL_UnlockRWLock_srw
|
||||
};
|
||||
|
||||
#ifndef __WINRT__
|
||||
#ifndef SDL_PLATFORM_WINRT
|
||||
|
||||
#include "../generic/SDL_sysrwlock_c.h"
|
||||
|
||||
@@ -184,7 +184,7 @@ SDL_RWLock *SDL_CreateRWLock(void)
|
||||
if (!SDL_rwlock_impl_active.Create) {
|
||||
const SDL_rwlock_impl_t *impl;
|
||||
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Link statically on this platform */
|
||||
impl = &SDL_rwlock_impl_srw;
|
||||
#else
|
||||
|
||||
@@ -61,7 +61,7 @@ static SDL_sem_impl_t SDL_sem_impl_active = { 0 };
|
||||
/* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */
|
||||
|
||||
#if !SDL_WINAPI_FAMILY_PHONE
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Functions are guaranteed to be available */
|
||||
#define pWaitOnAddress WaitOnAddress
|
||||
#define pWakeByAddressSingle WakeByAddressSingle
|
||||
@@ -223,7 +223,7 @@ static SDL_Semaphore *SDL_CreateSemaphore_kern(Uint32 initial_value)
|
||||
if (sem) {
|
||||
/* Create the semaphore, with max value 32K */
|
||||
// !!! FIXME: CreateSemaphoreEx is available in Vista and later, so if XP support is dropped, we can lose this #ifdef.
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
|
||||
#else
|
||||
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
|
||||
@@ -331,7 +331,7 @@ SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
|
||||
#if !SDL_WINAPI_FAMILY_PHONE
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) {
|
||||
#ifdef __WINRT__
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
/* Link statically on this platform */
|
||||
impl = &SDL_sem_impl_atom;
|
||||
#else
|
||||
|
||||
@@ -68,7 +68,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread)
|
||||
{
|
||||
#elif defined(__CYGWIN__) || defined(__WINRT__)
|
||||
#elif defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_WINRT)
|
||||
int SDL_SYS_CreateThread(SDL_Thread *thread)
|
||||
{
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread = NULL;
|
||||
@@ -124,7 +124,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
{
|
||||
if (name) {
|
||||
PVOID exceptionHandlerHandle;
|
||||
#ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */
|
||||
#ifndef SDL_PLATFORM_WINRT /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */
|
||||
static pfnSetThreadDescription pSetThreadDescription = NULL;
|
||||
static HMODULE kernel32 = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user