|
| 1 | +# Engineering research report: three strict random-binding context cases |
| 2 | + |
| 3 | +Date: 2026-10-05. Repository: johnneerdael/ProjectM-TV. Predictor branch: |
| 4 | +`feat/preset-audience-scoring`, task worktree |
| 5 | +`/Users/jneerdael/Scripts/Projectm-TV/.worktrees/preset-genre-analyzer`. |
| 6 | + |
| 7 | +## Finding and research objective |
| 8 | + |
| 9 | +The source audit still reports three composite sections as unresolved under the |
| 10 | +strict GLES300/Android context. **This is not evidence of three remaining native |
| 11 | +renderer bugs.** The immediate cause is known: the analyzer withholds descriptor |
| 12 | +bindings for random aliases without matching context, and its current observed |
| 13 | +context validator only accepts host GLSL330 evidence. Determine whether the |
| 14 | +correct fix is source-contract interpretation, Android context/provenance capture, |
| 15 | +or a separately reproduced engine defect. Do not start from an assumption that |
| 16 | +PR30's alias fixes failed. |
| 17 | + |
| 18 | +All three original shader sections already parse and translate. The two gap labels |
| 19 | +`shader expression not lowered: sampler_state` and `dynamic sampler expression` |
| 20 | +refer to the same three presets, not six. The original315-subset recheck against |
| 21 | +2.3.3's41-patch source leaves only these three; the parser and global-initialization |
| 22 | +cases clear. Source interpretation is separate from successful full rendering and |
| 23 | +from visual/mood accuracy. |
| 24 | + |
| 25 | +## Exact affected presets |
| 26 | + |
| 27 | +Paths are relative to `core/src/main/assets/presets/`. Preserve these files and |
| 28 | +verify the full-file hash before reproducing. |
| 29 | + |
| 30 | +| Exact filename | Full-file SHA-256 | Section / file lines | |
| 31 | +|---|---|---| |
| 32 | +| EoS - glowsticks v2 04 music minimal - swim - dictatutorial rt roam3 2.milk | `5dd383cf79e1aacbed944ded85d70a365dde2c51f2ca7646ed0b7fde0cf4c79f` | comp_ / 714–745 | |
| 33 | +| EoS - glowsticks v2 04 music minimal - swim - dictatutorial rt roam3.milk | `06b84ff69c3aeeb88eff3dea63dd3c1f5b146b4c2afb9df204f5f2561e7aee15` | comp_ / 655–686 | |
| 34 | +| midgitstraights of majillaen - featy sweet.milk | `d4cd997dedc57ab34c7247fee1ba94d4061528d12d16cde5a468145fb216ebba` | comp_ / 505–535 | |
| 35 | + |
| 36 | +The two EoS composite sections share shader-source SHA-256 |
| 37 | +`829742c66b7b88cf305c32924842b12fec26a26bf367ef4b861975e2ee0e5c5d`. |
| 38 | +Midgit's composite source SHA-256 is |
| 39 | +`7904cb659869118fed10df59aeb127f3597b34b8abf400b7e0cb5ec7482bedc3`. |
| 40 | + |
| 41 | +They all contain the following pattern (the full shaders also rotate coordinates, |
| 42 | +combine feedback/blur and scale colour by audio): |
| 43 | + |
| 44 | +```hlsl |
| 45 | +sampler sampler_rand00 = sampler_state { AddressU=WRAP; AddressV=WRAP; }; |
| 46 | +sampler sampler_rand01 = sampler_state { AddressU=WRAP; AddressV=WRAP; }; |
| 47 | +shader_body { |
| 48 | + ret=tex2D(sampler_rand00,uv).xyz; |
| 49 | + ret+=tex2D(sampler_rand01,uv).xyz; |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +## Exact artifact and completed fixes |
| 54 | + |
| 55 | +Use the **standard** published `projectM-TV-core-2.3.3.aar`, not an older AAR or the |
| 56 | +separate core-native flavour. Release commit: |
| 57 | +`6e71ac2a18a95463fbe3a21c05e6dd4027cb74a0`. |
| 58 | + |
| 59 | +- AAR SHA-256: `e83be55299d310e6282204cb39740cfe09d1e2609471eb58c6299c8961eec9eb`. |
| 60 | +- ARM64 libprojectmtv.so SHA-256: `ee1f57e20a1f438809c8c8b2121be19fa23ff8ca640a2b50857bee9b04c9e34d`. |
| 61 | +- It includes41native patches, including PR29 parsing, PR30 random aliases, |
| 62 | + PR33 global-input policy and PR34 blur framebuffer ownership. |
| 63 | + |
| 64 | +The old midgit GL error1286 is historical: PR34 diagnoses and fixes framebuffer |
| 65 | +bindings saved after blur allocation had unbound them. Its before/after host |
| 66 | +manifest reports1286→0. Do not reopen that issue from the older PR30 JSON; retest |
| 67 | +2.3.3 before alleging a current failure. Full authored-preset Android rendering |
| 68 | +and appearance have not yet been certified by this predictor's current controls. |
| 69 | + |
| 70 | +## Immediate analyzer failure path |
| 71 | + |
| 72 | +Inspect the files in the predictor worktree (the focused main analyzer is a |
| 73 | +separate subset; do not overwrite broader predictor work): |
| 74 | + |
| 75 | +1. `tools/milk-analyzer/coverage_audit.py`, `audit_source`, around lines128–146: |
| 76 | + random aliases keep `bindings=None` unless a context is supplied and verified. |
| 77 | +2. `random_binding_context.py`, `verified_context`, around line15: only |
| 78 | + `glsl330` with `host-real-GL-production-random-device-v1` is accepted. GLES300 |
| 79 | + is deliberately refused; the captured manifest is an observed host pair. |
| 80 | +3. `shader_fields.py`, `native_sampler`, around lines409–417: sampler_state |
| 81 | + declarations become ordinary typed inputs only when native_samplers supplies |
| 82 | + their dimensions. Without context, the initializer remains unsupported. |
| 83 | +4. The texture-call path around line784 then reports a dynamic sampler expression |
| 84 | + because its operand is not a typed input. These labels do not imply runtime |
| 85 | + texture handles actually change each frame. |
| 86 | + |
| 87 | +With verified PR30 host context, **all three exact composite sections lower with |
| 88 | +no unresolved sampler expressions**. The importer checks source/policy/asset |
| 89 | +hashes, pair-wide slot consistency, per-stage unit consistency, dimensions under |
| 90 | +the declared upload policy and sampler modes. Old host render errors remain |
| 91 | +separate from valid binding identity. Missing/stale context keeps the guard. |
| 92 | + |
| 93 | +## Published-AAR numerical evidence |
| 94 | + |
| 95 | +The unchanged2.3.3 native library was exercised in the task-owned API34 ARM64 |
| 96 | +learning emulator:128×72,30fps,48×32mesh,30frames per control, explicit PCM and |
| 97 | +clock adapter. The helper's JNI ABI was checked against2.3.3. The emulator was |
| 98 | +stopped after the bounded tests; shared corpus devices/TVs were not operated. |
| 99 | + |
| 100 | +The isolated asset namespace contains one16×16PNG with RGB8=[51,102,153]. The |
| 101 | +following predictions were frozen before capture: |
| 102 | + |
| 103 | +| Control | Expected result | Maximum RGB8 error across30frames | |
| 104 | +|---|---|---:| |
| 105 | +| rand00 | sampled constant image | 1 | |
| 106 | +| rand01 | sampled constant image | 1 | |
| 107 | +| two slots | half the sum of the two samples | 1 | |
| 108 | +| qualified fw_rand00 | sampled constant image | 1 | |
| 109 | +| same-slot cross-stage | composite outputs half the warp image | 1 | |
| 110 | +| cross-stage qualified alias | composite outputs half the warp image | 1 | |
| 111 | + |
| 112 | +Half-colour composite output prevents an equal-colour default composite from |
| 113 | +masquerading as successful alias lookup. All six alias controls pass the declared |
| 114 | +≤1RGB8 tolerance. An empty-pool negative control is retained as diagnostic, not |
| 115 | +credited as a successful random binding. Three global-input controls also match |
| 116 | +the new policy; they are not these random-context cases. |
| 117 | + |
| 118 | +This proves bounded alias behavior with the supplied asset set. It does **not** |
| 119 | +identify images selected in a later arbitrary production load, validate every |
| 120 | +sampler mode/asset decoder, or certify the three full authored visuals. |
| 121 | + |
| 122 | +## Important fixture/protocol traps |
| 123 | + |
| 124 | +- Core init extracts bundled AssetManager textures into the search folder. Our |
| 125 | + first attempted single-image test actually had75images after combining the AAR |
| 126 | + assets with an overlay. Those predictions failed and are preserved. Merely |
| 127 | + adding one PNG to a folder does not isolate the texture pool. The corrected |
| 128 | + test uses an overlay-only asset namespace and the unchanged published library. |
| 129 | +- SOIL can resize images during upload. The observed host rounds NPOT images up |
| 130 | + to powers of two:320×160→512×256,500×400→512×512,190×200→256×256. Validate |
| 131 | + file hashes and decoded dimensions under the actual driver/upload policy; |
| 132 | + do not compare raw image dimensions blindly with descriptor texsize values. |
| 133 | +- Random image choice is an input for a preset lifetime. Different loads can |
| 134 | + select different images. Preserve slot identity across warp/composite and |
| 135 | + each alias's filter/wrap mode; don't promise one fixed filename from source. |
| 136 | + |
| 137 | +## Research and proposed fix routes |
| 138 | + |
| 139 | +First reproduce the strict audit on one affected file using the prepared2.3.3 |
| 140 | +reader and source-bound compatibility request; compare no-context versus valid |
| 141 | +context. The difference should point directly to the guard above. |
| 142 | + |
| 143 | +Then choose the smallest correct route: |
| 144 | + |
| 145 | +- **Source-contract route:** prove the41-patch TextureManager/descriptor contract |
| 146 | + establishes typed2D random-slot inputs and name-based sampling without needing |
| 147 | + a particular selected filename. Represent selected image/texsize/lifetime as |
| 148 | + explicit runtime inputs. Keep missing images/load failure and complete-render |
| 149 | + errors distinct. This may remove a false language-understanding blocker without |
| 150 | + inventing image contents or claiming a visual match. |
| 151 | +- **Runtime-context route:** capture Android alias→slot→selected image path/hash→ |
| 152 | + uploaded dimensions/target→sampler mode→unit/uniform for the exact three shaders. |
| 153 | + Bind the manifest to preset/shader hashes, AAR/native hash, asset-pool identity, |
| 154 | + GL profile and selection epoch; feed it to the validator under an explicit |
| 155 | + GLES300 policy. Do not relabel host random choices as Android observations. |
| 156 | +- **Native-defect route:** only if a new2.3.3 reproduction contradicts those |
| 157 | + contracts, report and patch the precise native function with before/after |
| 158 | + controls. Keep the original preset unchanged. |
| 159 | + |
| 160 | +Native locations: `MilkdropShader::GetReferencedSamplers`, `PreprocessPresetShader`, |
| 161 | +`LoadTexturesAndCompile`; `PresetState::randomTextureDescriptors`; |
| 162 | +`TextureManager::GetRandomTexture`, `ExtractTextureSettings`, `LoadTexture`; |
| 163 | +`TextureSamplerDescriptor::{SamplerDeclaration,TexSizeDeclaration,Bind}`; |
| 164 | +JNI `PresetLibrary::ExtractTextures`; SOIL's NPOT/upload capability handling. |
| 165 | + |
| 166 | +## Evidence and reproducible inputs |
| 167 | + |
| 168 | +Repository/predictor files: |
| 169 | + |
| 170 | +- `tools/milk-analyzer/fixtures/strict-binding-context-research-3-release233.json`: |
| 171 | + exact gaps, source comparison, runtime identities and completed control results. |
| 172 | +- `fixtures/random-binding-host-context-37.json` and |
| 173 | + `fixtures/random-binding-host-assets-37.json`: observed host binding records and |
| 174 | + independently decoded metadata; host-only scope. |
| 175 | +- `test_random_binding_context.py`: rejects stale hashes, conflicting units, |
| 176 | + cross-stage slot changes, contradictory dimensions and profile extrapolation; |
| 177 | + verifies all three exact host source sections. |
| 178 | +- Native merged evidence: |
| 179 | + `docs/superpowers/evidence/random-texture-bindings/` and |
| 180 | + `docs/superpowers/evidence/midgit-framebuffer/` on the2.3.3 release commit. |
| 181 | + |
| 182 | +Local predictor-worktree paths (not all are committed): |
| 183 | + |
| 184 | +- `build/milk-analyzer/focused-315-release233-2026-10-05/`: coverage.jsonl, |
| 185 | + gap-priority.json, compatibility.json, comparison.json and41-patch reader trees. |
| 186 | +- `build/milk-analyzer/android-learning/release233-verification/`: probe.py, |
| 187 | + frozen predictions, results, raw RGBA readbacks, metadata and report.json. |
| 188 | +- `build/milk-analyzer/android-learning/runtime-core-2.3.3/identity.json`. |
| 189 | +- `build/milk-analyzer/core-2.3.3/`: standard published AAR and checksums. |
| 190 | +- Earlier failed/corrected controls: |
| 191 | + `android-learning/random-alias-2026-10-04/` and |
| 192 | + `android-learning/random-alias-isolated-assets-2026-10-04/`. |
| 193 | + |
| 194 | +The clock adapter hash is `168ee9cb0afb9a7c54e54e2931c5dd76be7348a14b6b1a6122b6b3ffadf5a58f`; |
| 195 | +helper DEX hash is `ca07aba01095d2f59a0923c5154dc84adf29d30a8e0d0fd866f93d6d3f4503d4`. |
| 196 | +These are declared test-host inputs, not modifications to the published native library. |
| 197 | + |
| 198 | +## Acceptance and handback |
| 199 | + |
| 200 | +Deliver root-cause attribution and the exact changed guard/context/native code. |
| 201 | +Show all three originals interpreted under the declared target context without |
| 202 | +preset edits, source-token exclusions or appearance credit from compile success. |
| 203 | +Retain negative controls for missing/prefix-miss textures, stale identities, |
| 204 | +conflicting aliases, slot reuse, dimension changes and profile mismatches. |
| 205 | + |
| 206 | +For numerical certification, compare independently frozen predictions with native |
| 207 | +results under matching source/audio/assets/clock/render settings. Preserve errors |
| 208 | +and asset epochs. Check the exact three authored full renders separately from |
| 209 | +synthetic alias controls. Recheck the original315 subset and report new gaps; |
| 210 | +no duplicate full-corpus render is required. |
| 211 | + |
| 212 | +Do not modify the other agent's corpus/devices. Use a separate engineering worktree |
| 213 | +and patch files for any engine change; do not commit edited submodule sources. |
| 214 | +Include exact AAR/native/source/asset hashes, before/after evidence, limitations |
| 215 | +and the remaining count. A valid outcome may be an analyzer/context fix with no |
| 216 | +additional native patch. |
0 commit comments