"you can't debug print shaders" oh yeah? well check this shit out
that's right, a whole ass view matrix, served directly from the GPU
"you can't debug print shaders" oh yeah? well check this shit out
that's right, a whole ass view matrix, served directly from the GPU
here's the source code by the way!
https://gist.github.com/FreyaHolmer/71717be9f3030c1b0990d3ed1ae833e3
@acegikmo Neat trick!
For printing to actual console did you explore maybe writing debug messages to a structured GPU buffer and reading back async on the CPU and then just displaying in normal tty console?
@acegikmo Ah. I thought it was C#, not hlsl. my mistake. Dunno how it being for a shader didn't tip me off to that..., but I also should not have read float DrawDigit as func DrawDigit lol.
In any event, it appears no. binary for literals is not supported https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-grammar#integer-numbers Tho hex and oct are, so its odd its missing.
@deef @acegikmo I think this may be the first time I've seen a somewhat legit use case for octal other than Unix permissions. (although it would still be less readable than binary)
Interestingly, binary is a late addition in many languages. C# didn't have it until version 7, and C++ until version 14.
In our engine we can printf from shaders, with extended format specifier syntax for vectors and matrices. We can also create debug primitives from shaders. Extremely helpful. It's often the first thing I implement when I start using a new engine, along with shader hot recompliation if it's not already there. Iteration time and ease of debugging are super important in my opinion.
Thats some incredible html in the "gif"
@acegikmo this is really cool. But also, newest GDB can actually debug GPU code on AMD GPUs. You need a proprietary blob from and to do it tho =/
Also idk what Nvidia or Intel are doing, but I think there's chat about how to standardize debug info for GPU code so that we won't need the proprietary blob anymore and more GPUs could be supported
@supersingular I don't know to be honest. I just see patches flying through every so often
It might be a ROCm specific feature, now that you mention it 
w h a t
@acegikmo GL_EXT_debug_printf would like to have a word with you...
But interactive on-screen debug visualizations are definitely nicer in a lot of cases than logging to stdout.
GL_EXT_debug_printf