• Advertisement
Sign in to follow this  

Unroll

This topic is 557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All

 

After several days of debugging

 

  // It does NOT work, crash in glDrawElements
#define MAX_TEXTURES  8
..
for (int i = 0; i < MAX_TEXTURES; ++i) {
...
}
 
// All is ok
uniform int textureCount;
...
for (int i = 0; i < textureCount; ++i) {
...
}

I guess it's unroll problem (correct me if not). I use old ATI card intentionally as "minimal" because users can have any. So should I avoid unroll anywhere just because "there are some cards where it won't work"? What are better solutions for this?

 

Thank you 

Share this post


Link to post
Share on other sites
Advertisement
I would try to isolate what is crashing the program. What happens if you put a constant 8 in place of MAX_TEXTURES and leave out the define. What happens if you unroll the loop manually? This could help you isolate the source of the crash.

Share this post


Link to post
Share on other sites

How old is that ATI card?

If it's too old you'll run into two problems:

  • Radeon HD 2000-4000: OpenGL propietary drivers are no longer updated. They're known for being a bit buggy now.
  • Pre-Radeon HD 2000 (i.e. ATI Radeon X1000 series): These cards are so bad it drove us crazy back in the day. Unrolling your loop 8 times could be hitting the limit of 256 instruction slots these cards had.

Share this post


Link to post
Share on other sites
Are there any errors that occur but currently aren't detected in the lead up to thecrash in glDrawElements, such as during shader linking?

Share this post


Link to post
Share on other sites

You can try running the code below just after the suspecious OpenGL call was made for visualizing the error code.

void CheckGLError()
{
	GLenum code = glGetError();
	if (code != GL_NO_ERROR)
	{
		fprintf(stderr, "OpenGL error = %d\n", code );
		assert(false);
	}
}
Edited by Irlan Robson

Share this post


Link to post
Share on other sites

This could help you isolate the source of the crash.
I've played several days with this. Activating/deactivating of absolute different (not related) pieces of code produces misc effects like "fantastic" drawing or crash deeply in glDrawElements. Only if I avoid unroll all works as it should

 

Are there any errors that occur but currently aren't detected in the lead up to thecrash in glDrawElements, such as during shader linking?
No any errors/warnings given, glGetError also returns 0

 

Radeon HD 2000-4000: OpenGL propietary drivers are no longer updated. They're known for being a bit buggy now. Pre-Radeon HD 2000 (i.e. ATI Radeon X1000 series): These cards are so bad it drove us crazy back in the day. Unrolling your loop 8 times could be hitting the limit of 256 instruction slots these cards had.
   

ATI Radeon HD 2600 XT 256 MB
OpenGL Version: 2.1 ATI-7.32.12

Share this post


Link to post
Share on other sites

Wait, this is a Mac on OS X?
Yes

The OS X OpenGL drivers are generally bad. Bugs like these are common. Does the problem go away if MAX_TEXTURES has other values (try 1, 2, 4...)
Nope, crashes with any texture count, even with 1 (single) 

Share this post


Link to post
Share on other sites

Then it's quite certain this is a driver bug. Knowing Apple's track record of not caring for OpenGL, I doubt this will get fixed. You'll have to find a workaround.

BS like this is the reason I wrote my own parser so I could unroll loops myself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement