gsdx: add some helper to debug openGL renderer

This commit is contained in:
Gregory Hainaut 2015-04-03 20:28:44 +02:00
parent 5269e54f02
commit e40a26be19
3 changed files with 31 additions and 0 deletions

View File

@ -104,7 +104,10 @@ void GSShaderOGL::PS(GLuint s, GLuint sub_count)
{ {
m_ps_sub_count = sub_count; m_ps_sub_count = sub_count;
#ifndef _DEBUG
// In debug always sets the program. It allow to replace the program in apitrace easily.
GLState::ps = s; GLState::ps = s;
#endif
GLState::dirty_prog = true; GLState::dirty_prog = true;
GLState::dirty_subroutine_ps = true; GLState::dirty_subroutine_ps = true;
GLState::dirty_ressources = true; GLState::dirty_ressources = true;

View File

@ -458,6 +458,8 @@ static const char* tfx_glsl =
"#define FMT_16 2\n" "#define FMT_16 2\n"
"#define FMT_PAL 4 /* flag bit */\n" "#define FMT_PAL 4 /* flag bit */\n"
"\n" "\n"
"#define APITRACE_DEBUG 0\n"
"\n"
"// Not sure we have same issue on opengl. Doesn't work anyway on ATI card\n" "// Not sure we have same issue on opengl. Doesn't work anyway on ATI card\n"
"// And I say this as an ATI user.\n" "// And I say this as an ATI user.\n"
"#define ATI_SUCKS 0\n" "#define ATI_SUCKS 0\n"
@ -1477,6 +1479,18 @@ static const char* tfx_glsl =
"#endif\n" "#endif\n"
"\n" "\n"
" vec4 c = ps_color();\n" " vec4 c = ps_color();\n"
"#if (APITRACE_DEBUG & 1) == 1\n"
" c.r = 1.0f;\n"
"#endif\n"
"#if (APITRACE_DEBUG & 2) == 2\n"
" c.g = 1.0f;\n"
"#endif\n"
"#if (APITRACE_DEBUG & 4) == 4\n"
" c.b = 1.0f;\n"
"#endif\n"
"#if (APITRACE_DEBUG & 8) == 8\n"
" c.a = 0.5f;\n"
"#endif\n"
"\n" "\n"
" float alpha = c.a * 2.0;\n" " float alpha = c.a * 2.0;\n"
"\n" "\n"

View File

@ -7,6 +7,8 @@
#define FMT_16 2 #define FMT_16 2
#define FMT_PAL 4 /* flag bit */ #define FMT_PAL 4 /* flag bit */
#define APITRACE_DEBUG 0
// Not sure we have same issue on opengl. Doesn't work anyway on ATI card // Not sure we have same issue on opengl. Doesn't work anyway on ATI card
// And I say this as an ATI user. // And I say this as an ATI user.
#define ATI_SUCKS 0 #define ATI_SUCKS 0
@ -1026,6 +1028,18 @@ void ps_main()
#endif #endif
vec4 c = ps_color(); vec4 c = ps_color();
#if (APITRACE_DEBUG & 1) == 1
c.r = 1.0f;
#endif
#if (APITRACE_DEBUG & 2) == 2
c.g = 1.0f;
#endif
#if (APITRACE_DEBUG & 4) == 4
c.b = 1.0f;
#endif
#if (APITRACE_DEBUG & 8) == 8
c.a = 0.5f;
#endif
float alpha = c.a * 2.0; float alpha = c.a * 2.0;