#751 Implement filters as shaders
Labels: Flash Viewer
Filters are slow. If you have a lot of time:) please implement the filters as shaders, becauase the graphics card is much faster.
we could make filters faster to load, by reducing unecessary pixel use.
What do you mean "unecessary pixel use"? The images are already rendered in the required size only.
I did some testing with the shaders - I never did anything with the opengl before. Filter calculation with the shaders is fast, but if we want to process the image later in java, we must get the data from graphics card back to PC RAM and this is relatively slow task. I tried to make simple blur filter(+ save to PNG) and compared speed with and without the shader and it took a little more time with the shader because of the pixel data transfer. So I think that if we want to make our flash viewer to run faster, it would be better to render the whole scene with opengl+shaders, not just process the blured images. Then it will gain some speed. I don't think that Graphics2D can be easily adopted to openGl to render shapes, since openGl uses triangles. Maybe some cooperation - render shapes in FFDec, then combine them as textures in opengl with shaders. Maybe we can use the shaders in HTML5 export too - WebGL. There might be similar problem. I lost a mood a bit with the openGl... shaders are quite easy... but rendering whole scene... it's a quite big piece of cake.
Ha, looks like I had intel oboard graphics card enabled while testing. Now I switched to the correct NVidia and it looks better :-) The sample test: with ffdec: 228 ms with shader: 183 ms (80%) with shader detailed: shader creation: 14 ms load texture: 18 ms shader run: 2 ms grab screen: 29 ms saving image: 15 ms
How big was the test image?