Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using CustomRasterSourceTileRenderer #2225

Open
kbobrowski opened this issue Aug 14, 2024 · 0 comments
Open

Crash when using CustomRasterSourceTileRenderer #2225

kbobrowski opened this issue Aug 14, 2024 · 0 comments
Labels
bug 🪲 Something is broken!

Comments

@kbobrowski
Copy link

kbobrowski commented Aug 14, 2024

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:

  1. zoom the map in (up to ~100 km across)
  2. move around for a while (~ 20 seconds)
  3. zoom out (~ planet level)
  4. app should crash when zooming out
  5. 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)

@kbobrowski kbobrowski added the bug 🪲 Something is broken! label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

1 participant