diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2008-05-21 17:15:07 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2008-05-21 17:15:07 +0100 |
commit | 019fc3aa04f11d61e6d0f4791c171d1790577ab5 (patch) | |
tree | 3a9cd284d00910388876b8d08d20bfc7f3faa841 /progs/glsl/convolution.frag | |
parent | bf7519b0a40d18a1cc764357f18df59979604129 (diff) | |
parent | e8d5be9c76b08ba423e3c635aae5178f2358169a (diff) |
Merge branch 'gallium-0.1' into gallium-tex-surfaces
Diffstat (limited to 'progs/glsl/convolution.frag')
-rw-r--r-- | progs/glsl/convolution.frag | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/progs/glsl/convolution.frag b/progs/glsl/convolution.frag new file mode 100644 index 0000000000..e49b8acf54 --- /dev/null +++ b/progs/glsl/convolution.frag @@ -0,0 +1,21 @@ + +const int KernelSize = 9; + +//texture offsets +uniform vec2 Offset[KernelSize]; +//convolution kernel +uniform vec4 KernelValue[KernelSize]; +uniform sampler2D srcTex; +uniform vec4 ScaleFactor; +uniform vec4 BaseColor; + +void main(void) +{ + int i; + vec4 sum = vec4(0.0); + for (i = 0; i < KernelSize; ++i) { + vec4 tmp = texture2D(srcTex, gl_TexCoord[0].st + Offset[i]); + sum += tmp * KernelValue[i]; + } + gl_FragColor = sum * ScaleFactor + BaseColor; +} |