Settings: say whether the card can draw the map without setting it up
Settings › Map drawing said "This browser cannot" by calling glInit(), so opening Settings on the title screen or in a puzzle, where the map is drawn in 2D, made the WebGL context and its 64 MB atlas. It now says what is known without asking the card (glCan()): a card given up or a browser without WebGL2 cannot; a card not tried yet counts as able. A card that turns out to be the processor's is still named once the game draws its first frame, in Diagnostic info and in Settings. Test in webgl-context-restore.
This commit is contained in:
parent
351b3aa522
commit
b7a9ec3e3c
3 changed files with 22 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ function settingsHtml(){const seg=(lab,act,cur,opts,note)=>`<div class="setline"
|
|||
${seg(tr('settings.quiet_notifications'),'prefSet',cur('quiet'),onoff('quiet'),tr('settings.only_trouble_and_milestones_pop_up'))}
|
||||
<h3 class="sub4">${tr('settings.display_and_sound')}</h3>
|
||||
${seg(tr('common.animations'),'animSet',UI.anim||'auto',[['auto',tr('common.auto')],['on',tr('common.on')],['off',tr('common.off')]],tr('settings.auto_follows_your_device_s_reduce'))}
|
||||
${seg(tr('settings.map_drawing'),'mapSet',GLX.want?'auto':'2d',[['auto',tr('common.auto')],['2d',tr('settings.always_2d')]],tr('settings.auto_draws_the_map_with_your')+(GLX.want&&!glInit()?' '+tr('settings.this_browser_cannot_so_the_map'):''))}
|
||||
${seg(tr('settings.map_drawing'),'mapSet',GLX.want?'auto':'2d',[['auto',tr('common.auto')],['2d',tr('settings.always_2d')]],tr('settings.auto_draws_the_map_with_your')+(GLX.want&&!glCan()?' '+tr('settings.this_browser_cannot_so_the_map'):''))}
|
||||
${seg(tr('common.sound'),'soundSet',UI.muted?'off':'on',[['on',tr('common.on')],['off',tr('common.off')]])}
|
||||
<div class="setline"><label for="langSel">${tr('common.language')}</label>${langPick('langSel')}</div>
|
||||
${seg(tr('settings.diagnostic_info'),'vpSet',DIAG.on?'on':'off',[['on',tr('common.on')],['off',tr('common.off')]],tr('settings.for_bug_reports_shows_your_screen'))}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ try{GLX.want=localStorage.getItem('sot-map')!=='2d';}catch(e){}
|
|||
// Renderers that are the processor pretending to be a graphics card (GLX.soft: use them anyway, for the GPU benchmark).
|
||||
const GL_SOFT=/swiftshader|llvmpipe|softpipe|lavapipe|software|basic render/i;
|
||||
const glOn=()=>GLX.want&&!GLX.dead&&!!S&&!pzOn()&&glInit();
|
||||
// Whether the card can draw the map, as far as is known without asking it: Settings says so without making a context
|
||||
// (on the title screen or in a puzzle that made the 64 MB atlas for a map drawn in 2D). A card not tried yet counts as able.
|
||||
const glCan=()=>!GLX.dead&&typeof WebGL2RenderingContext!=='undefined';
|
||||
// Switches the WebGL map on or off: the setting keeps the choice in this browser (keep), the GPU benchmark does not.
|
||||
// Chosen in Settings, Always 2D also lets the card's context go (glSleep()), and Auto takes it back.
|
||||
function mapGl(on,keep=true){GLX.want=!!on;if(keep)try{on?localStorage.removeItem('sot-map'):localStorage.setItem('sot-map','2d');}catch(e){}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue