Hi,
The glsl compiled version of the shaders in unity always use a temporary in lowp precision to read a texture then is copied to the variable with the precision u defined in your shader. For example :
half4 c = tex2D( …
becomes something like this
What is the reason behind this? Is there any way to bypass this in “unitys shaderlab compiler” and read with a mediump directly from the texture fetch?
lowp is 8 bits but after filtering the hardware should be able to provide more than 8 bits precision? So if you are doing a texture lookup and not reading just a color, u might need more than 8 bits precision (like in my case reading uvs, which I know is makes to fail the texture prefetch).
Thanks
Thanks Martin for your answer.
I saw that even when your write the glsl version Unity creates defines to set lowp mediump highp to nothing.
powervr is internally working in floating point I dont see why they would mask the result to 8 bits as the filtering gives extra precision which could be useful to interpolate in lookups. I will do a test later in xcode to verify this. At least with other gpus I didnt have a problem with this independently of the texture format.