Jump to content

  • Log In with Google      Sign In   
  • Create Account


Nested loop in GLSL causes driver crash.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Aethanol   Members   -  Reputation: 108

Like
0Likes
Like

Posted 08 June 2012 - 03:04 PM

Hello,

I'm trying to write an image fusion program in OpenGL/GLSL. At one point I need to calculate a cumulated histogram for a 7x7 pixel area. In fragment shader I'm trying to use a function:

float graythresh(float aArea[49])
{
float hist[256];
for(int i = 0; i < 49; i++)
  hist[(int)(aArea[i]*255)]+= 1.0;

for(int i = 0; i < 256; i++)
  hist[i] /= 49.0;

for(int i = 255; i >= 0; i--)
  for(int j = 255; j >= 0; j--)
	if(j > i)
	  hist[i] += hist[j];

return 0.0;
}

The last loop causes application crash and error "driver stopped responding". I tried using older drivers, and testing the application on different computer, nothing changed.

for(int i = 255; i >= 0; i--)
  for(int j = i-1; j >= 0; j--)
	hist[i] += hist[j];
Gave same error. Is it even possible to this?

Thanks in Advance, any help will be appreciated.

(I'm using GeForce GT 420M, windows 7)

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS