Skip to content

Commit

Permalink
Fix a HdTask::_GetDriver casting error.
Browse files Browse the repository at this point in the history
* In some cases, HdTask::_GetDriver could erroneously return null
  due to a casting error from an HdDriver to a platform hgi, this fixes
  that.

Signed-off-by: furby™ <[email protected]>
  • Loading branch information
furby-tm committed Dec 28, 2024
1 parent 6aa00cd commit aeeb9d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,7 @@ let package = Package(
.target(name: "CameraUtil"),
.target(name: "Hf"),
.target(name: "PxOsd"),
.target(name: "HgiInterop"),
],
resources: [
.process("Resources"),
Expand Down
7 changes: 5 additions & 2 deletions Sources/Hd/include/Hd/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "Hd/sceneDelegate.h"

#include "HgiInterop/hgiInteropImpl.h"

#include "Sdf/path.h"
#include "Tf/hashmap.h"
#include "Vt/dictionary.h"
Expand Down Expand Up @@ -232,8 +234,9 @@ template<class T> T HdTask::_GetDriver(HdTaskContext const *ctx, TfToken const &
HdDriverVector const &drivers = value.UncheckedGet<HdDriverVector>();
for (HdDriver *hdDriver : drivers) {
if (hdDriver->name == driverName) {
if (hdDriver->driver.IsHolding<T>()) {
return hdDriver->driver.UncheckedGet<T>();
Hgi *platformHgi = HgiInterop::GetHgiFromDriver(hdDriver->driver);
if (platformHgi) {
return platformHgi;
}
}
}
Expand Down

0 comments on commit aeeb9d4

Please sign in to comment.