mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
Merge pull request #9804 from jherico/oculus_update
Update Oculus SDK to 1.11
This commit is contained in:
commit
1e51ae62b1
8 changed files with 63 additions and 24 deletions
32
cmake/externals/LibOVR/CMakeLists.txt
vendored
32
cmake/externals/LibOVR/CMakeLists.txt
vendored
|
@ -12,35 +12,29 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||||
# 0.5 public
|
# 0.5 public
|
||||||
# URL http://static.oculus.com/sdk-downloads/ovr_sdk_win_0.5.0.1.zip
|
# URL http://static.oculus.com/sdk-downloads/ovr_sdk_win_0.5.0.1.zip
|
||||||
# URL_MD5 d3fc4c02db9be5ff08af4ef4c97b32f9
|
# URL_MD5 d3fc4c02db9be5ff08af4ef4c97b32f9
|
||||||
# 1.3 public
|
|
||||||
# URL http://hifi-public.s3.amazonaws.com/dependencies/ovr_sdk_win_1.3.0_public.zip
|
|
||||||
# URL_MD5 4d26faba0c1f35ff80bf674c96ed9259
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL https://hifi-public.s3.amazonaws.com/dependencies/ovr_sdk_win_1.8.0_public.zip
|
URL https://static.oculus.com/sdk-downloads/1.11.0/Public/1486063832/ovr_sdk_win_1.11.0_public.zip
|
||||||
URL_MD5 bea17e04acc1dd8cf7cabefa1b28cc3c
|
URL_MD5 ea484403757cbfdfa743b6577fb1f9d2
|
||||||
CONFIGURE_COMMAND ""
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||||
BUILD_COMMAND ""
|
PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/LibOVRCMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt
|
||||||
INSTALL_COMMAND ""
|
|
||||||
LOG_DOWNLOAD 1
|
LOG_DOWNLOAD 1
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
||||||
message("LIBOVR dir ${SOURCE_DIR}")
|
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||||
set(LIBOVR_DIR ${SOURCE_DIR}/LibOVR)
|
set(LIBOVR_DIR ${INSTALL_DIR})
|
||||||
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
|
||||||
set(LIBOVR_LIB_DIR ${LIBOVR_DIR}/Lib/Windows/x64/Release/VS2013 CACHE TYPE INTERNAL)
|
|
||||||
else()
|
|
||||||
set(LIBOVR_LIB_DIR ${LIBOVR_DIR}/Lib/Windows/Win32/Release/VS2013 CACHE TYPE INTERNAL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${LIBOVR_DIR}/Include CACHE TYPE INTERNAL)
|
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${LIBOVR_DIR}/Include CACHE TYPE INTERNAL)
|
||||||
message("LIBOVR include dir ${${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS}")
|
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${LIBOVR_DIR}/Lib/LibOVRd.lib CACHE TYPE INTERNAL)
|
||||||
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${LIBOVR_LIB_DIR}/LibOVR.lib CACHE TYPE INTERNAL)
|
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${LIBOVR_DIR}/Lib/LibOVR.lib CACHE TYPE INTERNAL)
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
select_library_configurations(LIBOVR)
|
||||||
|
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES} CACHE TYPE INTERNAL)
|
||||||
|
message("Libs ${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES}")
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
|
|
14
cmake/externals/LibOVR/LibOVRCMakeLists.txt
vendored
Normal file
14
cmake/externals/LibOVR/LibOVRCMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
project(LibOVR)
|
||||||
|
|
||||||
|
include_directories(LibOVR/Include LibOVR/Src)
|
||||||
|
file(GLOB HEADER_FILES LibOVR/Include/*.h)
|
||||||
|
file(GLOB EXTRA_HEADER_FILES LibOVR/Include/Extras/*.h)
|
||||||
|
file(GLOB_RECURSE SOURCE_FILES LibOVR/Src/*.c LibOVR/Src/*.cpp)
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOVR_BUILD_DEBUG")
|
||||||
|
add_library(LibOVR STATIC ${SOURCE_FILES} ${HEADER_FILES} ${EXTRA_HEADER_FILES})
|
||||||
|
set_target_properties(LibOVR PROPERTIES DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
|
install(TARGETS LibOVR DESTINATION Lib)
|
||||||
|
install(FILES ${HEADER_FILES} DESTINATION Include)
|
||||||
|
install(FILES ${EXTRA_HEADER_FILES} DESTINATION Include/Extras)
|
|
@ -654,6 +654,11 @@ float OpenGLDisplayPlugin::presentRate() const {
|
||||||
return _presentRate.rate();
|
return _presentRate.rate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenGLDisplayPlugin::resetPresentRate() {
|
||||||
|
// FIXME
|
||||||
|
// _presentRate = RateCounter<100>();
|
||||||
|
}
|
||||||
|
|
||||||
float OpenGLDisplayPlugin::renderRate() const {
|
float OpenGLDisplayPlugin::renderRate() const {
|
||||||
return _renderRate.rate();
|
return _renderRate.rate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,8 @@ public:
|
||||||
|
|
||||||
float presentRate() const override;
|
float presentRate() const override;
|
||||||
|
|
||||||
|
void resetPresentRate() override;
|
||||||
|
|
||||||
float newFramePresentRate() const override;
|
float newFramePresentRate() const override;
|
||||||
|
|
||||||
float droppedFrameRate() const override;
|
float droppedFrameRate() const override;
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
/// By default, all HMDs are stereo
|
/// By default, all HMDs are stereo
|
||||||
virtual bool isStereo() const { return isHmd(); }
|
virtual bool isStereo() const { return isHmd(); }
|
||||||
virtual bool isThrottled() const { return false; }
|
virtual bool isThrottled() const { return false; }
|
||||||
virtual float getTargetFrameRate() const { return 0.0f; }
|
virtual float getTargetFrameRate() const { return 1.0f; }
|
||||||
virtual bool hasAsyncReprojection() const { return false; }
|
virtual bool hasAsyncReprojection() const { return false; }
|
||||||
|
|
||||||
/// Returns a boolean value indicating whether the display is currently visible
|
/// Returns a boolean value indicating whether the display is currently visible
|
||||||
|
@ -189,6 +189,11 @@ public:
|
||||||
virtual float renderRate() const { return -1.0f; }
|
virtual float renderRate() const { return -1.0f; }
|
||||||
// Rate at which we present to the display device
|
// Rate at which we present to the display device
|
||||||
virtual float presentRate() const { return -1.0f; }
|
virtual float presentRate() const { return -1.0f; }
|
||||||
|
// Reset the present rate tracking (useful for if the target frame rate changes as in ASW for Oculus)
|
||||||
|
virtual void resetPresentRate() {}
|
||||||
|
// Return the present rate as fraction of the target present rate (hopefully 0.0 and 1.0)
|
||||||
|
virtual float normalizedPresentRate() const { return presentRate() / getTargetFrameRate(); }
|
||||||
|
|
||||||
// Rate at which old frames are presented to the device display
|
// Rate at which old frames are presented to the device display
|
||||||
virtual float stutterRate() const { return -1.0f; }
|
virtual float stutterRate() const { return -1.0f; }
|
||||||
// Rate at which new frames are being presented to the display device
|
// Rate at which new frames are being presented to the display device
|
||||||
|
|
|
@ -28,6 +28,12 @@ OculusDisplayPlugin::OculusDisplayPlugin() {
|
||||||
_compositorDroppedFrames.store(0);
|
_compositorDroppedFrames.store(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float OculusDisplayPlugin::getTargetFrameRate() const {
|
||||||
|
if (_aswActive) {
|
||||||
|
return _hmdDesc.DisplayRefreshRate / 2.0f;
|
||||||
|
}
|
||||||
|
return _hmdDesc.DisplayRefreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
bool OculusDisplayPlugin::internalActivate() {
|
bool OculusDisplayPlugin::internalActivate() {
|
||||||
bool result = Parent::internalActivate();
|
bool result = Parent::internalActivate();
|
||||||
|
@ -185,8 +191,6 @@ void OculusDisplayPlugin::hmdPresent() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!OVR_SUCCESS(result)) {
|
if (!OVR_SUCCESS(result)) {
|
||||||
logWarning("Failed to present");
|
logWarning("Failed to present");
|
||||||
}
|
}
|
||||||
|
@ -195,12 +199,20 @@ void OculusDisplayPlugin::hmdPresent() {
|
||||||
static int appDroppedFrames = 0;
|
static int appDroppedFrames = 0;
|
||||||
ovrPerfStats perfStats;
|
ovrPerfStats perfStats;
|
||||||
ovr_GetPerfStats(_session, &perfStats);
|
ovr_GetPerfStats(_session, &perfStats);
|
||||||
|
bool shouldResetPresentRate = false;
|
||||||
for (int i = 0; i < perfStats.FrameStatsCount; ++i) {
|
for (int i = 0; i < perfStats.FrameStatsCount; ++i) {
|
||||||
const auto& frameStats = perfStats.FrameStats[i];
|
const auto& frameStats = perfStats.FrameStats[i];
|
||||||
int delta = frameStats.CompositorDroppedFrameCount - compositorDroppedFrames;
|
int delta = frameStats.CompositorDroppedFrameCount - compositorDroppedFrames;
|
||||||
_stutterRate.increment(delta);
|
_stutterRate.increment(delta);
|
||||||
compositorDroppedFrames = frameStats.CompositorDroppedFrameCount;
|
compositorDroppedFrames = frameStats.CompositorDroppedFrameCount;
|
||||||
appDroppedFrames = frameStats.AppDroppedFrameCount;
|
appDroppedFrames = frameStats.AppDroppedFrameCount;
|
||||||
|
bool newAswState = ovrTrue == frameStats.AswIsActive;
|
||||||
|
if (_aswActive.exchange(newAswState) != newAswState) {
|
||||||
|
shouldResetPresentRate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldResetPresentRate) {
|
||||||
|
resetPresentRate();
|
||||||
}
|
}
|
||||||
_appDroppedFrames.store(appDroppedFrames);
|
_appDroppedFrames.store(appDroppedFrames);
|
||||||
_compositorDroppedFrames.store(compositorDroppedFrames);
|
_compositorDroppedFrames.store(compositorDroppedFrames);
|
||||||
|
@ -212,6 +224,7 @@ void OculusDisplayPlugin::hmdPresent() {
|
||||||
|
|
||||||
QJsonObject OculusDisplayPlugin::getHardwareStats() const {
|
QJsonObject OculusDisplayPlugin::getHardwareStats() const {
|
||||||
QJsonObject hardwareStats;
|
QJsonObject hardwareStats;
|
||||||
|
hardwareStats["asw_active"] = _aswActive.load();
|
||||||
hardwareStats["app_dropped_frame_count"] = _appDroppedFrames.load();
|
hardwareStats["app_dropped_frame_count"] = _appDroppedFrames.load();
|
||||||
hardwareStats["compositor_dropped_frame_count"] = _compositorDroppedFrames.load();
|
hardwareStats["compositor_dropped_frame_count"] = _compositorDroppedFrames.load();
|
||||||
hardwareStats["long_render_count"] = _longRenders.load();
|
hardwareStats["long_render_count"] = _longRenders.load();
|
||||||
|
|
|
@ -20,7 +20,8 @@ public:
|
||||||
|
|
||||||
QString getPreferredAudioInDevice() const override;
|
QString getPreferredAudioInDevice() const override;
|
||||||
QString getPreferredAudioOutDevice() const override;
|
QString getPreferredAudioOutDevice() const override;
|
||||||
|
float getTargetFrameRate() const override;
|
||||||
|
|
||||||
virtual QJsonObject getHardwareStats() const;
|
virtual QJsonObject getHardwareStats() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -39,6 +40,7 @@ private:
|
||||||
gpu::FramebufferPointer _outputFramebuffer;
|
gpu::FramebufferPointer _outputFramebuffer;
|
||||||
bool _customized { false };
|
bool _customized { false };
|
||||||
|
|
||||||
|
std::atomic_bool _aswActive;
|
||||||
std::atomic_int _compositorDroppedFrames;
|
std::atomic_int _compositorDroppedFrames;
|
||||||
std::atomic_int _appDroppedFrames;
|
std::atomic_int _appDroppedFrames;
|
||||||
std::atomic_int _longSubmits;
|
std::atomic_int _longSubmits;
|
||||||
|
|
|
@ -88,7 +88,11 @@ ovrSession acquireOculusSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
if (!OVR_SUCCESS(ovr_Initialize(nullptr))) {
|
ovrInitParams initParams {
|
||||||
|
ovrInit_RequestVersion | ovrInit_MixedRendering, OVR_MINOR_VERSION, nullptr, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!OVR_SUCCESS(ovr_Initialize(&initParams))) {
|
||||||
logWarning("Failed to initialize Oculus SDK");
|
logWarning("Failed to initialize Oculus SDK");
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue