Commit 1edac3b1 by Cooper Partin Committed by Geoff Lang

Fixed Visual Studio 2013 Update 4 build failures for WinRT

Change-Id: I393e9800d1c2e902f60728e1f7d0debca66b76a0 Reviewed-on: https://chromium-review.googlesource.com/231140Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent af224bf0
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
// TLS does not exist for Windows Store and needs to be emulated // TLS does not exist for Windows Store and needs to be emulated
# ifdef ANGLE_ENABLE_WINDOWS_STORE # ifdef ANGLE_ENABLE_WINDOWS_STORE
# define TLS_OUT_OF_INDEXES -1 # ifndef TLS_OUT_OF_INDEXES
# define TLS_OUT_OF_INDEXES -1
# endif
# ifndef CREATE_SUSPENDED # ifndef CREATE_SUSPENDED
# define CREATE_SUSPENDED 0x00000004 # define CREATE_SUSPENDED 0x00000004
# endif # endif
......
...@@ -486,10 +486,15 @@ void writeFile(const char* path, const void* content, size_t size) ...@@ -486,10 +486,15 @@ void writeFile(const char* path, const void* content, size_t size)
} }
#endif // !ANGLE_ENABLE_WINDOWS_STORE #endif // !ANGLE_ENABLE_WINDOWS_STORE
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined (ANGLE_PLATFORM_WINDOWS)
void Sleep(unsigned long dwMilliseconds) // Causes the thread to relinquish the remainder of its time slice to any
// other thread that is ready to run.If there are no other threads ready
// to run, the function returns immediately, and the thread continues execution.
void ScheduleYield()
{ {
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
// This implementation of Sleep exists because it is not available prior to Update 4.
static HANDLE singletonEvent = nullptr; static HANDLE singletonEvent = nullptr;
HANDLE sleepEvent = singletonEvent; HANDLE sleepEvent = singletonEvent;
if (!sleepEvent) if (!sleepEvent)
...@@ -510,7 +515,10 @@ void Sleep(unsigned long dwMilliseconds) ...@@ -510,7 +515,10 @@ void Sleep(unsigned long dwMilliseconds)
} }
// Emulate sleep by waiting with timeout on an event that is never signalled. // Emulate sleep by waiting with timeout on an event that is never signalled.
WaitForSingleObjectEx(sleepEvent, dwMilliseconds, false); WaitForSingleObjectEx(sleepEvent, 0, false);
#else
Sleep(0);
#endif
} }
#endif // ANGLE_ENABLE_WINDOWS_STORE #endif
\ No newline at end of file
...@@ -51,8 +51,8 @@ std::string getTempPath(); ...@@ -51,8 +51,8 @@ std::string getTempPath();
void writeFile(const char* path, const void* data, size_t size); void writeFile(const char* path, const void* data, size_t size);
#endif #endif
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined (ANGLE_PLATFORM_WINDOWS)
void Sleep(_In_ unsigned long dwMilliseconds); void ScheduleYield();
#endif #endif
#endif // LIBGLESV2_UTILITIES_H #endif // LIBGLESV2_UTILITIES_H
...@@ -98,7 +98,7 @@ gl::Error FenceNV11::finishFence(GLboolean *outFinished) ...@@ -98,7 +98,7 @@ gl::Error FenceNV11::finishFence(GLboolean *outFinished)
return error; return error;
} }
Sleep(0); ScheduleYield();
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -178,7 +178,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou ...@@ -178,7 +178,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
while (currentCounter.QuadPart < endCounter && !result) while (currentCounter.QuadPart < endCounter && !result)
{ {
Sleep(0); ScheduleYield();
BOOL success = QueryPerformanceCounter(&currentCounter); BOOL success = QueryPerformanceCounter(&currentCounter);
UNUSED_ASSERTION_VARIABLE(success); UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success); ASSERT(success);
......
...@@ -72,7 +72,7 @@ gl::Error Query11::getResult(GLuint *params) ...@@ -72,7 +72,7 @@ gl::Error Query11::getResult(GLuint *params)
if (!mQueryFinished) if (!mQueryFinished)
{ {
Sleep(0); ScheduleYield();
} }
} }
......
...@@ -503,7 +503,7 @@ gl::Error Renderer11::sync(bool block) ...@@ -503,7 +503,7 @@ gl::Error Renderer11::sync(bool block)
} }
// Keep polling, but allow other threads to do something useful first // Keep polling, but allow other threads to do something useful first
Sleep(0); ScheduleYield();
if (testDeviceLost(true)) if (testDeviceLost(true))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment