removed WinRT support.

This commit is contained in:
Ozkan Sezer
2022-11-22 23:36:24 +03:00
parent bd5d26071a
commit dc2a3e06e9
86 changed files with 81 additions and 8098 deletions

View File

@@ -32,10 +32,6 @@ extern "C" {
#include <thread>
#include <system_error>
#ifdef __WINRT__
#include <Windows.h>
#endif
static void
RunThread(void *args)
{
@@ -71,9 +67,6 @@ extern "C"
SDL_threadID
SDL_ThreadID(void)
{
#ifdef __WINRT__
return GetCurrentThreadId();
#else
// HACK: Mimick a thread ID, if one isn't otherwise available.
static thread_local SDL_threadID current_thread_id = 0;
static SDL_threadID next_thread_id = 1;
@@ -86,37 +79,13 @@ SDL_ThreadID(void)
}
return current_thread_id;
#endif
}
extern "C"
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
#ifdef __WINRT__
int value;
if (priority == SDL_THREAD_PRIORITY_LOW) {
value = THREAD_PRIORITY_LOWEST;
}
else if (priority == SDL_THREAD_PRIORITY_HIGH) {
value = THREAD_PRIORITY_HIGHEST;
}
else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) {
// FIXME: WinRT does not support TIME_CRITICAL! -flibit
SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, "TIME_CRITICAL unsupported, falling back to HIGHEST");
value = THREAD_PRIORITY_HIGHEST;
}
else {
value = THREAD_PRIORITY_NORMAL;
}
if (!SetThreadPriority(GetCurrentThread(), value)) {
return WIN_SetError("SetThreadPriority()");
}
return 0;
#else
return SDL_Unsupported();
#endif
}
extern "C"

View File

@@ -58,12 +58,6 @@ typedef struct CONDITION_VARIABLE {
} CONDITION_VARIABLE, *PCONDITION_VARIABLE;
#endif
#if __WINRT__
#define pWakeConditionVariable WakeConditionVariable
#define pWakeAllConditionVariable WakeAllConditionVariable
#define pSleepConditionVariableSRW SleepConditionVariableSRW
#define pSleepConditionVariableCS SleepConditionVariableCS
#else
typedef VOID(WINAPI *pfnWakeConditionVariable)(PCONDITION_VARIABLE);
typedef VOID(WINAPI *pfnWakeAllConditionVariable)(PCONDITION_VARIABLE);
typedef BOOL(WINAPI *pfnSleepConditionVariableSRW)(PCONDITION_VARIABLE, PSRWLOCK, DWORD, ULONG);
@@ -73,7 +67,6 @@ static pfnWakeConditionVariable pWakeConditionVariable = NULL;
static pfnWakeAllConditionVariable pWakeAllConditionVariable = NULL;
static pfnSleepConditionVariableSRW pSleepConditionVariableSRW = NULL;
static pfnSleepConditionVariableCS pSleepConditionVariableCS = NULL;
#endif
typedef struct SDL_cond_cv
{
@@ -242,10 +235,6 @@ SDL_CreateCond(void)
SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID);
}
#if __WINRT__
/* Link statically on this platform */
impl = &SDL_cond_impl_cv;
#else
{
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
@@ -259,7 +248,6 @@ SDL_CreateCond(void)
}
}
}
#endif
SDL_copyp(&SDL_cond_impl_active, impl);
}

View File

