зеркало из https://github.com/AvaloniaUI/angle.git
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/273133 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Родитель
9d0b1f9b58
Коммит
5c798fe97d
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче