Output debugger

(can display intermediary buffers)
This commit is contained in:
Emmanuel BENOîT 2017-10-06 14:29:01 +02:00
parent 2ae430dc49
commit c4218efc64
21 changed files with 488 additions and 31 deletions

View file

@ -0,0 +1,18 @@
#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
vec2 ts = textureSize( u_InputTexture , u_LOD );
ivec2 pos = ivec2( ts * gl_FragCoord.xy / u_OutputSize );
o_Color = vec4( vec3( texelFetch( u_InputTexture , pos , u_LOD ).a ) ,
1 );
}

17
shaders/debug/copy.glsl Normal file
View file

@ -0,0 +1,17 @@
#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
vec2 ts = textureSize( u_InputTexture , u_LOD );
ivec2 pos = ivec2( ts * gl_FragCoord.xy / u_OutputSize );
o_Color = vec4( texelFetch( u_InputTexture , pos , u_LOD ).rgb , 1 );
}

View file

@ -0,0 +1,20 @@
#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 3 ) uniform float u_Factor;
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
vec2 ts = textureSize( u_InputTexture , u_LOD );
ivec2 pos = ivec2( ts * gl_FragCoord.xy / u_OutputSize );
float depth = texelFetch( u_InputTexture , pos , u_LOD ).x
* u_Factor;
o_Color = vec4( vec3( depth ) , 1 );
}

View file

@ -0,0 +1,18 @@
#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
vec2 ts = textureSize( u_InputTexture , u_LOD );
ivec2 pos = ivec2( ts * gl_FragCoord.xy / u_OutputSize );
vec3 c = vec3( texelFetch( u_InputTexture , pos , u_LOD ).r );
o_Color = vec4( 1 - c / ( c + 1 ) , 1 );
}

View file

@ -0,0 +1,18 @@
#version 450 core
//! type fragment
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 0 ) out vec4 o_Color;
void main( void )
{
vec2 ts = textureSize( u_InputTexture , u_LOD );
ivec2 pos = ivec2( ts * gl_FragCoord.xy / u_OutputSize );
vec3 c = texelFetch( u_InputTexture , pos , u_LOD ).rgb;
o_Color = vec4( c / ( c + 1 ) , 1 );
}

View file

@ -164,8 +164,10 @@ void main( )
}
bc = FOG_Apply( bc , length( u_CamPos - hitPos ) ,
u_FogAttenuation , background );
o_Z = r.x;
} else {
o_Z = u_Render.w;
}
o_Color = bc;
o_Z = r.x;
}

View file

@ -1,20 +0,0 @@
#version 450 core
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
layout( location = 0 ) out vec4 color;
void main( void )
{
#if 1
vec2 ts = textureSize( u_InputTexture , u_LOD );
vec2 tmp = gl_FragCoord.xy / vec2( 1280. , 720. );
ivec2 pos = ivec2( ts * tmp );
color = texelFetch( u_InputTexture , pos , u_LOD );
#else
vec2 tmp = gl_FragCoord.xy / vec2( 1280. , 720. );
color = textureLod( u_InputTexture , tmp , float( u_LOD ) );
#endif
}