Skip to content

Commit

Permalink
Hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaer Kazmer committed May 18, 2019
1 parent 46f70ca commit 818b73f
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 127 deletions.
184 changes: 93 additions & 91 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ project(OpenComposite)

include(scripts/pch.cmake)

set(CMAKE_CXX_STANDARD 17)

# === Runtime Switcher ===
include_external_msproject(
RuntimeSwitcher ${CMAKE_SOURCE_DIR}/RuntimeSwitcher/RuntimeSwitcher.csproj
Expand All @@ -33,14 +35,14 @@ endif()
# === LibOVR ===
if(WIN32)

set(OVRDIR libs/libovr/OculusSDK/LibOVR)
add_library(ovr STATIC
${OVRDIR}/Shim/OVR_CAPI_Prototypes.h
${OVRDIR}/Shim/OVR_CAPI_Util.cpp
${OVRDIR}/Shim/OVR_CAPIShim.c
${OVRDIR}/Shim/OVR_StereoProjection.cpp
)
target_include_directories(ovr PUBLIC ${OVRDIR}/Include)
#set(OVRDIR libs/libovr/OculusSDK/LibOVR)
#add_library(ovr STATIC
# ${OVRDIR}/Shim/OVR_CAPI_Prototypes.h
# ${OVRDIR}/Shim/OVR_CAPI_Util.cpp
# ${OVRDIR}/Shim/OVR_CAPIShim.c
# ${OVRDIR}/Shim/OVR_StereoProjection.cpp
#)
#target_include_directories(ovr PUBLIC ${OVRDIR}/Include ${OVRDIR}/../Logging)

# Resource Processor
set(OVR_SHADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen_shaders")
Expand All @@ -65,85 +67,85 @@ endfunction()
file(MAKE_DIRECTORY ${OVR_SHADER_DIR}/Shaders)

# === LibOVRKernel ===
set(OVRKDIR libs/libovr/OculusSDK/LibOVRKernel)
set(OVRKSDIR ${OVRKDIR}/Src/Util/Shaders)
add_library(ovrkernel STATIC
${OVRKDIR}/../Logging/src/internal/Logging_Tools.cpp
${OVRKDIR}/../Logging/src/Logging_Library.cpp
${OVRKDIR}/../Logging/src/Logging_OutputPlugins.cpp
${OVRKDIR}/Src/GL/CAPI_GLE.cpp
${OVRKDIR}/Src/Kernel/OVR_Alg.cpp
${OVRKDIR}/Src/Kernel/OVR_Allocator.cpp
${OVRKDIR}/Src/Kernel/OVR_Atomic.cpp
${OVRKDIR}/Src/Kernel/OVR_Callbacks.cpp
${OVRKDIR}/Src/Kernel/OVR_CRC32.cpp
${OVRKDIR}/Src/Kernel/OVR_DebugHelp.cpp
${OVRKDIR}/Src/Kernel/OVR_Error.cpp
${OVRKDIR}/Src/Kernel/OVR_File.cpp
${OVRKDIR}/Src/Kernel/OVR_FileFILE.cpp
${OVRKDIR}/Src/Kernel/OVR_JSON.cpp
${OVRKDIR}/Src/Kernel/OVR_Log.cpp
${OVRKDIR}/Src/Kernel/OVR_mach_exc_OSX.c
${OVRKDIR}/Src/Kernel/OVR_Rand.cpp
${OVRKDIR}/Src/Kernel/OVR_RefCount.cpp
${OVRKDIR}/Src/Kernel/OVR_SharedMemory.cpp
${OVRKDIR}/Src/Kernel/OVR_Std.cpp
${OVRKDIR}/Src/Kernel/OVR_String.cpp
${OVRKDIR}/Src/Kernel/OVR_String_FormatUtil.cpp
${OVRKDIR}/Src/Kernel/OVR_String_PathUtil.cpp
${OVRKDIR}/Src/Kernel/OVR_SysFile.cpp
${OVRKDIR}/Src/Kernel/OVR_System.cpp
${OVRKDIR}/Src/Kernel/OVR_ThreadsPthread.cpp
${OVRKDIR}/Src/Kernel/OVR_ThreadsWinAPI.cpp
${OVRKDIR}/Src/Kernel/OVR_Timer.cpp
${OVRKDIR}/Src/Kernel/OVR_UTF8Util.cpp
${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp
${OVRKDIR}/Src/Util/Util_Direct3D.cpp
${OVRKDIR}/Src/Util/Util_GL_Blitter.cpp
${OVRKDIR}/Src/Util/Util_ImageWindow.cpp
${OVRKDIR}/Src/Util/Util_LongPollThread.cpp
${OVRKDIR}/Src/Util/Util_SystemGUI.cpp
${OVRKDIR}/Src/Util/Util_SystemInfo.cpp
${OVRKDIR}/Src/Util/Util_Watchdog.cpp
)
target_include_directories(ovrkernel PUBLIC ${OVRKDIR}/Src)
target_include_directories(ovrkernel PRIVATE ${OVRKDIR}/../Logging/include)
target_link_libraries(ovrkernel ovr)
#set(OVRKDIR libs/libovr/OculusSDK/LibOVRKernel)
#set(OVRKSDIR ${OVRKDIR}/Src/Util/Shaders)
#add_library(ovrkernel STATIC
# ${OVRKDIR}/../Logging/src/internal/Logging_Tools.cpp
# ${OVRKDIR}/../Logging/src/Logging_Library.cpp
# ${OVRKDIR}/../Logging/src/Logging_OutputPlugins.cpp
# ${OVRKDIR}/Src/GL/CAPI_GLE.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Alg.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Allocator.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Atomic.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Callbacks.cpp
# ${OVRKDIR}/Src/Kernel/OVR_CRC32.cpp
# ${OVRKDIR}/Src/Kernel/OVR_DebugHelp.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Error.cpp
# ${OVRKDIR}/Src/Kernel/OVR_File.cpp
# ${OVRKDIR}/Src/Kernel/OVR_FileFILE.cpp
# ${OVRKDIR}/Src/Kernel/OVR_JSON.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Log.cpp
# ${OVRKDIR}/Src/Kernel/OVR_mach_exc_OSX.c
# ${OVRKDIR}/Src/Kernel/OVR_Rand.cpp
# ${OVRKDIR}/Src/Kernel/OVR_RefCount.cpp
# ${OVRKDIR}/Src/Kernel/OVR_SharedMemory.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Std.cpp
# ${OVRKDIR}/Src/Kernel/OVR_String.cpp
# ${OVRKDIR}/Src/Kernel/OVR_String_FormatUtil.cpp
# ${OVRKDIR}/Src/Kernel/OVR_String_PathUtil.cpp
# ${OVRKDIR}/Src/Kernel/OVR_SysFile.cpp
# ${OVRKDIR}/Src/Kernel/OVR_System.cpp
# ${OVRKDIR}/Src/Kernel/OVR_ThreadsPthread.cpp
# ${OVRKDIR}/Src/Kernel/OVR_ThreadsWinAPI.cpp
# ${OVRKDIR}/Src/Kernel/OVR_Timer.cpp
# ${OVRKDIR}/Src/Kernel/OVR_UTF8Util.cpp
# ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp
# ${OVRKDIR}/Src/Util/Util_Direct3D.cpp
# ${OVRKDIR}/Src/Util/Util_GL_Blitter.cpp
# ${OVRKDIR}/Src/Util/Util_ImageWindow.cpp
# ${OVRKDIR}/Src/Util/Util_LongPollThread.cpp
# ${OVRKDIR}/Src/Util/Util_SystemGUI.cpp
# ${OVRKDIR}/Src/Util/Util_SystemInfo.cpp
# ${OVRKDIR}/Src/Util/Util_Watchdog.cpp
#)
#target_include_directories(ovrkernel PUBLIC ${OVRKDIR}/Src)
#target_include_directories(ovrkernel PRIVATE ${OVRKDIR}/../Logging/include)
#target_link_libraries(ovrkernel ovr)

# Shader configuration
target_include_directories(ovrkernel PRIVATE ${OVR_SHADER_DIR})
# target_include_directories(ovrkernel PRIVATE ${OVR_SHADER_DIR})

set(OVRK_BLITTER ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp)
build_fx(${OVRKSDIR}/Blt_ps.hlsl ps_4_0 ${OVRK_BLITTER})
build_fx(${OVRKSDIR}/Blt_ps_ms2.hlsl ps_5_0 ${OVRK_BLITTER})
build_fx(${OVRKSDIR}/Blt_vs.hlsl vs_5_0 ${OVRK_BLITTER})

# === DrvOculus ===
add_library(DrvOculus STATIC
DrvOculus/DrvOculus.cpp
#add_library(DrvOculus STATIC
# DrvOculus/DrvOculus.cpp

DrvOculus/DrvOculusCommon.h
# DrvOculus/DrvOculusCommon.h

DrvOculus/OculusBackend.cpp
DrvOculus/OculusBackend.h
# DrvOculus/OculusBackend.cpp
# DrvOculus/OculusBackend.h

DrvOculus/OculusBackendSubmit.cpp
DrvOculus/OculusBackendMirror.cpp
DrvOculus/OculusBackendGuardian.cpp
# DrvOculus/OculusBackendSubmit.cpp
# DrvOculus/OculusBackendMirror.cpp
# DrvOculus/OculusBackendGuardian.cpp

DrvOculus/pub/DrvOculus.h
# DrvOculus/pub/DrvOculus.h

# Devices
DrvOculus/OculusDevice.cpp
DrvOculus/OculusDevice.h
# DrvOculus/OculusDevice.cpp
# DrvOculus/OculusDevice.h

DrvOculus/OculusHMD.cpp
DrvOculus/OculusHMD.h
)
target_include_directories(DrvOculus PUBLIC DrvOculus/pub)
target_include_directories(DrvOculus PRIVATE DrvOculus)
target_link_libraries(DrvOculus OpenVR ovr ovrkernel)
source_group(Public REGULAR_EXPRESSION DrvOculus/pub/*)
# DrvOculus/OculusHMD.cpp
# DrvOculus/OculusHMD.h
#)
#target_include_directories(DrvOculus PUBLIC DrvOculus/pub)
#target_include_directories(DrvOculus PRIVATE DrvOculus)
#target_link_libraries(DrvOculus OpenVR ovr ovrkernel)
#source_group(Public REGULAR_EXPRESSION DrvOculus/pub/*)

endif (WIN32)

Expand All @@ -163,22 +165,22 @@ add_library(OCCore STATIC
OpenOVR/stdafx.cpp

OpenOVR/API/OCBaseSystem.cpp
OpenOVR/Compositor/compositor.cpp
OpenOVR/Compositor/dx11compositor.cpp
OpenOVR/Compositor/dx10compositor.cpp
OpenOVR/Compositor/dx12compositor.cpp
OpenOVR/Compositor/glcompositor.cpp
OpenOVR/Compositor/vkcompositor.cpp
OpenOVR/convert.cpp
OpenOVR/libovr_wrapper.cpp
#OpenOVR/Compositor/compositor.cpp
#OpenOVR/Compositor/dx11compositor.cpp
#OpenOVR/Compositor/dx10compositor.cpp
#OpenOVR/Compositor/dx12compositor.cpp
#OpenOVR/Compositor/glcompositor.cpp
#OpenOVR/Compositor/vkcompositor.cpp
#OpenOVR/convert.cpp
#OpenOVR/libovr_wrapper.cpp
OpenOVR/logging.cpp
OpenOVR/Misc/audio_override.cpp
OpenOVR/Misc/Config.cpp
OpenOVR/Misc/debug_helper.cpp
OpenOVR/Misc/Haptics.cpp
OpenOVR/Misc/Keyboard/KeyboardLayout.cpp
OpenOVR/Misc/Keyboard/SudoFontMeta.cpp
OpenOVR/Misc/Keyboard/VRKeyboard.cpp
#OpenOVR/Misc/Haptics.cpp
#OpenOVR/Misc/Keyboard/KeyboardLayout.cpp
#OpenOVR/Misc/Keyboard/SudoFontMeta.cpp
#OpenOVR/Misc/Keyboard/VRKeyboard.cpp
OpenOVR/OpenOVR.cpp
OpenOVR/Reimpl/BaseApplications.cpp
OpenOVR/Reimpl/BaseChaperone.cpp
Expand Down Expand Up @@ -224,20 +226,20 @@ add_library(OCCore STATIC
OpenOVR/API/OCBaseSystem.h
OpenOVR/BaseCommon.h
OpenOVR/Compositor/compositor.h
OpenOVR/convert.h
#OpenOVR/convert.h
OpenOVR/custom_types.h
OpenOVR/libovr_wrapper.h
#OpenOVR/libovr_wrapper.h
OpenOVR/logging.h
OpenOVR/Misc/audio_override.h
OpenOVR/Misc/Config.h
OpenOVR/Misc/debug_helper.h
OpenOVR/Misc/Haptics.h
#OpenOVR/Misc/Haptics.h
OpenOVR/Misc/ini.h
OpenOVR/Misc/json/json-forwards.h
OpenOVR/Misc/json/json.h
OpenOVR/Misc/Keyboard/KeyboardLayout.h
OpenOVR/Misc/Keyboard/SudoFontMeta.h
OpenOVR/Misc/Keyboard/VRKeyboard.h
#OpenOVR/Misc/Keyboard/KeyboardLayout.h
#OpenOVR/Misc/Keyboard/SudoFontMeta.h
#OpenOVR/Misc/Keyboard/VRKeyboard.h
OpenOVR/Misc/lodepng.h
OpenOVR/Misc/ScopeGuard.h
OpenOVR/Reimpl/BaseApplications.h
Expand Down Expand Up @@ -325,7 +327,7 @@ add_library(OCCore STATIC
target_include_directories(OCCore PUBLIC OpenOVR) # TODO make this private and put the public headers elsewhere
target_include_directories(OCCore PRIVATE BundledLibs)
target_compile_definitions(OCCore PRIVATE -DSUPPORT_DX -DSUPPORT_GL -DSUPPORT_VK)
target_link_libraries(OCCore OpenVR ovr ovrkernel Vulkan)
target_link_libraries(OCCore OpenVR ovr Vulkan)

# Set up precompiled headers for OCCore
if (WIN32)
Expand All @@ -347,4 +349,4 @@ add_library(OCOVR SHARED
# Resources don't get nicely included in a library file
${OVR_RESOURCES}
)
target_link_libraries(OCOVR OCCore DrvOculus)
target_link_libraries(OCOVR OCCore)
6 changes: 3 additions & 3 deletions OCOVR/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
#include "Reimpl/Interfaces.h"

// Needed for the system-wide usage of this DLL (when renamed to vrclient[_x64].dll)
#include "Reimpl/GVRClientCore.gen.h"
// #include "Reimpl/GVRClientCore.gen.h"

#include "steamvr_abi.h"
#include "libovr_wrapper.h"
// #include "libovr_wrapper.h"
#include "Misc/debug_helper.h"
#include "Misc/audio_override.h"
#include "Misc/Config.h"
#include <map>
#include <memory>

#include "OVR_CAPI_Audio.h"
// #include "OVR_CAPI_Audio.h"

// Specific to OCOVR
#include "Drivers/Backend.h"
Expand Down
9 changes: 5 additions & 4 deletions OpenOVR/API/OCBaseSystem.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#include "stdafx.h"
#include "OCBaseSystem.h"

#include "libovr_wrapper.h"
#include "OVR_CAPI.h"
// #include "libovr_wrapper.h"
// #include "OVR_CAPI.h"

#include "ISystem_001.h"
using EVRExtendedButtonId = ocapi::IVROCSystem_001::EVRExtendedButtonId;

uint64_t OCBaseSystem::GetExtendedButtonStatus() {
uint64_t val = 0;
return 0;
/* uint64_t val = 0;
ovrInputState inputState;
ovrResult result = ovr_GetInputState(*ovr::session, ovrControllerType_Touch, &inputState);
Expand All @@ -23,5 +24,5 @@ uint64_t OCBaseSystem::GetExtendedButtonStatus() {
val |= vr::ButtonMaskFromId((vr::EVRButtonId) EVRExtendedButtonId::k_EButton_OVRMenu);
}
return val;
return val; */
}
1 change: 1 addition & 0 deletions OpenOVR/BaseCommon.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "OpenVR/interfaces/vrtypes.h"
#include <memory>

class CVRCommon {
public:
Expand Down
41 changes: 40 additions & 1 deletion OpenOVR/Drivers/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,46 @@
#include "../OpenOVR/custom_types.h" // TODO move this into the OpenVR tree

// for OOVR_Compositor_FrameTiming
#include "../OpenOVR/Reimpl/BaseCompositor.h"
// #include "../OpenOVR/Reimpl/BaseCompositor.h"

struct OOVR_Compositor_FrameTiming {
uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming )
uint32_t m_nFrameIndex;
uint32_t m_nNumFramePresents; // number of times this frame was presented
uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to
uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out
uint32_t m_nReprojectionFlags;

/** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */
double m_flSystemTimeInSeconds;

/** These times may include work from other processes due to OS scheduling.
* The fewer packets of work these are broken up into, the less likely this will happen.
* GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started
* processing that work earlier in the frame. */
float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit)
float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window)
float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work
float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc.
float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame
float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time)

/** Miscellaneous measured intervals. */
float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses
float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long)
float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure)
float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue)

