Diagnosing problems in shaders

Started by
4 comments, last by Hodgman 7 years, 10 months ago

Hello. After implementing a lot of stuff i moved to skybox. And so i went through the tutorial and... there is nothing rendered on the sky. All my textures, axes i draw are properly visible. What should i do? There are so many components in the pipeline for skybox that the mistake can be everywhere. How should i diagnose the problem?

Greetz

Edit: Oh i noticed that i messed up the move constructor.

The question about diagnosing shaders is still actual and buggs me a lot :)

Advertisement

I'm no expert at debugging shaders, there are tools to help you do so but I haven't ventured into trying them yet. What I do when I have to debug a shader is firstly to make it as simple as possible (work on the very barebones, first input) and to output things as colors so I can see what's going on. For example, if I think maybe a value isn't being set correctly I might put in my shader if(value==expected) then green, else red. It's really not great but it does work.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

So like printf debugging :) I got you

You can try using pixwin, but be careful with it.

It is very good at meshes and transforms, but it emulates the GPU so shaders that run correctly in pixwin may not run correctly in real life.

So like printf debugging :) I got you

Yeah, that's a good analogy.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

RenderDoc is my go-to debugging tool for graphics.

For "printf" debugging like Nanoha described, it really helps if you set up a key in your game that reloads all the shaders from disk. This should only take a few seconds to reload every shader, and it lets you very quickly write some "printf" test code, hit ctrl+s, hit alt+tab, press your reload-shaders button, and see new results. Sometimes it means you can find bugs in one minute instead of 30 minutes :D

This topic is closed to new replies.

Advertisement