• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
lj_archer

DrawElements failed in Mali400

9 posts in this topic

Hi, All

 

I am writing a simple application to draw some rectangle on the screen. 

 

But it failed on Mali400 GPU. It works on our other phones, such as Adreno225, SGX540.

 

Can someone tell me what's wrong? Is the Mali400's issue??

 

Thanks.

0

Share this post


Link to post
Share on other sites

It's unlikely to be the Mali 400 itself -- because it's definitely possible to draw things on the screen. I mean, really... what are the chances that someone's shipped a whole series of phones that can't render anything to the screen? Wouldn't someone else have noticed? Isn't a chip that used in a billion phones likely to have been a little bit tested?

 

Isn't it more likely that it's your application?

 

If you post the source, we could have a look at it for you.

1

Share this post


Link to post
Share on other sites

It's unlikely to be the Mali 400 itself -- because it's definitely possible to draw things on the screen. I mean, really... what are the chances that someone's shipped a whole series of phones that can't render anything to the screen? Wouldn't someone else have noticed? Isn't a chip that used in a billion phones likely to have been a little bit tested?

 

Isn't it more likely that it's your application?

 

If you post the source, we could have a look at it for you.

 

 

Hi, Katie,

 

Thank you for your reply.

 

Here are my code snippet:

 

int nrow = 10;
int ncol = 10;
int nNum = (nrow+1)*(ncol+1);

GLfloat* pVert = (GLfloat*)malloc(nNum*4*sizeof(GLfloat));
if( NULL==pVert )
    return;

memset(pVert, 0, nNum*4*sizeof(GLfloat));

float fw = 2.0f/nrow;
float fh = 2.0f/ncol;
int step = 0;

for( int i=0; i<col+1; i++ )
{
    for( int j=0; j<row+1; j++ )
    {
        pVert[step]=-1.0f+fw*j; pVert[step+1]=-1.0f+fh*i; pVert[step+2]=0.5f, pVert[step+3]=1.0f;
        step += 4;
    }
}

GLuint* pIndex = (GLuint*)malloc(nrow*ncol*6*sizeof(GLuint));
if( NULL == pIndex )
{
    free(pVert);
    return;
}
memset( pIndex, 0, nrow*ncol*6*sizeof(GLuint) );

step = 0;
for( int i=0; i<ncol; i++ )
{
    for( int j=0; j<row; j++ )
    {
        pIndex[step] = (row+1)*i+j;
        pIndex[step+1] = (row+1)*i+j+(row+1);
        pIndex[step+2] = (row+1)*i+j+1;
        pIndex[step+3] = (row+1)*i+j+(row+1);
        pIndex[step+4] = (row+1)*i+j+1;
        pIndex[step+5] = (row+1)*i+j+1+(row+1);

        step+=6;
    }
}

 

 

and here are the render function:

 

