diff --git a/Changes.md b/Changes.md index 19ce752663..e822003d23 100644 --- a/Changes.md +++ b/Changes.md @@ -12,6 +12,7 @@ Fixes - Plug : Fixed bug which meant nodes would fail to update if a newly created plug was renamed before being parented to the node. - Metadata : Fixed handling of exceptions thrown from value functions implemented in Python. These are now correctly translated into C++ exceptions. - Cycles, OSLObject, OSLImage, Expression : Fixed crashes when using OSL on macOS. +- Cycles : Use ccl::DeviceInfo's 'num' entry instead of typeIndex for the index representation of the GPU device number. 1.6.16.0 (relative to 1.6.15.0) ======== diff --git a/python/GafferCyclesUI/CyclesOptionsUI.py b/python/GafferCyclesUI/CyclesOptionsUI.py index a05748867e..6f8f9b45c1 100644 --- a/python/GafferCyclesUI/CyclesOptionsUI.py +++ b/python/GafferCyclesUI/CyclesOptionsUI.py @@ -239,10 +239,10 @@ def __registerDevicePresets() : typeIndices[device["type"]] += 1 presetNames.append( "{}/{}".format( device["type"], device["description"] ) ) - presetValues.append( "{}:{:02}".format( device["type"], typeIndex ) ) + presetValues.append( "{}:{:02}".format( device["type"], device["num"].value ) ) presetNames.append( "{}/{} + CPU".format( device["type"], device["description"] ) ) - presetValues.append( "CPU {}:{:02}".format( device["type"], typeIndex ) ) + presetValues.append( "CPU {}:{:02}".format( device["type"], device["num"].value ) ) for deviceType, count in typeIndices.items() : diff --git a/src/GafferCycles/IECoreCyclesPreview/Renderer.cpp b/src/GafferCycles/IECoreCyclesPreview/Renderer.cpp index 6ee574b2a2..78c2741722 100644 --- a/src/GafferCycles/IECoreCyclesPreview/Renderer.cpp +++ b/src/GafferCycles/IECoreCyclesPreview/Renderer.cpp @@ -2358,7 +2358,7 @@ ccl::DeviceInfo matchingDevices( const std::string &pattern, int threads, bool b { const string typeString = ccl::Device::string_from_type( device.type ); const int typeIndex = typeIndices[device.type]++; - const string name = fmt::format( "{}:{:02}", typeString, typeIndex ); + const string name = fmt::format( "{}:{:02}", typeString, device.num ); if( // e.g. "CPU" matches the first CPU device. ( typeIndex == 0 && StringAlgo::matchMultiple( typeString, pattern ) ) ||