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 @@
// TLS does not exist for Windows Store and needs to be emulated
# 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
# define CREATE_SUSPENDED 0x00000004
# endif
......
......@@ -486,10 +486,15 @@ void writeFile(const char* path, const void* content, size_t size)
}
#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;
HANDLE sleepEvent = singletonEvent;
if (!sleepEvent)
......@@ -510,7 +515,10 @@ void Sleep(unsigned long dwMilliseconds)
}
// 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();
void writeFile(const char* path, const void* data, size_t size);
#endif
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
void Sleep(_In_ unsigned long dwMilliseconds);
#if defined (ANGLE_PLATFORM_WINDOWS)
void ScheduleYield();
#endif
#endif // LIBGLESV2_UTILITIES_H
......@@ -98,7 +98,7 @@ gl::Error FenceNV11::finishFence(GLboolean *outFinished)
return error;
}
Sleep(0);
ScheduleYield();
}
return gl::Error(GL_NO_ERROR);
......@@ -178,7 +178,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
while (currentCounter.QuadPart < endCounter && !result)
{
Sleep(0);
ScheduleYield();
BOOL success = QueryPerformanceCounter(&currentCounter);
UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
......
......@@ -72,7 +72,7 @@ gl::Error Query11::getResult(GLuint *params)
if (!mQueryFinished)
{
Sleep(0);
ScheduleYield();
}
}
......
......@@ -503,7 +503,7 @@ gl::Error Renderer11::sync(bool block)
}
// Keep polling, but allow other threads to do something useful first
Sleep(0);
ScheduleYield();
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