mirror of https://github.com/PCSX2/pcsx2.git
gsdx: add glsl debug capabilities
Useful to debug bad texture sampling
This commit is contained in:
parent
98d8ad7484
commit
05eb1641f2
|
@ -458,7 +458,12 @@ 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"
|
||||||
|
"// APITRACE_DEBUG allows to force pixel output to easily detect \n"
|
||||||
|
"// the fragment computed by primitive \n"
|
||||||
"#define APITRACE_DEBUG 0\n"
|
"#define APITRACE_DEBUG 0\n"
|
||||||
|
"// TEX_COORD_DEBUG output the uv coordinate as color. It is useful\n"
|
||||||
|
"// to detect bad sampling due to upscaling\n"
|
||||||
|
"//#define TEX_COORD_DEBUG\n"
|
||||||
"\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"
|
||||||
|
@ -1057,6 +1062,9 @@ static const char* tfx_glsl =
|
||||||
" if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)\n"
|
" if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" c[0] = sample_c(clampuv(st));\n"
|
" c[0] = sample_c(clampuv(st));\n"
|
||||||
|
"#ifdef TEX_COORD_DEBUG\n"
|
||||||
|
" c[0].rg = clampuv(st).xy;\n"
|
||||||
|
"#endif\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
@ -1082,6 +1090,9 @@ static const char* tfx_glsl =
|
||||||
" {\n"
|
" {\n"
|
||||||
" c = sample_4c(uv);\n"
|
" c = sample_4c(uv);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
|
"#ifdef TEX_COORD_DEBUG\n"
|
||||||
|
" c[0].rg = uv.xy;\n"
|
||||||
|
"#endif\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // PERF: see the impact of the exansion before/after the interpolation\n"
|
" // PERF: see the impact of the exansion before/after the interpolation\n"
|
||||||
|
@ -1436,11 +1447,15 @@ static const char* tfx_glsl =
|
||||||
"\n"
|
"\n"
|
||||||
" vec4 zero = vec4(0.0f, 0.0f, 0.0f, 0.0f);\n"
|
" vec4 zero = vec4(0.0f, 0.0f, 0.0f, 0.0f);\n"
|
||||||
" vec4 one = vec4(1.0f, 1.0f, 1.0f, 1.0f);\n"
|
" vec4 one = vec4(1.0f, 1.0f, 1.0f, 1.0f);\n"
|
||||||
|
"#ifdef TEX_COORD_DEBUG\n"
|
||||||
|
" vec4 c = clamp(t, zero, one);\n"
|
||||||
|
"#else\n"
|
||||||
"#if PS_IIP == 1\n"
|
"#if PS_IIP == 1\n"
|
||||||
" vec4 c = clamp(tfx(t, PSin_c), zero, one);\n"
|
" vec4 c = clamp(tfx(t, PSin_c), zero, one);\n"
|
||||||
"#else\n"
|
"#else\n"
|
||||||
" vec4 c = clamp(tfx(t, PSin_fc), zero, one);\n"
|
" vec4 c = clamp(tfx(t, PSin_fc), zero, one);\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
|
"#endif\n"
|
||||||
"\n"
|
"\n"
|
||||||
" atst(c);\n"
|
" atst(c);\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
#define FMT_16 2
|
#define FMT_16 2
|
||||||
#define FMT_PAL 4 /* flag bit */
|
#define FMT_PAL 4 /* flag bit */
|
||||||
|
|
||||||
|
// APITRACE_DEBUG allows to force pixel output to easily detect
|
||||||
|
// the fragment computed by primitive
|
||||||
#define APITRACE_DEBUG 0
|
#define APITRACE_DEBUG 0
|
||||||
|
// TEX_COORD_DEBUG output the uv coordinate as color. It is useful
|
||||||
|
// to detect bad sampling due to upscaling
|
||||||
|
//#define TEX_COORD_DEBUG
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -606,6 +611,9 @@ vec4 sample_color(vec2 st, float q)
|
||||||
if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)
|
if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)
|
||||||
{
|
{
|
||||||
c[0] = sample_c(clampuv(st));
|
c[0] = sample_c(clampuv(st));
|
||||||
|
#ifdef TEX_COORD_DEBUG
|
||||||
|
c[0].rg = clampuv(st).xy;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -631,6 +639,9 @@ vec4 sample_color(vec2 st, float q)
|
||||||
{
|
{
|
||||||
c = sample_4c(uv);
|
c = sample_4c(uv);
|
||||||
}
|
}
|
||||||
|
#ifdef TEX_COORD_DEBUG
|
||||||
|
c[0].rg = uv.xy;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// PERF: see the impact of the exansion before/after the interpolation
|
// PERF: see the impact of the exansion before/after the interpolation
|
||||||
|
@ -985,10 +996,14 @@ vec4 ps_color()
|
||||||
|
|
||||||
vec4 zero = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
vec4 zero = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
vec4 one = vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
vec4 one = vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
#ifdef TEX_COORD_DEBUG
|
||||||
|
vec4 c = clamp(t, zero, one);
|
||||||
|
#else
|
||||||
#if PS_IIP == 1
|
#if PS_IIP == 1
|
||||||
vec4 c = clamp(tfx(t, PSin_c), zero, one);
|
vec4 c = clamp(tfx(t, PSin_c), zero, one);
|
||||||
#else
|
#else
|
||||||
vec4 c = clamp(tfx(t, PSin_fc), zero, one);
|
vec4 c = clamp(tfx(t, PSin_fc), zero, one);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
atst(c);
|
atst(c);
|
||||||
|
|
Loading…
Reference in New Issue