mapbox-maps-ios
mapbox-maps-ios copied to clipboard
Crash when using CustomRasterSourceTileRenderer
Environment
- Xcode version: 15.4
- iOS version: 17.5.1
- Devices affected: iPhone 13
- Maps SDK Version: 11.6.0-rc.1
Observed behavior and steps to reproduce
App is crashing with:
validateRenderPassDescriptor:991: failed assertion `RenderPass Descriptor Validation
No output textures defined for the render pass. Either set a texture to at least one render pass attachment, or use targetless rasterization by setting the render pass descriptor's renderTarget{Width|Height} properties to nonzero values.
no sampleCount for color and raster available, either set defaultColorSampleCount or set defaultRasterSampleCount or set appropriate attachments
Steps to reproduce:
- zoom the map in (up to ~100 km across)
- move around for a while (~ 20 seconds)
- zoom out (~ planet level)
- app should crash when zooming out
- if app did not crash repeat steps 1-3
Minimal example:
import SwiftUI
@_spi(Experimental) import MapboxMaps
class CustomRenderer: CustomRasterSourceTileRenderer {
func initialize(forDevice device: UInt64, colorPixelFormat: UInt64) {}
func isTileRenderable(for tileID: CanonicalTileID, status: CustomRasterSourceTileStatus) -> Bool {
return status == .required
}
func prerender(for parameters: CustomLayerRenderParameters, commandBuffer: UInt64) {}
func renderToTile(for tileID: CanonicalTileID, commandEncoder: UInt64) {}
func deinitialize() {}
}
struct CustomRenderView: View {
let customRenderer = CustomRenderer()
var rasterSourceClient: CustomRasterSourceClient {
CustomRasterSourceClient.fromCustomRasterSourceTileRenderer(customRenderer)
}
var rasterSourceOptions: CustomRasterSourceOptions {
CustomRasterSourceOptions(clientCallback: rasterSourceClient)
}
var body: some View {
Map() {
CustomRasterSource(id: "custom-raster-source", options: rasterSourceOptions)
RasterLayer(id: "custom-raster-layer", source: "custom-raster-source")
}
}
}
@main
struct mapbox_testApp: App {
var body: some Scene {
WindowGroup {
CustomRenderView()
}
}
}
Notes / preliminary analysis
Crash does not happen when isTileRenderable
returns always false
(which totally disables rendering)