Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorPeter Kim <pk15950@gmail.com>2021-09-10 07:01:14 +0300
committerPeter Kim <pk15950@gmail.com>2021-09-10 07:19:43 +0300
commit82ab2c167844627ccda4ac0e439f322fcea07173 (patch)
treee8a2c4e9f7faf337b8fe8364d7212061a0d09153 /intern
parentee3b4e8420928a03e9158489a87d5daa34ee302f (diff)
XR: Re-enable SteamVR OpenGL backend for AMD gpus
Addresses T76082. Since the DirectX backend does not work for AMD gpus (wglDXRegisterObjectNV() fails to register the shared OpenGL-DirectX render buffer, displaying a pink screen to the user), the original solution was to use SteamVR's OpenGL backend, which, as tested recently, seems to work without any issues on AMD hardware. However, the SteamVR OpenGL backend (on Windows) was disabled in fe492d922d6d since it resulted in crashes with NVIDIA gpus (and still crashes, as tested recently), so SteamVR would always use the AMD-incompatible DirectX backend (on Windows). This patch restores use of the SteamVR OpenGL backend for non-NVIDIA (AMD, etc.) gpus while maintaining the DirectX workaround for NVIDIA gpus. In this way, issues are still resolved on the NVIDIA side but AMD users can once again use the SteamVR runtime, which may be their only viable option of using Blender in VR. Reviewed By: Julian Eisel Differential Revision: https://developer.blender.org/D12409
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_Types.h5
-rw-r--r--intern/ghost/intern/GHOST_XrContext.cpp12
-rw-r--r--intern/ghost/intern/GHOST_XrContext.h3
3 files changed, 14 insertions, 6 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index e46f712cb64..221fa140f70 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -652,6 +652,11 @@ typedef struct {
enum {
GHOST_kXrContextDebug = (1 << 0),
GHOST_kXrContextDebugTime = (1 << 1),
+# ifdef WIN32
+ /* Needed to avoid issues with the SteamVR OpenGL graphics binding (use DirectX fallback
+ instead). */
+ GHOST_kXrContextGpuNVIDIA = (1 << 2),
+# endif
};
typedef struct {
diff --git a/intern/ghost/intern/GHOST_XrContext.cpp b/intern/ghost/intern/GHOST_XrContext.cpp
index 98c87232882..f6b3caa3ec7 100644
--- a/intern/ghost/intern/GHOST_XrContext.cpp
+++ b/intern/ghost/intern/GHOST_XrContext.cpp
@@ -99,7 +99,7 @@ void GHOST_XrContext::initialize(const GHOST_XrContextCreateInfo *create_info)
storeInstanceProperties();
/* Multiple bindings may be enabled. Now that we know the runtime in use, settle for one. */
- m_gpu_binding_type = determineGraphicsBindingTypeToUse(graphics_binding_types);
+ m_gpu_binding_type = determineGraphicsBindingTypeToUse(graphics_binding_types, create_info);
printInstanceInfo();
if (isDebugMode()) {
@@ -473,14 +473,16 @@ std::vector<GHOST_TXrGraphicsBinding> GHOST_XrContext::determineGraphicsBindingT
}
GHOST_TXrGraphicsBinding GHOST_XrContext::determineGraphicsBindingTypeToUse(
- const std::vector<GHOST_TXrGraphicsBinding> &enabled_types)
+ const std::vector<GHOST_TXrGraphicsBinding> &enabled_types,
+ const GHOST_XrContextCreateInfo *create_info)
{
/* Return the first working type. */
for (GHOST_TXrGraphicsBinding type : enabled_types) {
#ifdef WIN32
- /* The SteamVR OpenGL backend fails currently. Disable it and allow falling back to the DirectX
- * one. */
- if ((m_runtime_id == OPENXR_RUNTIME_STEAMVR) && (type == GHOST_kXrGraphicsOpenGL)) {
+ /* The SteamVR OpenGL backend currently fails for NVIDIA gpus. Disable it and allow falling
+ * back to the DirectX one. */
+ if ((m_runtime_id == OPENXR_RUNTIME_STEAMVR) && (type == GHOST_kXrGraphicsOpenGL) &&
+ ((create_info->context_flag & GHOST_kXrContextGpuNVIDIA) != 0)) {
continue;
}
#endif
diff --git a/intern/ghost/intern/GHOST_XrContext.h b/intern/ghost/intern/GHOST_XrContext.h
index 26fc374b957..479b50e1537 100644
--- a/intern/ghost/intern/GHOST_XrContext.h
+++ b/intern/ghost/intern/GHOST_XrContext.h
@@ -139,5 +139,6 @@ class GHOST_XrContext : public GHOST_IXrContext {
std::vector<GHOST_TXrGraphicsBinding> determineGraphicsBindingTypesToEnable(
const GHOST_XrContextCreateInfo *create_info);
GHOST_TXrGraphicsBinding determineGraphicsBindingTypeToUse(
- const std::vector<GHOST_TXrGraphicsBinding> &enabled_types);
+ const std::vector<GHOST_TXrGraphicsBinding> &enabled_types,
+ const GHOST_XrContextCreateInfo *create_info);
};