proomt

Search

Search posts, papers, and topics

All posts

Hacker News front pageAgentlien12 min readintermediate

Anatomy of a Texture

Summary

A practical deep‑dive into modern texture memory layout: block‑compression (BC7), swizzle ordering (Morton/Z‑order), mip‑map hierarchies, and concrete debugging tricks for cross‑platform texture conversion.

  • BC7 stores texels in 4×4 blocks (16 bytes per block), turning a 32‑bit RGBA texel into ~1 byte and improving cache locality.
  • Swizzle patterns (e.g., Morton/Z‑order) reorder texels to keep spatially adjacent texels close in memory; different platforms may use different swizzles, requiring full re‑ordering on conversion.
  • Mip‑maps are a hierarchy of down‑sampled textures (each level half the width/height) that must be laid out and addressed correctly for each level.
  • Debugging compressed textures is hard; replace each 16‑byte block with known 32‑bit values (e.g., coordinates) or all‑zero blocks to create visual markers that survive compression.

Incorrect address calculations or swizzle mismatches produce garbled textures that are hard to diagnose, especially when dealing with compressed formats that hide raw data. Understanding the layout lets engineers write reliable cross‑platform asset pipelines and faster debugging tools.

6/10

Related reading

  1. Benchmarking Wild vs Mold

    Reproduces Mold’s linker benchmarks on a 16‑core Ryzen, shows that configuration (filesystem, delete‑output, fork) explains most of the Wild vs Mold speed gap, and notes recent Mold releases and upcoming Wild tweaks that close the gap.

    Lobstersgithub.io4 minHN461lobste.rs52
  2. DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression

    DeepSeek‑V4.1‑Flash is a 552B‑parameter multimodal Mixture‑of‑Experts LLM that supports up to 1 M‑token contexts while slashing KV‑cache memory to 890 bytes/token (≈¼ of its predecessor) via cross‑layer reuse (CSA2) and FP4 quantisation, plus a SWA‑Bounded Replay scheme that cuts persistent cache to 1/8. The Causal Encoder‑Decoder design halves prefill compute (8B vs 16B active parameters) and th…

    Hugging Face Daily Papersarxiv.org3 minpaperHN12710
  3. Vectorized and performance-portable Quicksort (2022)

    Google’s Highway library now includes a fully portable SIMD‑vectorized quicksort that runs 9‑19× faster than C++ std::sort. By using compress‑store (or permute‑based emulation) for partitioning, the same C++ code targets AVX2, AVX‑512, NEON, SVE and RISC‑V V. Benchmarks show 0.5 GB/s on an Apple M1 and >1 GB/s on a 3 GHz Skylake, beating prior architecture‑specific sorts. The implementation and a…

    Hacker News front pagegoogleblog.com3 minHN460142