Commit 3409dd1d authored by Jeremy Tellaa's avatar Jeremy Tellaa Committed by jeremad

fix(apps): fix app compilation on windows

parent ae2aee72
......@@ -12,9 +12,9 @@
#include "ximeaDiscovery.hpp"
#include "ximeaReader.hpp"
#ifdef _MSC_VER
#ifdef DELAY_LOAD_ENABLED
SET_DELAY_LOAD_HOOK
#endif // _MSC_VER
#endif // DELAY_LOAD_ENABLED
extern "C" VS_PLUGINS_EXPORT VideoStitch::Potential<VideoStitch::Input::Reader>* __cdecl createReaderFn(
const VideoStitch::Ptv::Value* config, VideoStitch::Plugin::VSReaderPlugin::Config runtime) {
......
......@@ -196,7 +196,7 @@ Matrix4 SteamVRRenderer::getHMDMatrixProjectionEye(vr::Hmd_Eye eye) {
return Matrix4();
}
vr::HmdMatrix44_t mat = hmd->GetProjectionMatrix(eye, nearClip, farClip, vr::API_OpenGL);
vr::HmdMatrix44_t mat = hmd->GetProjectionMatrix(eye, nearClip, farClip);
return Matrix4(mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0], mat.m[0][1], mat.m[1][1], mat.m[2][1], mat.m[3][1],
mat.m[0][2], mat.m[1][2], mat.m[2][2], mat.m[3][2], mat.m[0][3], mat.m[1][3], mat.m[2][3],
mat.m[3][3]);
......@@ -284,10 +284,11 @@ void SteamVRRenderer::setupDistortion() {
u = x * w;
v = 1 - y * h;
vert.position = Vector2(Xoffset + u, -1 + 2 * y * h);
vr::DistortionCoordinates_t dc0 = hmd->ComputeDistortion(vr::Eye_Left, u, v);
vert.texCoordRed = Vector2(dc0.rfRed[0], 1 - dc0.rfRed[1]);
vert.texCoordGreen = Vector2(dc0.rfGreen[0], 1 - dc0.rfGreen[1]);
vert.texCoordBlue = Vector2(dc0.rfBlue[0], 1 - dc0.rfBlue[1]);
vr::DistortionCoordinates_t *dc0;
hmd->ComputeDistortion(vr::Eye_Left, u, v, dc0);
vert.texCoordRed = Vector2(dc0->rfRed[0], 1 - dc0->rfRed[1]);
vert.texCoordGreen = Vector2(dc0->rfGreen[0], 1 - dc0->rfGreen[1]);
vert.texCoordBlue = Vector2(dc0->rfBlue[0], 1 - dc0->rfBlue[1]);
vertices.push_back(vert);
}
}
......@@ -299,10 +300,11 @@ void SteamVRRenderer::setupDistortion() {
u = x * w;
v = 1 - y * h;
vert.position = Vector2(Xoffset + u, -1 + 2 * y * h);
vr::DistortionCoordinates_t dc0 = hmd->ComputeDistortion(vr::Eye_Right, u, v);
vert.texCoordRed = Vector2(dc0.rfRed[0], 1 - dc0.rfRed[1]);
vert.texCoordGreen = Vector2(dc0.rfGreen[0], 1 - dc0.rfGreen[1]);
vert.texCoordBlue = Vector2(dc0.rfBlue[0], 1 - dc0.rfBlue[1]);
vr::DistortionCoordinates_t *dc0;
hmd->ComputeDistortion(vr::Eye_Right, u, v, dc0);
vert.texCoordRed = Vector2(dc0->rfRed[0], 1 - dc0->rfRed[1]);
vert.texCoordGreen = Vector2(dc0->rfGreen[0], 1 - dc0->rfGreen[1]);
vert.texCoordBlue = Vector2(dc0->rfBlue[0], 1 - dc0->rfBlue[1]);
vertices.push_back(vert);
}
}
......@@ -668,9 +670,10 @@ void SteamVRRenderer::render() {
renderStereoTargets();
renderDistortion();
vr::Texture_t leftEyeTexture = {(void *)leftEyeDesc.resolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma};
vr::Texture_t leftEyeTexture = {(void *)leftEyeDesc.resolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma};
vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture);
vr::Texture_t rightEyeTexture = {(void *)rightEyeDesc.resolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma};
vr::Texture_t rightEyeTexture = {(void *)rightEyeDesc.resolveTextureId, vr::TextureType_OpenGL,
vr::ColorSpace_Gamma};
vr::VRCompositor()->Submit(vr::Eye_Right, &rightEyeTexture);
}
......@@ -794,9 +797,9 @@ void SteamVRRenderer::renderVideoFrame(vr::Hmd_Eye eye) {
}
}
bool isInputCapturedByAnotherProcess = hmd->IsInputFocusCapturedByAnotherProcess();
bool isInputAvailable = hmd->IsInputAvailable();
if (!isInputCapturedByAnotherProcess) {
if (isInputAvailable) {
// draw the controller axis lines
glUseProgram(controllerTransformProgramID);
glUniformMatrix4fv(controllerMatrixLocation, 1, GL_FALSE, getCurrentViewProjectionMatrix(eye).get());
......@@ -818,7 +821,7 @@ void SteamVRRenderer::renderVideoFrame(vr::Hmd_Eye eye) {
continue;
}
if (isInputCapturedByAnotherProcess &&
if (!isInputAvailable &&
hmd->GetTrackedDeviceClass(trackedDevice) == vr::TrackedDeviceClass_Controller) {
continue;
}
......@@ -872,7 +875,7 @@ void SteamVRRenderer::renderDistortion() {
void SteamVRRenderer::drawControllers() {
// don't draw controllers if somebody else has input focus
if (hmd->IsInputFocusCapturedByAnotherProcess()) {
if (!hmd->IsInputAvailable()) {
return;
}
......@@ -1007,7 +1010,7 @@ void SteamVRRenderer::updateHMDMatrixPose() {
case vr::TrackedDeviceClass_Invalid:
devClassChar[device] = 'I';
break;
case vr::TrackedDeviceClass_Other:
case vr::TrackedDeviceClass_GenericTracker:
devClassChar[device] = 'O';
break;
case vr::TrackedDeviceClass_TrackingReference:
......
......@@ -27,7 +27,7 @@ if (WINDOWS)
include_directories("${NVIDIA_VIDEO_CODEC}\\include")
find_library(CUDA cuda PATHS "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" NO_DEFAULT_PATH)
find_library(CUDART cudart PATHS "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" NO_DEFAULT_PATH)
find_library(CUVID nvcuvid PATHS "${NVIDIA_VIDEO_CODEC}\\Lib\\Win32")
find_library(CUVID nvcuvid PATHS "${NVIDIA_VIDEO_CODEC}\\Lib\\x64")
find_library(NVML nvml PATHS "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" NO_DEFAULT_PATH)
endif(WINDOWS)
......
......@@ -233,7 +233,7 @@ FrameworkStatus DevicesInfo::getFrameworkStatus(Framework framework) const {
}
DevicesInfo::DevicesInfo() {
#ifdef _MSC_VER
#ifdef DELAY_LOAD_ENABLED
PfnDliHook currentFailHook = __pfnDliFailureHook2;
__pfnDliFailureHook2 = failDelayHook;
try {
......
......@@ -27,7 +27,9 @@
#ifdef _MSC_VER
#include <libgpudiscovery/delayLoad.hpp>
#ifdef DELAY_LOAD_ENABLED
SET_DELAY_LOAD_HOOK
#endif // DELAY_LOAD_ENABLED
FARPROC WINAPI delayFailureHook(unsigned dliNotify, PDelayLoadInfo pdli) {
switch (dliNotify) {
case dliFailLoadLib:
......
......@@ -26,7 +26,6 @@ file(MAKE_DIRECTORY ${VS_TEST_DATA_DIR})
if (WINDOWS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4244 /wd4245 /wd4267 /wd4305 /wd4309 /wd4324")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
STRING(REPLACE "INCREMENTAL" "INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
endif(WINDOWS)
......
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