From ed1fb242a8ec7d60e6a2129ada0011d17810e6d6 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 7 May 2020 13:57:36 +0200 Subject: Fix T76469: OpenCL 1.2 Compilation Recent changes assumed OpenCL 2.0 platform. This adds a check to see if we are compiling on an OpenCL 2.0 platform. Patch was tested on: * AMD Radeon Pro WX 7100 with amdgpu-pro-19.50-1011208-ubuntu-18.04 drivers * AMD Vega 64 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers * AMD RX 5700 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers Reviewed By: Brecht van Lommel Differential Revision: https://developer.blender.org/D7637 --- intern/cycles/kernel/kernel_compat_opencl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/cycles/kernel/kernel_compat_opencl.h b/intern/cycles/kernel/kernel_compat_opencl.h index 35dc95ca10d..ba7ab43a47a 100644 --- a/intern/cycles/kernel/kernel_compat_opencl.h +++ b/intern/cycles/kernel/kernel_compat_opencl.h @@ -43,12 +43,17 @@ #define ccl_local __local #define ccl_local_param __local #define ccl_private __private -#define ccl_loop_no_unroll __attribute__((opencl_unroll_hint(1))) #define ccl_restrict restrict #define ccl_ref #define ccl_align(n) __attribute__((aligned(n))) #define ccl_optional_struct_init +#if __OPENCL_VERSION__ >= 200 +# define ccl_loop_no_unroll __attribute__((opencl_unroll_hint(1))) +#else +# define ccl_loop_no_unroll +#endif + #ifdef __SPLIT_KERNEL__ # define ccl_addr_space __global #else -- cgit v1.2.3 From 1c0e22b98294f639036c001c72980dd2e49f62b4 Mon Sep 17 00:00:00 2001 From: Nicolas Fauvet Date: Thu, 7 May 2020 14:00:49 +0200 Subject: VR: Fix OpenXR state freeze on Oculus after taking off HMD With the Oculus runtime, the VR session would freeze when taking off the HMD and putting it back on. This was caused by the deletion of graphics resources too early in the OpenXR state machine, at least for Oculus. The resources will now only be freed once the session is actually destroyed. Also fixes an issue where it wasn't possible to stop the session via the UI when the HMD was taken off. Reviewed By: Julian Eisel Differential Revision: https://developer.blender.org/D7635 --- intern/ghost/intern/GHOST_XrContext.cpp | 9 ++++++++- intern/ghost/intern/GHOST_XrSession.cpp | 21 ++++++++++----------- intern/ghost/intern/GHOST_XrSession.h | 3 ++- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_XrContext.cpp b/intern/ghost/intern/GHOST_XrContext.cpp index 2cd5b2ca8c8..3aab420a9b6 100644 --- a/intern/ghost/intern/GHOST_XrContext.cpp +++ b/intern/ghost/intern/GHOST_XrContext.cpp @@ -465,7 +465,14 @@ void GHOST_XrContext::startSession(const GHOST_XrSessionBeginInfo *begin_info) void GHOST_XrContext::endSession() { - m_session->requestEnd(); + if (m_session) { + if (m_session->isRunning()) { + m_session->requestEnd(); + } + else { + m_session = nullptr; + } + } } bool GHOST_XrContext::isSessionRunning() const diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index 1f24f2fb37f..edc4960cf32 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -203,13 +203,17 @@ void GHOST_XrSession::requestEnd() xrRequestExitSession(m_oxr->session); } -void GHOST_XrSession::end() +void GHOST_XrSession::beginSession() { - assert(m_oxr->session != XR_NULL_HANDLE); + XrSessionBeginInfo begin_info = {XR_TYPE_SESSION_BEGIN_INFO}; + begin_info.primaryViewConfigurationType = m_oxr->view_type; + CHECK_XR(xrBeginSession(m_oxr->session, &begin_info), "Failed to cleanly begin the VR session."); +} +void GHOST_XrSession::endSession() +{ + assert(m_oxr->session != XR_NULL_HANDLE); CHECK_XR(xrEndSession(m_oxr->session), "Failed to cleanly end the VR session."); - unbindGraphicsContext(); - m_draw_info = nullptr; } GHOST_XrSession::LifeExpectancy GHOST_XrSession::handleStateChangeEvent( @@ -222,16 +226,11 @@ GHOST_XrSession::LifeExpectancy GHOST_XrSession::handleStateChangeEvent( switch (lifecycle->state) { case XR_SESSION_STATE_READY: { - XrSessionBeginInfo begin_info = {XR_TYPE_SESSION_BEGIN_INFO}; - - begin_info.primaryViewConfigurationType = m_oxr->view_type; - CHECK_XR(xrBeginSession(m_oxr->session, &begin_info), - "Failed to cleanly begin the VR session."); + beginSession(); break; } case XR_SESSION_STATE_STOPPING: - /* Runtime will change state to STATE_EXITING, don't destruct session yet. */ - end(); + endSession(); break; case XR_SESSION_STATE_EXITING: case XR_SESSION_STATE_LOSS_PENDING: diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h index 39e1a63ffda..da0128b2851 100644 --- a/intern/ghost/intern/GHOST_XrSession.h +++ b/intern/ghost/intern/GHOST_XrSession.h @@ -68,7 +68,8 @@ class GHOST_XrSession { std::unique_ptr m_draw_info; void initSystem(); - void end(); + void beginSession(); + void endSession(); void bindGraphicsContext(); -- cgit v1.2.3