${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'))}
diff --git a/src/game/96-map/56-webgl.js b/src/game/96-map/56-webgl.js
index 26fae66..7f4196d 100644
--- a/src/game/96-map/56-webgl.js
+++ b/src/game/96-map/56-webgl.js
@@ -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){}
diff --git a/tests/webgl-context-restore.test.js b/tests/webgl-context-restore.test.js
index 734fa03..ea46ea2 100644
--- a/tests/webgl-context-restore.test.js
+++ b/tests/webgl-context-restore.test.js
@@ -143,3 +143,21 @@ test('a game started with Always 2D never makes a context', () => {
assert.equal(ev('__made'), 0);
assert.deepEqual(errors, []);
});
+
+// Settings said whether the card could draw the map by setting it up: opening them on the title screen or in a puzzle
+// made the context and its 64 MB atlas for a map drawn in 2D. It now says what is known without asking the card.
+test('opening Settings never makes a context, and still says when the card cannot', () => {
+ const { ev, errors } = open();
+ ev('window.WebGL2RenderingContext=function(){};window.__made=0;const c=document.getElementById("mapgl"),gc=c.getContext;c.getContext=t=>{__made++;return gc(t);};');
+ const note = () => ev("settingsHtml().includes(tr('settings.this_browser_cannot_so_the_map'))");
+ ev('const s=S;S=null;window.__S=s;');
+ assert.equal(note(), false, 'title screen: a card not tried yet counts as able');
+ ev('S=__S;');
+ assert.equal(note(), false);
+ assert.equal(ev('__made'), 0, 'no context made by Settings');
+ ev('glKill(new Error("no graphics card, only SwiftShader"))');
+ assert.equal(note(), true, 'a card given up: Settings says so');
+ ev('delete window.WebGL2RenderingContext;GLX.dead=false;');
+ assert.equal(note(), true, 'no WebGL2 in this browser: Settings says so');
+ assert.deepEqual(errors, []);
+});