I want to debug a GLSL Shader. What i need is to send Strings information. I have tried FBO but this is not a clean way
Is there a way to send log to the main program?
I want to debug a GLSL Shader. What i need is to send Strings information. I have tried FBO but this is not a clean way
Is there a way to send log to the main program?
No, there is no way to send strings from a shader to a main program.
What you usually do is to output specific colors for specific cases. Depending on your hardware CodeXL or Nvidia NSight might also help.
You can do following if you want to have some kind of your own error codes.
You can use transform feedback. Transform feedback cant store strings . It is generally used to store per vertex or per primitive attribute.You may define some error codes. for example
In Application
#define VERTICES_TRANSFORMED_WRONGLY 1
in VS shader
#define VERTICES_TRANSFORMED_WRONGLY 1
void main(void)
{
if(condition for error met)
write error code(VERTICES_TRANSFORMED_WRONGLY) to Transform feedback.
}
In Application
Read this transform feedback if it has any error code you know what went wrong.
You can attach transform feedback after every shader stage. [Edit suggested by BDL] : You cant attach Transform Feedback after fragment shader but you can do something similar with FBO for fragments shader stage.
Note : I would still suggest you to use tools you have already been referred like Renderdoc ,glDebugger,Nsight .