4 ms·
Shader Printf in HLSL and DX12
- WesSouza 3y agoNeat. In the meantime web developers keep yelling “you don’t need console.log”, lol
- jfim 3y agoWeb developers typically have working debuggers available though.
- chuckadams 3y agoI write SPAs in VueJS, but even with the vue devtools available, I still find myself using console.log so that I don't have to keep drilling down into a very deep component tree every time the page reloads. Plus, the console lets me scroll back and read the history of changes, something I'd only get in the devtools if I threw every bit of local state into pinia. The devtools come in handy from time to time, but the DX is just not there yet, and I doubt it ever will be.
- djmips 3y agoGPU often has debuggers available. PIX is very good these days for example.
- sillysaurusx 3y agoSetting the output color to red was our printf back in the day.
- dragontamer 3y agoA strong GPU programmer can do this instinctively. But thinking about it deeper, I think this is exactly the kind of project that demonstrates what is so different about GPUs vs CPU programming. In CPU programming, just sequentially outputting printf one-at-a-time works. And you can optimize this to go faster-and-faster. In GPU programming, its innately a parallel job. Any printf call will innately cause all 32-threads of your warp to call printf at the same time (at a minimum!!), which immediately requires all 32 threads to coordinate. Bonus points for expanding out to 1024-threads of a workgroup or cross-workgroup atomics with a wider CUDA-grid. This "printf" is simple enough to a typical programmer, and yet hits so many advanced parallelization problems (so "reserving" bufferspace and other such tricks to help make the parallel-back-into-sequential for CPU land)