diff --git a/.github/workflows/main/installDependencies.py b/.github/workflows/main/installDependencies.py index 375b46d613a..21acacf4a15 100755 --- a/.github/workflows/main/installDependencies.py +++ b/.github/workflows/main/installDependencies.py @@ -49,7 +49,7 @@ # Determine default archive URL. -defaultURL = "https://github.com/GafferHQ/dependencies/releases/download/8.0.0a9/gafferDependencies-8.0.0a9-{platform}{buildEnvironment}.{extension}" +defaultURL = "https://github.com/GafferHQ/dependencies/releases/download/8.0.0a10/gafferDependencies-8.0.0a10-{platform}{buildEnvironment}.{extension}" # Parse command line arguments. diff --git a/Changes.md b/Changes.md index 5e5953b52fd..bf31a21c240 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,11 @@ 1.4.x.x (relative to 1.4.0.0b6) ======= +Features +-------- + +- Cycles : Added support for CUDA and Optix devices on Windows [^1]. + Improvements ------------ diff --git a/SConstruct b/SConstruct index 265463c3d23..c010cc56f0e 100644 --- a/SConstruct +++ b/SConstruct @@ -1360,7 +1360,7 @@ libraries = { "LIBS" : [ "Gaffer", "GafferScene", "GafferDispatch", "GafferBindings", "GafferCycles", "IECoreScene", "cycles_session", "cycles_scene", "cycles_graph", "cycles_bvh", "cycles_device", "cycles_kernel", "cycles_kernel_osl", - "cycles_integrator", "cycles_util", "cycles_subd", "extern_sky", + "cycles_integrator", "cycles_util", "cycles_subd", "extern_sky", "extern_cuew", "OpenImageIO$OIIO_LIB_SUFFIX", "OpenImageIO_Util$OIIO_LIB_SUFFIX", "oslexec$OSL_LIB_SUFFIX", "openvdb$VDB_LIB_SUFFIX", "oslquery$OSL_LIB_SUFFIX", "Alembic", "osdCPU", "OpenColorIO$OCIO_LIB_SUFFIX", "embree4", "Iex", "openpgl", ], @@ -1503,11 +1503,16 @@ for library in ( "GafferUI", ) : if env["PLATFORM"] == "win32" : - for library in ( "Gaffer", ) : + for library in ( "Gaffer", "GafferCycles", ) : libraries[library].setdefault( "envAppends", {} ) libraries[library]["envAppends"].setdefault( "LIBS", [] ).extend( [ "Advapi32" ] ) + for library in ( "GafferCycles", ) : + + libraries[library].setdefault( "pythonEnvAppends", {} ) + libraries[library]["pythonEnvAppends"].setdefault( "LIBS", [] ).extend( [ "Advapi32" ] ) + else : libraries["GafferCycles"]["envAppends"]["LIBS"].extend( [ "dl" ] ) diff --git a/include/GafferCycles/IECoreCyclesPreview/IECoreCycles.h b/include/GafferCycles/IECoreCyclesPreview/IECoreCycles.h index 079da39b707..b057be7757c 100644 --- a/include/GafferCycles/IECoreCyclesPreview/IECoreCycles.h +++ b/include/GafferCycles/IECoreCyclesPreview/IECoreCycles.h @@ -47,6 +47,10 @@ IECORE_POP_DEFAULT_VISIBILITY namespace IECoreCycles { +/// Returns the value of the `CYCLES_ROOT` environment variable, or +/// and empty string if the variable is not defined. +IECORECYCLES_API const char *cyclesRoot(); + /// Initialises the library using the CYCLES_ROOT environment /// variable, which should point to the root of a Cycles installation. IECORECYCLES_API bool init(); diff --git a/src/GafferCycles/IECoreCyclesPreview/IECoreCycles.cpp b/src/GafferCycles/IECoreCyclesPreview/IECoreCycles.cpp index bae2a7114ae..10e68241369 100644 --- a/src/GafferCycles/IECoreCyclesPreview/IECoreCycles.cpp +++ b/src/GafferCycles/IECoreCyclesPreview/IECoreCycles.cpp @@ -56,23 +56,28 @@ std::string cyclesVersion = CYCLES_VERSION_STRING; namespace IECoreCycles { -bool init() +const char *cyclesRoot() { const char *cyclesRoot = getenv( "CYCLES_ROOT" ); if( !cyclesRoot ) { IECore::msg( IECore::Msg::Error, "IECoreCycles::init", "CYCLES_ROOT environment variable not set" ); - return false; + return ""; } + return cyclesRoot; +} - auto kernelFile = std::filesystem::path( cyclesRoot ) / "source" / "kernel" / "types.h"; +bool init() +{ + const char *cyclesRootValue = cyclesRoot(); + auto kernelFile = std::filesystem::path( cyclesRootValue ) / "source" / "kernel" / "types.h"; if( !std::filesystem::is_regular_file( kernelFile ) ) { IECore::msg( IECore::Msg::Error, "IECoreCycles::init", fmt::format( "File \"{}\" not found", kernelFile ) ); return false; } - ccl::path_init( cyclesRoot ); + ccl::path_init( cyclesRootValue ); // This is a global thing for logging const char* argv[] = { "-", "v", "1" }; diff --git a/src/GafferCyclesModule/GafferCyclesModule.cpp b/src/GafferCyclesModule/GafferCyclesModule.cpp index b7612d7f788..2e568866da7 100644 --- a/src/GafferCyclesModule/GafferCyclesModule.cpp +++ b/src/GafferCyclesModule/GafferCyclesModule.cpp @@ -58,6 +58,7 @@ #include "device/device.h" #include "graph/node.h" #include "util/openimagedenoise.h" +#include "util/path.h" namespace py = boost::python; using namespace boost::python; @@ -453,6 +454,10 @@ BOOST_PYTHON_MODULE( _GafferCycles ) IECoreCycles::init(); + // Must be initialized to ensure the statically linked Cycles module + // we are linked to can find the binaries for GPU rendering. + ccl::path_init( IECoreCycles::cyclesRoot() ); + py::scope().attr( "devices" ) = getDevices(); py::scope().attr( "nodes" ) = getNodes(); py::scope().attr( "shaders" ) = getShaders();