[Bf-blender-cvs] [a6f951b4649] master: Cycles: make Hydra display driver optional, for USD without OpenGL

Brecht Van Lommel noreply at git.blender.org
Fri Apr 29 18:08:49 CEST 2022


Commit: a6f951b4649a126de22131833ca38d74f056d928
Author: Brecht Van Lommel
Date:   Fri Apr 29 18:03:03 2022 +0200
Branches: master
https://developer.blender.org/rBa6f951b4649a126de22131833ca38d74f056d928

Cycles: make Hydra display driver optional, for USD without OpenGL

OpenGL support was removed from Blender's USD precompiled libraries. This
is currently only useful when building against other applications anyway.

===================================================================

M	intern/cycles/hydra/CMakeLists.txt
M	intern/cycles/hydra/render_delegate.cpp
M	intern/cycles/hydra/render_pass.cpp

===================================================================

diff --git a/intern/cycles/hydra/CMakeLists.txt b/intern/cycles/hydra/CMakeLists.txt
index 72d5d0e3bf7..7b7ea43cfe5 100644
--- a/intern/cycles/hydra/CMakeLists.txt
+++ b/intern/cycles/hydra/CMakeLists.txt
@@ -26,7 +26,6 @@ set(INC_HD_CYCLES
   camera.h
   config.h
   curves.h
-  display_driver.h
   field.h
   geometry.h
   geometry.inl
@@ -48,7 +47,6 @@ set(SRC_HD_CYCLES
   attribute.cpp
   curves.cpp
   camera.cpp
-  display_driver.cpp
   field.cpp
   instancer.cpp
   light.cpp
@@ -73,6 +71,13 @@ if(WITH_OPENVDB)
   )
 endif()
 
+# Blender libraries do not include hgiGL, so build without display driver then.
+if(EXISTS ${USD_INCLUDE_DIR}/pxr/imaging/hgiGL)
+  add_definitions(-DWITH_HYDRA_DISPLAY_DRIVER)
+  list(APPEND SRC_HD_CYCLES display_driver.cpp)
+  list(APPEND INC_HD_CYCLES display_driver.h)
+endif()
+
 include_directories(${INC})
 include_directories(SYSTEM ${INC_SYS})
 
diff --git a/intern/cycles/hydra/render_delegate.cpp b/intern/cycles/hydra/render_delegate.cpp
index faefe9382e9..9ae0241260c 100644
--- a/intern/cycles/hydra/render_delegate.cpp
+++ b/intern/cycles/hydra/render_delegate.cpp
@@ -155,7 +155,7 @@ void HdCyclesDelegate::SetDrivers(const HdDriverVector &drivers)
 
 bool HdCyclesDelegate::IsDisplaySupported() const
 {
-#ifdef _WIN32
+#if defined(_WIN32) && defined(WITH_HYDRA_DISPLAY_DRIVER)
   return _hgi && _hgi->GetAPIName() == HgiTokens->OpenGL;
 #else
   return false;
diff --git a/intern/cycles/hydra/render_pass.cpp b/intern/cycles/hydra/render_pass.cpp
index 8f6f934b898..82fd6eff004 100644
--- a/intern/cycles/hydra/render_pass.cpp
+++ b/intern/cycles/hydra/render_pass.cpp
@@ -4,14 +4,19 @@
 
 #include "hydra/render_pass.h"
 #include "hydra/camera.h"
-#include "hydra/display_driver.h"
 #include "hydra/output_driver.h"
 #include "hydra/render_buffer.h"
 #include "hydra/render_delegate.h"
 #include "hydra/session.h"
+
+#ifdef WITH_HYDRA_DISPLAY_DRIVER
+#  include "hydra/display_driver.h"
+#endif
+
 #include "scene/camera.h"
 #include "scene/integrator.h"
 #include "scene/scene.h"
+
 #include "session/session.h"
 
 #include <pxr/imaging/hd/renderPassState.h>
@@ -32,8 +37,10 @@ HdCyclesRenderPass::HdCyclesRenderPass(HdRenderIndex *index,
   const auto renderDelegate = static_cast<const HdCyclesDelegate *>(
       GetRenderIndex()->GetRenderDelegate());
   if (renderDelegate->IsDisplaySupported()) {
+#ifdef WITH_HYDRA_DISPLAY_DRIVER
     session->set_display_driver(
         make_unique<HdCyclesDisplayDriver>(renderParam, renderDelegate->GetHgi()));
+#endif
   }
 }



More information about the Bf-blender-cvs mailing list