Hello,
I am using std140 for Uniform Block Layout, I defined a simple uniform block like below:
on the cpu side, I defined the structure like MyTestStruct {Vector4 FinalColor1;
Vector4 FinalColor2;
Vector4 ColorIndex;
Vector4 FinalColor3;
}
I tested mediump data precision in the shader and It works on my android phone with MaliG76. but I don't known if this is valid on all mali gpu.
layout(binding = 0, std140) uniform MyTestBlock {mediump vec4 FinalColor1;mediump vec4 FinalColor2;mediump vec4 ColorIndex;mediump vec4 FinalColor3;};
Will there be a default highp->mediump conversion? If Yes, is it on every shader execution or is there a special optimization?
Thanks!
Hi cloud_zero,
The standard GLSL data types are always 32-bit in uniform/storage memory; the precision qualifier only impacts the shader interpretation of the data. Mali can convert precision on load, so there is no overhead here.
If you always want narrower types in memory you need the following extensions:
Cheers,Pete
Thanks Peter!BTW which gpu support GL_EXT_shader_16bit_storage?Is this extension supported on gles?
All Valhall devices (G57/G77+) have support for GL_EXT_shader_16bit_storage and most Bifrost - anything with a driver of r9 or above - so your G76 should have it.But you need Vulkan to use it, sorry. Related question: https://community.arm.com/support-forums/f/graphics-gaming-and-vr-forum/47752/16bit-float-uniforms-in-opengl-es-3-x-when-using-arm-mali-gpus
Really helpful, Thanks!