GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Feature Request: Add bypass Flag to Filters

Open powellmark opened this issue 14 years ago • 2 comments

I have a somewhat complex filter chain, where filter values are adjustable by the user. However, many times the filters are at a "default" value where the output fragment is not changed. If at all possible for performance reasons, I'd like a flag to set to "bypass" the filter altogether when I know it's going to not apply after changes. The GPUImageFilter would simply call all its targets giving them the frame from the previous filter.

powellmark avatar Jul 26 '12 20:07 powellmark

This would require significant rearchitecting to do, and I don't know that many people who would benefit from it, seeing as how you can just reorder the filter chain to do this, so I'm going to decline this feature request.

BradLarson avatar Aug 02 '12 15:08 BradLarson

I run into similar situation, and I solved the problem (at least I think so) by slightly modifying GPUImageFilter class. I added "bypass" property, and added "bypassFilterProgram" which is compiled form default/passthrough fragment shader. Then, in "renderToTextureWithVertices:" I simply check the "bypass" flag and use "bypassFilterProgram" instead of "filterProgram". I'm still not aware of any negative implications of this method, and for now it seems to solve the "problem" I had very elegantly.

habitatus avatar Oct 14 '12 02:10 habitatus