Is it possible to increase the precision of either the fragment or vertex shader in GPUImage or in OpenGL ES ?
I am looking to use the GPU to do image processing and would like to retain as much of the original data as possible
Is it possible to increase the precision of either the fragment or vertex shader in GPUImage or in OpenGL ES ?
I am looking to use the GPU to do image processing and would like to retain as much of the original data as possible
You can request the shader to use the highest precision implemented in the hardware by using the statements:
precision highp float;
precision highp int;
or by using the highp qualifier on specific declarations. I believe the shader will default to the highest available precision in any case.
Exactly what precision that gets you will depend on the particular hardware implementation. Also, implementation of the highp qualifier in the fragment shader is optional. You can query the precision of a format with the glGetShaderPrecisionFormat() API call. On a Power VR SGX530 chip I get these values for highp float and int:
float range = 126/126, precision = 23/0
int range = 24/24, precision = 0/0
It is not possible to increase the precision without increased original texture data.
There are many way to interpolate pixel but it doesn't mean the precision is increased.
In your case , You can increase your camera preset in IOS API such as AVCaptureSessionPresetXXXXXX
GPUImage is made by OpenGL ES so the shader code is completely same between the shader code in GPUImage & any opengl es 2.0 program.
Also I want you to know what vertex & frag (pixel) shaders are doing in the pipeline . These are just one part of Redering processing.
If you didn't know this just remember Vertex shader is doing trasformation and Fragment Shader is doing Texturing .
In short, If you want to interpolate pixels It must be in Fragment shader.