Hi there,We are currently experiencing an issue with most of our shaders on the Samsung S8. We have tested these shaders on a number of desktop and mobile devices and have yet to see any other device show the same issue. No matter what attempts we make to adjust the shaders functionality / change precision of types or move away from uniforms we are finding the graphic never renders, with no errors thrown at complication or bind time.Below is an example of one of these shaders :
#version 300 es uniform sampler2D primaryTexture; uniform vec3 HSVOffset; in vec3 v_Position; in vec4 v_Color; in vec2 v_TexCoordinate; out vec4 fragmentColor; vec3 rgb2hsv(vec3 c) { vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); float d = q.x - min(q.w, q.y); float e = 1.0e-10; return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } vec3 hsv2rgb(vec3 c) { vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() { vec4 textureColour = texture(primaryTexture,v_TexCoordinate)*v_Color; vec3 hsv = rgb2hsv(textureColour.xyz); hsv.x = hsv.x + HSVOffset.x; hsv.y = hsv.y * HSVOffset.y; hsv.z = hsv.z * HSVOffset.z; vec3 finalColour = hsv2rgb(hsv); fragmentColor = vec4(finalColour,textureColour.w); }
Is there something explicitly different to the Mali G71 that i have missed whilst trying to resolve this issue or is there a known bung in the driver, if so please advise.
You're missing a default precision specifier for float data types, so this will fail to compile. I'm not sure why you are not getting a compile error reported.
Add "precision mediump float;" on the line after the "#version ...".
HTH,
Pete
Sorry Peter, i had to translate the shader over from our intermediary format to post here and missed that line, we have been compiling with precision mediump float; specified directly below the version number so this is not the cause of the error we are seeing. Please advise.
I've raised this with our compiler team, I'll let you know what we find.
Can you please let us know the GL_RENDERER and GL_VERSION strings from your driver, just so we know precisely which driver version you are running? The quick way to get these is to navigate to "chrome://gpu" in Google Chrome browser - they are in the Driver Information table.
Thanks, Pete
We can't see anything obvious wrong with the code generated for this shader on the r3p0 drivers; it seems to compile correctly and we get non-black output in our test harness.
Are you correctly querying attribute and uniform locations when setting up the data input bindings? The Bifrost compiler has been known to move attributes around, so applications incorrectly relying on bind locations being contiguous and zero indexed may go wrong. You will either need to use queries in the application or use shader source level ...
layout(location = <x>)
... annotations.
I will investigate our usage of attribute and uniform locations just to make sure we are correctly querying their locations. We would have expected to have seen similar issues on other mobile devices however is seems exclusively isolated to the Samsung S8.Regarding the driver :GL_RENDERER : Mali-G71GL_VERSION : OpenGL ES 3.2 v1.r3p0-00rel0.52a2c5ce14e045eb8b9074c171442f91
If you can share a standalone APK with a minimal test case that the reproduces the problem we're happy to take a look.
Cheers,
FYI, we are also experiencing rendering bugs specific to the Samsung S8 Mali G71, black is appearing. I've been unable to isolate the problem shader code so far, still working on it.