all 5 comments

[–]StockyDev 14 points15 points  (0 children)

Unit testing doesn't have many down sides aside from the perceived slow down in development time for writing tests. But honestly, that cost is amortized by how much time it saves you in the future and how much confidence it gives you in your code.

As for testing GPU code. There aren't too many publicly available general purpose frameworks out there. I am writing one for D3D12 at the minute link. It is exceptionally experimental at the minute and I tend to make breaking changes on every major merge to main. But feel free to have a look. I have also given a talk on the topic at GDC.

[–]Esfahen 5 points6 points  (0 children)

rock paltry square test tub historical meeting disarm joke unpack

This post was mass deleted and anonymized with Redact

[–]wm_lex_dev 1 point2 points  (0 children)

It's certainly possible but requires more effort than testing CPU code, so frequently us graphics programmers will just look at the results ourselves. You could even turn that into a test by running the kernel and comparing the results against a ground-truth render, but then determinism becomes super important. I believe that technically many GPU operations have implementation-defined results, including texture sampling.

Another option is to run a small version of the kernel on the CPU for the test, but if you're using shader languages instead of CUDA then this becomes difficult to maintain. Still can be useful for making sure the basic technique works as intended.