Description
RenderContextManager.newCGContext returns RiveRendererContext (Metal-based) instead of CGRendererContext (CoreGraphics-based). This means setting defaultRenderer = .cgRenderer has no effect — the Metal renderer is always used.
Introduced in
Commit 7aa9afaf ("refactor(apple): use new render context per file and view (#9838)"), included in v6.9.4+.
Before this commit, there was a getCGRendererContext method that correctly returned the CG renderer. The refactoring replaced it with newCGContext, but the implementation was changed to return RiveRendererContext:
// RenderContextManager.mm line 432-435 (v6.15.1)
- (RenderContext*)newCGContext
{
return [[RiveRendererContext alloc] init]; // ← should be CGRendererContext
}
Expected behavior
- (RenderContext*)newCGContext
{
return [[CGRendererContext alloc] init];
}
Impact
RenderContextManager.shared().defaultRenderer = .cgRenderer does not switch to CoreGraphics
- Users cannot fall back to CG renderer (e.g., for snapshot testing or CPU-only rendering environments)
- The
CGRendererContext class exists in the codebase but is unreachable
Context
We discovered this while investigating snapshot testing with swift-snapshot-testing. The default CALayer.render(in: CGContext) crashes (SIGBUS) on Metal-backed RiveView layers. We hoped to switch to CG renderer as a workaround, but found this bug.
Related: #263 (snapshot testing), #380 (try! in constructors)
Device & Versions
- rive-ios: 6.15.1
- Xcode: 26.3
- iOS: any
Description
RenderContextManager.newCGContextreturnsRiveRendererContext(Metal-based) instead ofCGRendererContext(CoreGraphics-based). This means settingdefaultRenderer = .cgRendererhas no effect — the Metal renderer is always used.Introduced in
Commit
7aa9afaf("refactor(apple): use new render context per file and view (#9838)"), included in v6.9.4+.Before this commit, there was a
getCGRendererContextmethod that correctly returned the CG renderer. The refactoring replaced it withnewCGContext, but the implementation was changed to returnRiveRendererContext:Expected behavior
- (RenderContext*)newCGContext { return [[CGRendererContext alloc] init]; }Impact
RenderContextManager.shared().defaultRenderer = .cgRendererdoes not switch to CoreGraphicsCGRendererContextclass exists in the codebase but is unreachableContext
We discovered this while investigating snapshot testing with swift-snapshot-testing. The default
CALayer.render(in: CGContext)crashes (SIGBUS) on Metal-backedRiveViewlayers. We hoped to switch to CG renderer as a workaround, but found this bug.Related: #263 (snapshot testing), #380 (try! in constructors)
Device & Versions