glClearColor( 0.2f, 0.2f, 0.2f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glUseProgram( nProgram );
glVertexAttribPointer( nVert, 4, GL_FLOAT, GL_FALSE, 0, pVert );

glDrawElements( GL_TRIANGLES, nNum*3, GL_UNSIGNED_INT, pIndex );

glFlush();
vdkSwapEGL(&egl);

 

 

The shaders do nothing just gl_Position = "input position", gl_FragColor=vec4(1.0, 0.0, 0.0, 1.0);

 

The Mali400 GPU cannot render anything, but Adreno225 and SGX540 rendering what I expected.

 

Thank you~

0

Share this post


Link to post
Share on other sites

I can't see anything obvious in the host portion of the code -- certainly if that stuff works on the other phones I'd say there's no problem there.

 

Are you sure the shader compiles/links/uses? That's a pretty common cause of renders doing nothing. (And it's a step whose functionality differs between the different phone hardwares).  Can you run the shader through the Mali offline compiler? (Available from Arm's developer site)

 

 
There's also a few example programs on their website which you could compile up and try out (they should defn render).
1

Share this post


Link to post
Share on other sites

Take a look at the quick reference card (or spec):

 

DrawElements accepts for type: UNSIGNED_BYTE, UNSIGNED_SHORT

 

GL_UNSIGNED_INT is likely causing an error - do you see anything returned from glGetError?

Note, you will need to make sure you change the type of data you submit as well. So the GLuint * would be GLushort* etc.

1

Share this post


Link to post
Share on other sites

It's unlikely to be the Mali 400 itself -- because it's definitely possible to draw things on the screen. I mean, really... what are the chances that someone's shipped a whole series of phones that can't render anything to the screen? Wouldn't someone else have noticed? Isn't a chip that used in a billion phones likely to have been a little bit tested?
 
Isn't it more likely that it's your application?

Actually, in this particular case, it is likely to be his use of GL_UNSIGNED_INT, but the frank fact is that Mali400 shader compilers do not adhere to the OpenGL ES 2.0 standard and many things that run on other devices simply will not on Mali400. This was a major problem for us when porting our in-house engine, compounded by the fact that you can’t set breakpoints in Native Activity apps.

Since I was not on that team I don’t remember the details, but it had to do with array access. Either array access was completely broken or buggy, or there were artificial restrictions on accessing arrays, such as that they could only be accessed with constants, not variables.

So, in fact, it quite likely could have been specifically the Mali400 that was actually causing the problems. The Mali400 is capable of rendering some things, but they really did ship millions of devices that can’t render most things that work fine on other devices.


This is why it just never pays to support Android.


L. Spiro

Edited by L. Spiro
1

Share this post


Link to post
Share on other sites

I can't see anything obvious in the host portion of the code -- certainly if that stuff works on the other phones I'd say there's no problem there.

 

Are you sure the shader compiles/links/uses? That's a pretty common cause of renders doing nothing. (And it's a step whose functionality differs between the different phone hardwares).  Can you run the shader through the Mali offline compiler? (Available from Arm's developer site)

 

 
There's also a few example programs on their website which you could compile up and try out (they should defn render).

 

Hi, Katie,

 

It was not the shader issue. Otherwise, it will be failed on other chip.

 

And it was failed because the wrong arguments of DrawElements. I should use UNSIGNED_SHORT instead of UNSIGNED_INT.

 

Thank you~~

0

Share this post


Link to post
Share on other sites

Take a look at the quick reference card (or spec):

 

DrawElements accepts for type: UNSIGNED_BYTE, UNSIGNED_SHORT

 

GL_UNSIGNED_INT is likely causing an error - do you see anything returned from glGetError?

Note, you will need to make sure you change the type of data you submit as well. So the GLuint * would be GLushort* etc.

 

Hi, adampetrone, Thank you!

 

I can render it successfully now. Just using UNSIGNED_SHORT instead of UNSIGNED_INT.

 

This is a great help !!!

0

Share this post


Link to post
Share on other sites

It's unlikely to be the Mali 400 itself -- because it's definitely possible to draw things on the screen. I mean, really... what are the chances that someone's shipped a whole series of phones that can't render anything to the screen? Wouldn't someone else have noticed? Isn't a chip that used in a billion phones likely to have been a little bit tested?
 
Isn't it more likely that it's your application?

Actually, in this particular case, it is like to be his use of GL_UNSIGNED_INT, but the frank fact is that Mali400 shader compilers do not adhere to the OpenGL ES 2.0 standard and many things that run on other devices simply will not on Mali400. This was a major problem for us when porting our in-house engine, compounded by the fact that you can’t set breakpoints in Native Activity apps.

Since I was not on that team I don’t remember the details, but it had to do with array access. Either array access was completely broken or buggy, or there were artificial restrictions on accessing arrays, such as that they could only be accessed with constants, not variables.

So, in fact, it quite likely could have been specifically the Mali400 that was actually causing the problems. The Mali400 is capable of rendering some things, but they really did ship millions of devices that can’t render most things that work fine on other devices.


This is why it just never pays to support Android.


L. Spiro

 

Hi, L. Spiro,

 

Your reply is very usful. The Adreno, SGX have a good compatibility but Mali. I should pay more attention.

 

But this time is my fault. I am not read the opengl es spec carefully. Using UNSIGNED_INT cause this issue.

 

Thank you!!

0

Share this post


Link to post
Share on other sites

" Using UNSIGNED_INT cause this issue."

 

Ah. Yes. That would do it. I missed that one.

 

 

"Mali400 shader compilers do not adhere to the OpenGL ES 2.0 standard"

 

If you find examples of how it doesn't, then I'll happily see if I can pass them on to the guys there to see about getting them fixed; but certainly in most of the cases I looked at, the claimed non-conformance was actually down to the Mali 400 system conforming very, very closely to the letter of the spec -- and the result is that things which happen to work on other chipsets don't work on Mali 400 (like this).

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0