SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox
https://symbolixau.github.io/mapdeck/articles/mapdeck.html
363 stars 40 forks source link

screengrid layers may cause Safari 13.1 to hang #299

Closed ikosmidis closed 11 months ago

ikosmidis commented 4 years ago

Describe the bug screengrid layers may cause Safari 13.1 to hang. Everything seems to work as expected in latest versions of Firefox and Chrome.

To Reproduce

library(mapdeck)

set_token(Sys.getenv("MAPBOX"))

df <- read.csv(paste0(
'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/',
'examples/3d-heatmap/heatmap-data.csv'
))
df <- df[ !is.na(df$lng), ]
df$weight <- sample(1:10, size = nrow(df), replace = TRUE)
mapdeck(style = mapdeck_style('dark'), pitch = 45 ) %>%
add_screengrid(
  data = df
  , lat = "lat"
  , lon = "lng"
  , weight = "weight"
  , layer_id = "screengrid_layer"
  , cell_size = 10
  , opacity = 0.3
  , colour_range = colourvalues::colour_values(1:6, palette = "plasma")
)

Versions v0.3.2

dcooley commented 4 years ago

Do you get any errors in the javascript console in Safari?

ikosmidis commented 4 years ago

The javascript console has

[Error] Not allowed to load local resource: file://null/private/var/folders/3t/00tlvfn14zq5v45q3q3y63cm0000gn/T/RtmpYyVodQ/viewhtml1434b61033e78/lib/mapboxgl-1.9.0/mapbox-gl.js.map
[Error] Not allowed to request resource
[Error] Cannot load file://null/private/var/folders/3t/00tlvfn14zq5v45q3q3y63cm0000gn/T/RtmpYyVodQ/viewhtml1434b61033e78/lib/mapboxgl-1.9.0/mapbox-gl.js.map due to access control checks.
[Warning] deck: WebGL2 not supported by this browser. Transition animation is disabled. (deckgl.min.js, line 11)
[Warning] deck: GPU Grid Aggregation not supported, falling back to CPU (deckgl.min.js, line 11)
[Error] TypeError: undefined is not an object (evaluating 'n[e].aggregationData')
    value (deckgl.min.js:11:518933)
    value (deckgl.min.js:11:549716)
    E (deckgl.min.js:11:182533)
    (anonymous function) (deckgl.min.js:11:182230)
    forEach
    T (deckgl.min.js:11:182146)
    value (deckgl.min.js:11:185164)
    value (deckgl.min.js:11:218738)
    value (deckgl.min.js:11:221112)
    value
    value (deckgl.min.js:11:223579)
    value
    value (deckgl.min.js:11:196666)
    value (deckgl.min.js:11:193835)
    t (deckgl.min.js:11:195828)
[Error] TypeError: undefined is not an object (evaluating 'n[e].aggregationData')
    value (deckgl.min.js:11:518933)
    value (deckgl.min.js:11:549716)
    E (deckgl.min.js:11:182533)
    (anonymous function) (deckgl.min.js:11:182230)
    forEach
    T (deckgl.min.js:11:182146)
    value (deckgl.min.js:11:185164)
    value (deckgl.min.js:11:218738)
    value (deckgl.min.js:11:218306)
    value (deckgl.min.js:11:224870)
    value
    value (deckgl.min.js:11:209474)
    value (deckgl.min.js:11:209243)
    value
    emit (deckgl.min.js:11:19393)
    value (deckgl.min.js:11:213805)
    value
    emit (deckgl.min.js:11:19393)
    U (deckgl.min.js:11:4531)
    handler (deckgl.min.js:11:6720)
    (anonymous function) (deckgl.min.js:11:201086)
    (anonymous function) (deckgl.min.js:11:2905)

Note that I had to do data = df[1:100] in the above example to get the above; otherwise, safari freezes to the point that I cannot get to the javascript console.

Also, the page becomes non-responsive once the last two errors above appear.

I hope this helps.

dcooley commented 4 years ago

[Warning] deck: WebGL2 not supported by this browser. Transition animation is disabled. (deckgl.min.js, line 11) [Warning] deck: GPU Grid Aggregation not supported, falling back to CPU (deckgl.min.js, line 11)

Does safari require you to enable WebGL2, or hardware accelearation, or any GPU settings?

ikosmidis commented 4 years ago

WebGL2 is indeed in the experimental features in Safari 13. I enabled it (Develop -> Experimental features) and the problem persists, though with different errors

[Error] WebGL: INVALID_ENUM: getProgramParameter: invalid parameter name
    getProgramParameter
    getProgramParameter
    getProgramParameter
    value (deckgl.min.js:11:675870)
    e (deckgl.min.js:11:674717)
    value (deckgl.min.js:11:677976)
    t (deckgl.min.js:11:677198)
    value (deckgl.min.js:11:333689)
    value (deckgl.min.js:11:126062)
    value (deckgl.min.js:11:120183)
    e (deckgl.min.js:11:119538)
    Q (deckgl.min.js:11:527406)
    value (deckgl.min.js:11:524902)
    e (deckgl.min.js:11:517529)
    value (deckgl.min.js:11:544601)
    value (deckgl.min.js:11:548229)
    value (deckgl.min.js:1:282328)
    value (deckgl.min.js:11:37484)
    value (deckgl.min.js:11:37105)
    value (deckgl.min.js:11:36543)
    value (deckgl.min.js:11:35375)
    value (deckgl.min.js:11:34841)
    value (deckgl.min.js:11:217339)
    value (deckgl.min.js:11:644453)
    value (deckgl.min.js:11:222620)
    value (deckgl.min.js:11:223254)
    value
    promiseReactionJob
