Skip to content

Commit

Permalink
UsdView: disable 'UsdImagingGL.Engine' on iOS.
Browse files Browse the repository at this point in the history
* Embedded apple platforms do not support OpenGL,
  will need to create a Metal equivalent, for Storm as well.

Signed-off-by: furby™ <devs@wabi.foundation>
  • Loading branch information
furby-tm committed Sep 16, 2024
1 parent 77d26fe commit bb5959f
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions Sources/UsdView/Hydra+MTLRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ import PixarUSD
var device: MTLDevice!

var stage: UsdStageRefPtr
var engine: UsdImagingGL.EngineSharedPtr

#if canImport(UsdImagingGL)
/// UsdImagingGL is not available on iOS.
var engine: UsdImagingGL.EngineSharedPtr
#endif // canImport(UsdImagingGL)

public init(metalView: MTKView)
{
Expand All @@ -43,13 +47,17 @@ import PixarUSD
stage = Usd.Stage.createInMemory()

let driver = HdDriver(name: .renderDriver, driver: hgi.value)
engine = UsdImagingGL.Engine.createEngine(
rootPath: stage.getPseudoRoot().getPath(),
excludedPaths: Sdf.PathVector(),
invisedPaths: Sdf.PathVector(),
sceneDelegateId: Sdf.Path.absoluteRootPath(),
driver: driver
)

#if canImport(UsdImagingGL)
// UsdImagingGL is not available on iOS.
engine = UsdImagingGL.Engine.createEngine(
rootPath: stage.getPseudoRoot().getPath(),
excludedPaths: Sdf.PathVector(),
invisedPaths: Sdf.PathVector(),
sceneDelegateId: Sdf.Path.absoluteRootPath(),
driver: driver
)
#endif // canImport(UsdImagingGL)

metalView.device = hgi.device
}
Expand All @@ -59,8 +67,11 @@ import PixarUSD
self.init(metalView: MTKView())
self.stage = stage

engine.setEnablePresentation(false)
engine.setRenderer(aov: .color)
#if canImport(UsdImagingGL)
// UsdImagingGL is not available on iOS.
engine.setEnablePresentation(false)
engine.setRenderer(aov: .color)
#endif // canImport(UsdImagingGL)
}

public func info()
Expand Down

0 comments on commit bb5959f

Please sign in to comment.