Hey all! I’ve been thinking about how to best unit-test my shader code, since TDD has been very helpful for me. But I’ve been able to find surprisingly little information. If possible, I’d love to hear from your experiences!

  • nark3d
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    Where did that t come from, and does it survive a driver update? The snapshot from one GPU becomes the reference for hardware you don’t have, so the threshold has to absorb whatever the vendor’s rounding does before it can catch anything you changed.

    • FooBarrington@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      20 hours ago

      The code snippet, or what exactly? Everything comes from my brain.

      Yeah, that’s what I tried to express with the snippet. But even if a driver update every now and then invalidates your snapshots - so what? You can either manually verify them, or just regenerate them from the last known working commit and keep going.

      I’ve now written ~60 tests for ~10 shader functions, and it’s been an enormous help. Can’t recommend it enough!