[Error] WebGL: INVALID_ENUM: getProgramParameter: invalid parameter name
    getProgramParameter
    getProgramParameter
    getProgramParameter
    value (deckgl.min.js:11:675870)
    e (deckgl.min.js:11:674717)
    value (deckgl.min.js:11:677976)
    t (deckgl.min.js:11:677198)
    value (deckgl.min.js:11:333689)
    value (deckgl.min.js:11:126062)
    value (deckgl.min.js:11:120183)
    e (deckgl.min.js:11:119538)
    J (deckgl.min.js:11:527852)
    value (deckgl.min.js:11:524971)
    e (deckgl.min.js:11:517529)
    value (deckgl.min.js:11:544601)
    value (deckgl.min.js:11:548229)
    value (deckgl.min.js:1:282328)
    value (deckgl.min.js:11:37484)
    value (deckgl.min.js:11:37105)
    value (deckgl.min.js:11:36543)
    value (deckgl.min.js:11:35375)
    value (deckgl.min.js:11:34841)
    value (deckgl.min.js:11:217339)
    value (deckgl.min.js:11:644453)
    value (deckgl.min.js:11:222620)
    value (deckgl.min.js:11:223254)
    value
    promiseReactionJob
[Warning] deck: GPU Grid Aggregation not supported, falling back to CPU (deckgl.min.js, line 11)
[Error] WebGL: INVALID_ENUM: getProgramParameter: invalid parameter name
    getProgramParameter
    getProgramParameter
    getProgramParameter
    value (deckgl.min.js:11:675870)
    e (deckgl.min.js:11:674717)
    value (deckgl.min.js:11:677976)
    t (deckgl.min.js:11:677198)
    value (deckgl.min.js:11:333689)
    value (deckgl.min.js:11:126062)
    value (deckgl.min.js:11:120183)
    e (deckgl.min.js:11:119538)
    value (deckgl.min.js:11:533605)
    value (deckgl.min.js:11:532487)
    value (deckgl.min.js:1:282328)
    value (deckgl.min.js:11:37484)
    value (deckgl.min.js:11:37105)
    value (deckgl.min.js:11:37231)
    value (deckgl.min.js:11:36543)
    value (deckgl.min.js:11:35375)
    value (deckgl.min.js:11:34841)
    value (deckgl.min.js:11:217339)
    value (deckgl.min.js:11:644453)
    value (deckgl.min.js:11:222620)
    value (deckgl.min.js:11:223254)
    value
    promiseReactionJob
[Error] Not allowed to load local resource: file:///favicon.ico
[Error] TypeError: undefined is not an object (evaluating 'this.depthFBO.resize')
    value (deckgl.min.js:11:183966)
    value (deckgl.min.js:11:184266)
    value (deckgl.min.js:11:218738)
    value (deckgl.min.js:11:221112)
    value
    value (deckgl.min.js:11:223579)
    value
    value (deckgl.min.js:11:196666)
    value (deckgl.min.js:11:193835)
    t (deckgl.min.js:11:195828)
[Error] TypeError: undefined is not an object (evaluating 'this.depthFBO.resize')
    value (deckgl.min.js:11:183966)
    value (deckgl.min.js:11:184266)
    value (deckgl.min.js:11:218738)
    value (deckgl.min.js:11:218306)
    value (deckgl.min.js:11:224870)
    value
    value (deckgl.min.js:11:209474)
    value (deckgl.min.js:11:209243)
    value
    emit (deckgl.min.js:11:19393)
    value (deckgl.min.js:11:213805)
    value
    emit (deckgl.min.js:11:19393)
    U (deckgl.min.js:11:4531)
    handler (deckgl.min.js:11:6720)
    (anonymous function) (deckgl.min.js:11:201086)
    (anonymous function) (deckgl.min.js:11:2905)
[Error] Not allowed to load local resource: file://null/private/var/folders/3t/00tlvfn14zq5v45q3q3y63cm0000gn/T/Rtmp3iNwPi/viewhtml163d242ba04cc/lib/mapboxgl-1.9.0/mapbox-gl.js.map
[Error] Not allowed to request resource
[Error] Cannot load file://null/private/var/folders/3t/00tlvfn14zq5v45q3q3y63cm0000gn/T/Rtmp3iNwPi/viewhtml163d242ba04cc/lib/mapboxgl-1.9.0/mapbox-gl.js.map due to access control checks.
dcooley commented 4 years ago

I've updated the underlying mapbox.js to the latest v1.10.0, and deck.gl to v8.1.6, so please try this and see if the error persists?

remotes::install_github("SymbolixAU/mapbox")

Other than this, I don't think I can help as it's not an issue to do withmapdeck or the R code, but rather seems like a mapbox or deck.gl issue.

ikosmidis commented 4 years ago

Thanks; unfortunately errors persist (with and without WebGL2 enabled in Safari 13).

Indeed this seems like a deck.gl issue, so makes sense to wait for it to be resolved within that project.

Thanks for looking into this.

-Ioannis

dcooley commented 11 months ago

just tried with safari 17.2, and the latest dev mapeck and I don't see any issues.