A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
test: GLES3 require allowlist (default-deny, verified in WebGL 2) and the shader report
eyalgolan7be43f94f605
diff --git a/docs/visual-v1.md b/docs/visual-v1.mdindex 04d17f331..ebaf71aca 100644--- a/docs/visual-v1.md+++ b/docs/visual-v1.md@@ -44,6 +44,18 @@ Measured on the development Mac (Apple silicon, integrated GPU), 1920x1080 at DP- boot: each span (`map_build_ms` and `first_frame_ms`, median of 3, at `--cpu 1` and at `--cpu 4`) grows by at mostmax(300 ms, 50% of its Task 1 baseline): the tool's default when `--budget` is not given (controller ruling 3).+## GLES3 check: the `require` allowlist (Task 3 Step 0)+`ShaderChecks.GlslErrors` fails any `#extension X : require` not in `ShaderChecks.AllowedRequires` (default-deny). An+entry is added only after a WebGL 2 `compileShader` of a shader carrying that line succeeds in headless Chrome.+- Report (`-executeMethod Gles3Report.Run`, 2026-10-10): URP Lit, URP Terrain Lit and `Statecraft/HexSelection` show+ **0 errors and no `require` line**, so `AllowedRequires` stays **empty**. Running the report exposed a harness bug, fixed+ here: `Gles3Errors` looped over `SubshaderCount` but indexed `GetSerializedSubshader`. URP Lit has 2 subshaders and 1+ serialized one, so the report threw. The loop now uses `SerializedSubshaderCount`.+- Probe: full Chrome 153's `--headless=new --dump-dom` never exits on this Mac, so the probe runs in Playwright's+ `chrome-headless-shell` (Chrome for Testing 149.0.7827.55, `--use-angle=swiftshader`). Two references both returned+ `REQUIRE FAILS ... extension is not supported`: `GL_EXT_shader_non_constant_global_initializers` (the plan's example)+ and `GL_EXT_texture_buffer`. So a shader that requires either cannot run on the web tier.+## Baseline (Task 1, before any visual change; re-recorded in fix round 1)Viewport fixed to 1920x1080 at DPR 1 over CDP; Chrome kept awake; build from `0b6058e` (harness only).diff --git a/unity/Assets/Tests/EditMode/Gles3Report.cs b/unity/Assets/Tests/EditMode/Gles3Report.csnew file mode 100644index 000000000..14345f562--- /dev/null+++ b/unity/Assets/Tests/EditMode/Gles3Report.cs@@ -0,0 +1,27 @@+#nullable enable+using System.Linq;+using UnityEditor;+using UnityEngine;++/// <summary>Plan Task 3 Step 0: prints ShaderChecks.Gles3Errors for URP Lit, URP Terrain Lit and every Statecraft shader, so+/// a `require` is judged once, up front, instead of in the middle of a task. Run with -executeMethod Gles3Report.Run.</summary>+public static class Gles3Report+{+ static readonly string[] Urp = { "Universal Render Pipeline/Lit", "Universal Render Pipeline/Terrain/Lit" };++ public static void Run()+ {+ var shaders = Urp.Select(Shader.Find).ToList();+ shaders.AddRange(AssetDatabase.FindAssets("t:Shader", new[] { "Assets/Shaders" })+ .Select(g => AssetDatabase.LoadAssetAtPath<Shader>(AssetDatabase.GUIDToAssetPath(g))));+ foreach (var shader in shaders.Where(s => s != null).Distinct())+ {+ var errors = ShaderChecks.Gles3Errors(shader);+ Debug.Log($"GLES3REPORT {shader.name}: {errors.Count} error(s)");+ foreach (var e in errors) Debug.Log($"GLES3REPORT {e}");+ }+ foreach (var name in Urp)+ if (Shader.Find(name) == null) Debug.LogError($"GLES3REPORT {name}: shader not found");+ Debug.Log("GLES3REPORT done");+ }+}diff --git a/unity/Assets/Tests/EditMode/Gles3Report.cs.meta b/unity/Assets/Tests/EditMode/Gles3Report.cs.metanew file mode 100644index 000000000..234fa72ca--- /dev/null+++ b/unity/Assets/Tests/EditMode/Gles3Report.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: b24fbddcc4d3a4b6b9657af1fa4a251d\ No newline at end of filediff --git a/unity/Assets/Tests/EditMode/ShaderChecks.cs b/unity/Assets/Tests/EditMode/ShaderChecks.csindex 9b5d7fd73..b7bbfde50 100644--- a/unity/Assets/Tests/EditMode/ShaderChecks.cs+++ b/unity/Assets/Tests/EditMode/ShaderChecks.cs@@ -1,6 +1,7 @@#nullable enableusing System;using System.Collections.Generic;+using System.Linq;using System.Text.RegularExpressions;using UnityEditor;using UnityEditor.Rendering;@@ -14,8 +15,8 @@ using UnityEngine.Rendering;/// pass vacuously: at least one subshader must have passes that are built for GLES3 and all compile./// Each variant is compiled with forExternalTool, which returns the generated GLSL (the plain overload returns no GLES3/// output, so only HLSL front-end errors would show), and the GLSL is checked against WebGL 2 (GlslErrors): it must be-/// GLSL ES 3.00 and must not require an extension, which WebGL 2 does not have for anything the translator requires-/// (review I3: a fragment UAV write compiles for Metal and requires GL_EXT_texture_buffer here).</summary>+/// GLSL ES 3.00 and must not require an extension outside AllowedRequires (default-deny; review I3: a fragment UAV write+/// compiles for Metal and requires GL_EXT_texture_buffer here, which WebGL 2 does not have).</summary>public static class ShaderChecks{static readonly string[][] Variants = { Array.Empty<string>(), new[] { "_MAIN_LIGHT_SHADOWS" } };@@ -24,16 +25,29 @@ public static class ShaderChecksstatic readonly Regex Version = new Regex(@"#version\s+([^\r\n]*)");static readonly Regex Require = new Regex(@"#extension\s+(\w+)\s*:\s*require");- /// <summary>What in generated GLES3 GLSL WebGL 2 cannot run: no GLSL, a version other than "300 es", or an extension- /// the code requires.</summary>- public static List<string> GlslErrors(string glsl)+ /// <summary>The `#extension X : require` lines the check accepts. Default-deny: an entry needs a comment saying it was+ /// verified to work in WebGL 2 in headless Chrome (a `compileShader` of a shader carrying that line, see plan Task 3+ /// Step 0). An extension is never added because the check complained, only because the compile succeeded.</summary>+ static readonly HashSet<string> AllowedRequires = new HashSet<string>+ {+ // (empty: add `"GL_..."` with a "verified to work in WebGL 2 in headless Chrome, <date>, <Chrome version>" comment)+ };++ public static List<string> GlslErrors(string glsl) => GlslErrors(glsl, AllowedRequires);++ /// <summary>What in generated GLES3 GLSL WebGL 2 cannot run: no GLSL, a version other than "300 es", or a required+ /// extension that is not in <paramref name="allowedRequires"/>.</summary>+ public static List<string> GlslErrors(string glsl, ISet<string> allowedRequires){var errors = new List<string>();var versions = Version.Matches(glsl ?? "");if (versions.Count == 0) errors.Add("no GLSL was generated");foreach (Match v in versions)if (v.Groups[1].Value.Trim() != "300 es") errors.Add($"#version {v.Groups[1].Value.Trim()}: WebGL 2 runs GLSL ES 3.00 only");- foreach (Match r in Require.Matches(glsl ?? "")) errors.Add($"requires {r.Groups[1].Value}, which WebGL 2 does not have");+ foreach (Match r in Require.Matches(glsl ?? ""))+ if (!allowedRequires.Contains(r.Groups[1].Value))+ errors.Add($"requires {r.Groups[1].Value}, which is not in ShaderChecks.AllowedRequires: if WebGL 2 supports it, " ++ "verify it in headless Chrome (plan Task 3 Step 0) and add it there with a comment saying so");return errors;}@@ -50,7 +64,8 @@ public static class ShaderChecksvar errors = new List<string>();int usable = 0;var data = ShaderUtil.GetShaderData(shader);- for (int s = 0; s < data.SubshaderCount; s++)+ // GetSerializedSubshader indexes the serialized subshaders, which can be fewer than SubshaderCount (URP Lit: 2 vs 1).+ for (int s = 0; s < data.SerializedSubshaderCount; s++){var sub = data.GetSerializedSubshader(s);var subErrors = new List<string>();diff --git a/unity/Assets/Tests/EditMode/VisualHarnessTests.cs b/unity/Assets/Tests/EditMode/VisualHarnessTests.csindex 1882285fa..590f5b948 100644--- a/unity/Assets/Tests/EditMode/VisualHarnessTests.cs+++ b/unity/Assets/Tests/EditMode/VisualHarnessTests.cs@@ -265,6 +265,21 @@ public class VisualHarnessTestsfinally { Object.DestroyImmediate(shader); }}+ [Test]+ public void AnAllowedRequireIsAcceptedAndAnUnknownOneFailsWithHowToAddIt()+ {+ const string glsl = "#version 300 es\n#extension GL_EXT_demo_allowed : require\nvoid main() {}";+ Assert.IsEmpty(ShaderChecks.GlslErrors(glsl, new HashSet<string> { "GL_EXT_demo_allowed" }), "an allowed require passes");+ var errors = ShaderChecks.GlslErrors(glsl, new HashSet<string>());+ Assert.AreEqual(1, errors.Count, string.Join("\n", errors));+ StringAssert.Contains("GL_EXT_demo_allowed", errors[0]);+ StringAssert.Contains("AllowedRequires", errors[0], "the message says where to add it");+ Assert.IsNotEmpty(ShaderChecks.GlslErrors("#version 300 es\n#extension GL_EXT_other : require\nvoid main() {}",+ new HashSet<string> { "GL_EXT_demo_allowed" }), "allowing one extension allows no other");+ Assert.IsEmpty(ShaderChecks.GlslErrors("#version 300 es\n#extension GL_EXT_demo_allowed : enable\nvoid main() {}", new HashSet<string>()),+ "enable and warn never fail");+ }+/// <summary>Review M6: the first pose's first runs were noisier (a cold start), so before the first pose every/// configuration runs once for WarmupFrames, unmeasured; then each pose runs every configuration Repeats times.</summary>[Test]