Commit 5c798fe9 by Corentin Wallez

Enable OcclusionQueriesTest on Linux

This includes an implementation of a cross platform Sleep function BUG=angleproject:892 Change-Id: I1087a00ab204b37bafc5e95a9766962b194d97ef Reviewed-on: https://chromium-review.googlesource.com/273133Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 9d0b1f9b
......@@ -35,6 +35,7 @@
'<(angle_path)/src/tests/gl_tests/media/pixel.inl',
'<(angle_path)/src/tests/gl_tests/PBOExtensionTest.cpp',
'<(angle_path)/src/tests/gl_tests/PointSpritesTest.cpp',
'<(angle_path)/src/tests/gl_tests/OcclusionQueriesTest.cpp',
'<(angle_path)/src/tests/gl_tests/ProgramBinaryTest.cpp',
'<(angle_path)/src/tests/gl_tests/ReadPixelsTest.cpp',
'<(angle_path)/src/tests/gl_tests/RendererTest.cpp',
......@@ -59,8 +60,6 @@
],
'angle_end2end_tests_win_sources':
[
# TODO(cwallez) for Linux, requires a portable implementation of sleep
'<(angle_path)/src/tests/gl_tests/OcclusionQueriesTest.cpp',
# TODO(cwallez) for Linux, requires implementation of eglBindTexImage for pbuffers
'<(angle_path)/src/tests/gl_tests/PbufferTest.cpp',
'<(angle_path)/src/tests/gl_tests/QueryDisplayAttribTest.cpp',
......
......@@ -4,11 +4,9 @@
// found in the LICENSE file.
//
#include "system_utils.h"
#include "test_utils/ANGLETest.h"
// Needed for Sleep()
#include <Windows.h>
using namespace angle;
class OcclusionQueriesTest : public ANGLETest
......@@ -92,7 +90,7 @@ TEST_P(OcclusionQueriesTest, IsOccluded)
GLuint ready = GL_FALSE;
while (ready == GL_FALSE)
{
Sleep(0);
angle::Sleep(0);
glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &ready);
}
......
//
// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Posix_system_utils.cpp: Implementation of OS-specific functions for Posix systems
#include "system_utils.h"
#include <sched.h>
#include <time.h>
namespace angle
{
void Sleep(unsigned int milliseconds)
{
// On Windows Sleep(0) yields while it isn't guaranteed by Posix's sleep
// so we replicate Windows' behavior with an explicit yield.
if (milliseconds == 0)
{
sched_yield();
}
else
{
timespec sleepTime =
{
.tv_sec = milliseconds / 1000,
.tv_nsec = (milliseconds % 1000) * 1000000,
};
nanosleep(&sleepTime, nullptr);
}
}
} // namespace angle
......@@ -17,6 +17,9 @@ namespace angle
std::string GetExecutablePath();
std::string GetExecutableDirectory();
// Cross platform equivalent of the Windows Sleep function
void Sleep(unsigned int milliseconds);
} // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H
......@@ -35,6 +35,7 @@
'linux/Linux_system_utils.cpp',
'linux/LinuxTimer.cpp',
'linux/LinuxTimer.h',
'posix/Posix_system_utils.cpp',
'x11/X11Window.cpp',
'x11/X11Window.h',
]
......
......@@ -28,4 +28,9 @@ std::string GetExecutableDirectory()
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
}
void Sleep(unsigned int milliseconds)
{
::Sleep(static_cast<DWORD>(milliseconds));
}
} // namespace angle
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