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
diff options
context:
space:
mode:
-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
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr.c7
4 files changed, 21 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);
};
diff --git a/source/blender/windowmanager/xr/intern/wm_xr.c b/source/blender/windowmanager/xr/intern/wm_xr.c
index 297205d1e79..8891840cb75 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr.c
@@ -35,6 +35,8 @@
#include "GHOST_C-api.h"
+#include "GPU_platform.h"
+
#include "WM_api.h"
#include "wm_surface.h"
@@ -91,6 +93,11 @@ bool wm_xr_init(wmWindowManager *wm)
if (G.debug & G_DEBUG_XR_TIME) {
create_info.context_flag |= GHOST_kXrContextDebugTime;
}
+#ifdef WIN32
+ if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_WIN, GPU_DRIVER_ANY)) {
+ create_info.context_flag |= GHOST_kXrContextGpuNVIDIA;
+ }
+#endif
if (!(context = GHOST_XrContextCreate(&create_info))) {
return false;