Hi!
I am developing UI application for embedded system running on Mali-400 GPU.
So far I have stumbled with following strange behavior: glDrawElements works differently if called with
different parameters.
Scenario: 8 vertices, 12 indices describing 2 rectangles - dark grey and red above it.
1. Variant 1:
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, 0);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, (const GLushort*)(0) + 6);
only dark gray triangle is drawn - where is the red triangle???
2. Variant 2:
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (const GLushort*)(0) + 6);
only dark gray rectangle is drawn (which is expected) - but where is red triangle???
3. Variant 3:
glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_SHORT, (const GLushort*)(0));
both dark and red rectangles are drawn (which is expected result)
Why second glDrawElements call in variants 1 and 2 does not produce anything on screen?
Is it something related to internal pipeline optimizations or am I completely missing something here?
I have checked the same code on another device which is running on PowerVR GPU - everything is
fine there, no questions, that is why I came here to Mali support forums.
Executing grep --binary-files=text REVISION libMali.so on libMali shows some entries of REVISION=467.
I was able to create a reproducible program (for Android) which demonstrates those cases.
All those described scenarios are in jniexports.c:render of attached archive (lines 261-276).
On both my Mali-400 MP and Mali-450 MP, the first variant draws a red triangle inside a dark gray triangle, on the upper-left with an orange background. So it might be a bug impacting non-MP version of Mali-400 ? The following variants just draw rectangles, instead of triangles.
The driver I'm using seems to be quite old though. ls -l libMali.so shows 2013-04-15 and there is no REVISION string inside the libMali.so of my Mali-400 MP tablet.
However, I used your project to toy with apitrace and I was able to extract an editable trace from my Mali-450MP tablet that I've attached here. I also attached a Mali Graphics Debugger trace file. That might help pinpointing the problem more easily.
myy,
Thank you for your time. I suppose in this case it is something with version of libMali.so you and I using. As I mentioned in my previous post I suppose it has something to do with some internal (pre)processing/optimizations during glDrawElements call. But frankly this is a strange behavior, because I haven`t seen in specification of OpenGL ES 2.0 any restrictions on the number of calls to glDrawElements and to support my point - such rendering works fine on other GPUs (I`ve checked it on another tablet powered with PowerVR GPU) and on desktop Intel and AMD powered GPUs (though the latter may be less relevant since desktop GPUs are much more powerful then embedded ones).
It is entirely possible that is a driver bug.
The problem is somewhat similar. Though, the solution discuss about triangles reordering, where here there's only 3 triangles, so it might not be appropriate.
Does the problem still occur if you just use glDrawArrays and provide an identical set of coordinates ?
Also, is there way to get a screenshot of the behaviour. On Android, you need to push the following physical buttons simultaneously to get a screenshot : Volume Down and Power. It should be saved in a "Screenshots" folder at the root the external storage (/sdcard/Screenshots generally).
myy wrote: It is entirely possible that is a driver bug. Did you take a look at this discussion : Mali-400 MP driver bug ? The problem is somewhat similar. Though, the solution discuss about triangles reordering, where here there's only 3 triangles, so it might not be appropriate.
myy wrote:
It is entirely possible that is a driver bug. Did you take a look at this discussion : Mali-400 MP driver bug ?
Yes, I`ve read that thread and it looks similar to my problem. I even checked the revision of libMali.so as was stated in that thread and it appears that it is higher than those with fix, though it is not a strong evidence.
Yes, both glDrawArrays and glDrawElements seem behave similarly.
For this time being I consider a driver bug.
I have attached 2 screenshots: one for glDrawElements and the other for glDrawArrays calls.
Hi, Erik,
I have just replay or verify your test app on our latest driver, we have not found this issue, could you please provide some specification about your platform? such as android version, platform vendor or something, then I can guess the rough version of our driver version. thank you.
brandon,
I am developing on HiSilicon SoC (model Hi3719CV100). This SoC integrates Mali-400 GPU. Performing a 'grep REVISION' on libMali.so I`ve found REVISION=467 in the output. I suppose it is all info I possess right now. Android version provided by a vendor is 4.2.
sorry to reply late。
This issue could be reproduced on our old driver, while it's fixed on our latest driver, could you please upgrade your system to check if this problem still exists, because when the cell phone manufacturer release new version of system, the new version of hardware drivers will be released at the same time.
Brs
Brandon
Brandon,
Thank you very much for your reply. This is indeed helpful and approves my own thoughts. I will inquire device vendor about driver update.