demotool/shaders/copy.glsl

21 lines
502 B
Text
Raw Normal View History

2017-09-30 14:59:15 +02:00
#version 450 core
layout( location = 0 ) uniform sampler2D u_InputTexture;
layout( location = 1 ) uniform int u_LOD;
2017-09-30 14:59:15 +02:00
layout( location = 0 ) out vec4 color;
void main( void )
{
#if 1
vec2 ts = textureSize( u_InputTexture , u_LOD );
2017-09-30 14:59:15 +02:00
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
2017-09-30 14:59:15 +02:00
}