@@ -44,19 +44,12 @@ SDL_mutex_impl_t SDL_mutex_impl_active = {0};
* Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer.
*/
#if __WINRT__
/* Functions are guaranteed to be available */
#define pReleaseSRWLockExclusive ReleaseSRWLockExclusive
#define pAcquireSRWLockExclusive AcquireSRWLockExclusive
#define pTryAcquireSRWLockExclusive TryAcquireSRWLockExclusive
#else
typedef VOID(WINAPI *pfnReleaseSRWLockExclusive)(PSRWLOCK);
typedef VOID(WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK);
typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK);
static pfnReleaseSRWLockExclusive pReleaseSRWLockExclusive = NULL;
static pfnAcquireSRWLockExclusive pAcquireSRWLockExclusive = NULL;
static pfnTryAcquireSRWLockExclusive pTryAcquireSRWLockExclusive = NULL;
#endif
static SDL_mutex *
SDL_CreateMutex_srw(void)
@@ -180,11 +173,7 @@ SDL_CreateMutex_cs(void)
if (mutex) {
/* Initialize */
/* On SMP systems, a non-zero spin count generally helps performance */
#if __WINRT__
InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
#else
InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
#endif
} else {
SDL_OutOfMemory();
}
@@ -267,10 +256,6 @@ 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)) {
#if __WINRT__
/* Link statically on this platform */
impl = &SDL_mutex_impl_srw;
#else
/* Try faster implementation for Windows 7 and newer */
HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (kernel32) {
@@ -283,7 +268,6 @@ SDL_CreateMutex(void)
impl = &SDL_mutex_impl_srw;
}
}
#endif
}
/* Copy instead of using pointer to save one level of indirection */

View File

@@ -76,17 +76,11 @@ static SDL_sem_impl_t SDL_sem_impl_active = {0};
#endif
#if !SDL_WINAPI_FAMILY_PHONE
#if __WINRT__
/* Functions are guaranteed to be available */
#define pWaitOnAddress WaitOnAddress
#define pWakeByAddressSingle WakeByAddressSingle
#else
typedef BOOL(WINAPI *pfnWaitOnAddress)(volatile VOID*, PVOID, SIZE_T, DWORD);
typedef VOID(WINAPI *pfnWakeByAddressSingle)(PVOID);
static pfnWaitOnAddress pWaitOnAddress = NULL;
static pfnWakeByAddressSingle pWakeByAddressSingle = NULL;
#endif
typedef struct SDL_semaphore_atom
{
@@ -274,11 +268,7 @@ SDL_CreateSemaphore_kern(Uint32 initial_value)
sem = (SDL_sem_kern *) SDL_malloc(sizeof(*sem));
if (sem) {
/* Create the semaphore, with max value 32K */
#if __WINRT__
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
#else
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
#endif
sem->count = initial_value;
if (!sem->id) {
SDL_SetError("Couldn't create semaphore");
@@ -405,10 +395,6 @@ SDL_CreateSemaphore(Uint32 initial_value)
#if !SDL_WINAPI_FAMILY_PHONE
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) {
#if __WINRT__
/* Link statically on this platform */
impl = &SDL_sem_impl_atom;
#else
/* We already statically link to features from this Api
* Set (e.g. WaitForSingleObject). Dynamically loading
* API Sets is not explicitly documented but according to
@@ -425,7 +411,6 @@ SDL_CreateSemaphore(Uint32 initial_value)
impl = &SDL_sem_impl_atom;
}
}
#endif
}
#endif

View File

@@ -87,7 +87,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread)
{
#elif defined(__CYGWIN__) || defined(__WINRT__)
#elif defined(__CYGWIN__)
int
SDL_SYS_CreateThread(SDL_Thread * thread)
{
@@ -141,7 +141,6 @@ void
SDL_SYS_SetupThread(const char *name)
{
if (name != NULL) {
#ifndef __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 = 0;
@@ -159,7 +158,6 @@ SDL_SYS_SetupThread(const char *name)
SDL_free(strw);
}
}
#endif
/* Presumably some version of Visual Studio will understand SetThreadDescription(),
but we still need to deal with older OSes and debuggers. Set it with the arcane

View File

@@ -28,18 +28,6 @@
#include "SDL_thread.h"
#include "../SDL_thread_c.h"
#if WINAPI_FAMILY_WINRT
#include <fibersapi.h>
#ifndef TLS_OUT_OF_INDEXES
#define TLS_OUT_OF_INDEXES FLS_OUT_OF_INDEXES
#endif
#define TlsAlloc() FlsAlloc(NULL)
#define TlsSetValue FlsSetValue
#define TlsGetValue FlsGetValue
#endif
static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
static SDL_bool generic_local_storage = SDL_FALSE;