Skip to content
Snippets Groups Projects

Fix lava-extras-pack to always search for the glsl validator

Open Peter Esser requested to merge pesser-windows-fixes into master
2 files
+ 20
22
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -9,9 +9,7 @@
namespace lava {
namespace openvr {
template<class F>
static void with_vr(F&& f, bool close = true) {
template <class F> static void with_vr(F &&f, bool close = true) {
::vr::HmdError err;
std::cout << "VR_INIT" << std::endl;
::vr::VR_Init(&err, ::vr::VRApplication_Scene);
@@ -43,7 +41,6 @@ OpenVRHmd::OpenVRHmd() {
OpenVRHmd::~OpenVRHmd() { ::vr::VR_Shutdown(); }
std::vector<const char *> OpenVRHmd::instanceExtensions() {
std::vector<const char *> result;
static char openvr[1024];
with_vr([&]() {
@@ -62,7 +59,8 @@ std::vector<const char *> OpenVRHmd::deviceExtensions() {
std::vector<const char *> result;
static char openvr[1024];
with_vr([&]() {
::vr::VRCompositor()->GetVulkanDeviceExtensionsRequired(mPhy, openvr, 1024);
::vr::VRCompositor()->GetVulkanDeviceExtensionsRequired(mPhy, openvr,
1024);
});
if (char *tok = strtok(openvr, " ")) {
do {
@@ -73,12 +71,9 @@ std::vector<const char *> OpenVRHmd::deviceExtensions() {
return result;
}
void OpenVRHmd::onPhysicalDeviceSelected(vk::PhysicalDevice phy) {
mPhy = phy;
}
void OpenVRHmd::onPhysicalDeviceSelected(vk::PhysicalDevice phy) { mPhy = phy; }
void OpenVRHmd::onLogicalDeviceCreated(const SharedDevice &)
{
void OpenVRHmd::onLogicalDeviceCreated(const SharedDevice &) {
::vr::HmdError err;
std::cout << "VR_INIT" << std::endl;
::vr::VR_Init(&err, ::vr::VRApplication_Scene);
@@ -136,7 +131,7 @@ void OpenVRHmd::submitDistortedEye(uint32_t index, const SharedImage &image) {
auto error =
::vr::VRCompositor()->Submit(::vr::EVREye(index), &tex, nullptr,
::vr::Submit_LensDistortionAlreadyApplied);
::vr::Submit_LensDistortionAlreadyApplied);
if (error != ::vr::VRCompositorError_None) {
lava::error() << error;
}
@@ -144,8 +139,8 @@ void OpenVRHmd::submitDistortedEye(uint32_t index, const SharedImage &image) {
void OpenVRHmd::fetchTrackingData() {
if (::vr::VRCompositor()) {
auto err = ::vr::VRCompositor()->WaitGetPoses(mPoses.data(),
mPoses.size(), nullptr, 0);
auto err = ::vr::VRCompositor()->WaitGetPoses(
mPoses.data(), mPoses.size(), nullptr, 0);
if (err != ::vr::VRCompositorError_None) {
std::cout << "Tracking::update() something wrong: " << err
<< std::endl;
@@ -183,20 +178,20 @@ glm::mat4x4 OpenVRHmd::getCombinedEyeViewMatrix(uint32_t i) const {
glm::mat4x4 OpenVRHmd::getProjectionMatrix(uint32_t i) const {
float left, right, top, bottom;
::vr::VRSystem()->GetProjectionRaw(::vr::EVREye(i), &left, &right, &top,
&bottom);
&bottom);
float near = 0.01f;
float nearPlane = 0.01f;
float a = 2.0 / (right - left);
float b = 2.0 / (bottom - top);
float c = (right + left) / (right - left);
float d = (bottom + top) / (bottom - top);
glm::mat4 result = {a, 0.0f, 0.0f, 0.0f, //
0.0f, -b, 0.0f, 0.0f, //
c, d, 0.0f, -1.0f, //
0.0f, 0.0f, near, 0.0f};
glm::mat4 result = {a, 0.0f, 0.0f, 0.0f, //
0.0f, -b, 0.0f, 0.0f, //
c, d, 0.0f, -1.0f, //
0.0f, 0.0f, nearPlane, 0.0f};
return result;
}
} // namespace openvr
} // namespace lava
} // namespace lava
\ No newline at end of file
Loading