/** The following are all relative to this frame's SystemTimeInSeconds */
float m_flWaitGetPosesCalledMs;
float m_flNewPosesReadyMs;
float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit
float m_flCompositorUpdateStartMs;
float m_flCompositorUpdateEndMs;
float m_flCompositorRenderStartMs;

vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame
};

enum ETrackingStateType {
/**
Expand Down
2 changes: 1 addition & 1 deletion OpenOVR/Misc/Haptics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "Haptics.h"
#include "libovr_wrapper.h"
// #include "libovr_wrapper.h"
#include <thread>
#include <chrono>
#include <future>
Expand Down
2 changes: 1 addition & 1 deletion OpenOVR/Misc/Haptics.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include <OVR_CAPI.h>
// #include <OVR_CAPI.h>

class Haptics {
public:
Expand Down
2 changes: 1 addition & 1 deletion OpenOVR/Misc/Keyboard/VRKeyboard.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "OVR_CAPI.h"
// #include "OVR_CAPI.h"

#include <d3d11.h>

Expand Down
2 changes: 1 addition & 1 deletion OpenOVR/Reimpl/BaseChaperone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define BASE_IMPL
#include "BaseChaperone.h"

#include "Drivers/Backend.h"
// #include "Drivers/Backend.h"

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion OpenOVR/Reimpl/BaseCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace std;
#endif

#include "Misc/ScopeGuard.h"
#include "Drivers/Backend.h"
// #include "Drivers/Backend.h"

using namespace vr;
using namespace IVRCompositor_022;
Expand Down
Loading

0 comments on commit 818b73f

Please sign in to comment.