Hi,
After running my app through NSight, I've seen that the image sharpening shader I use takes around 3 ms to process a 1600x1200 texture.
The GPU is a nVidia GTX 560 Ti.
This seems quite high to me, but I do not know why it takes so much time.
The shader code, nothing complicated :
#version 330
uniform sampler2D sceneSampler;
uniform vec4 screenSize;
in vec2 Texcoord;
out vec4 oColor;
float kernel[9]=float[9]
(
0.0,
-1.0,
0.0,
-1.0,
5.0,
-1.0,
0.0,
-1.0,
0.0
);
vec2 offset[9]=vec2[9]
(
vec2(-1.0, -1.0),
vec2( 0.0, -1.0),
vec2( 1.0, -1.0),
vec2(-1.0, 0.0),
vec2( 0.0, 0.0),
vec2( 1.0, 0.0),
vec2(-1.0, 1.0),
vec2( 0.0, 1.0),
vec2( 1.0, 1.0)
);
void main()
{
vec4 result= vec4(0.0);
int i;
for (i = 0; i < 9; i++)
{
vec4 color = textureLod(sceneSampler, Texcoord + offset[i]*screenSize.zw,0);
result += color * kernel[i];
}
oColor=result;
}
One strange thing: if I use change the arrays to const, the shader execution times increases to 12 ms ! I've read such things about glsl shaders, but does anybody have an explanation ?
Thanks for any help/ hint.