mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 12:18:30 +09:00
- WIP, parked: measures 80.9 -> 94.8 fps on Adreno 650 / MC 26.2 (same scene, device cooled to 38-40C), but is NOT validated. Desktop GLSL carries no precision qualifiers, so every fragment value reaches the driver as fp32 while Adreno runs fp16 at twice the rate. - RelaxTextureDerivedPrecisionPass taints the values a fragment shader derives from built-in inputs and decorates everything else RelaxedPrecision. The taint direction matters: whitelisting outward from texture reads captures nothing, because MC multiplies every texel by an interpolated colour and a UBO value and one un-relaxed operand vetoes the expression - measured at 80.4 fps, i.e. no gain, both with and without varyings seeded. Precision-critical sources are few (gl_FragCoord cannot even hold a 3044-pixel x exactly), so tainting them and relaxing the rest is what actually pays. - SPIR-V cannot see the bound formats - sampler2D yields vec4 whether the texture is RGBA8 or RGBA32F - so the decision is made per draw and passed in as a compile option, the same shape ExplicitLod0Sampling already uses. RelaxedFragmentPrecision is only requested when every sampled texture and every colour attachment is an 8-bit-or-less normalized format, where fp16's 11-bit mantissa already carries the value exactly. Shaderpack HDR gbuffers, float data textures and 16-bit normalized targets therefore keep full precision, as do shaders that write gl_FragDepth or gl_SampleMask. - LocalMultiStoreElim runs first: glslang emits function-local variables, and a load can never be relaxed, so without SSA promotion the analysis dies at the first temporary. - WHY THIS IS PARKED: the retrace correctness gate never ran green. Every DirectVulkan retrace on Adreno 650 dies with DEVICE_LOST in UploadDirtyMipLevels on unmodified dev (pre-existing, device-gated), and on Adreno 830 - where the gate does pass on dev - minecraft-1.21.4-in-world times out at 900s with this change, which still needs explaining. Do not merge until that is understood and vanilla plus non-Photon shaderpack cases pass. (photon-v1.3b is broken on Adreno independently of this work.) - The /sdcard/MG/exp_relaxed_precision_all and exp_no_relaxed_precision file toggles are development scaffolding for A/B measurement; they must go before this ships.