#47

Texture LOD bias setting on top of the shader bias

Draftcodedpalettewants to merge intofrom

Depends on #32 and #45. Until they merge, this branch also shows their commits; only the last two commits are new.

This adds the texture LOD bias setting that was in #32. It adds to the per-texture bias that #45 applies in fragment shaders, so it also works on Apple7 GPUs such as the M1, which ignore MTLSamplerDescriptor.lodBias.

  • The setting is a slider from -2 to 2 under Graphics, on macOS and iOS, and NX_LOD_BIAS=<-4 to 4> for nxhost.
  • It applies only to mipmapped 2D game textures, not to render targets or cube maps. The cube maps hold prefiltered lighting, and a bias of +2 on them turned the character's hair black.

Tests

  • cargo test --workspace passes, ./make-app.sh builds the macOS app, and the iOS launcher sources pass swiftc -typecheck with the iOS SDK.
  • Tested on macOS (M1) with update 4.0.1 on Dragon Driftway: textures get blurrier at +0.5 to +2, and the character keeps its colors at +2. Values below 0 were not checked.