On 14 Nov 2014, at 09:45, Robert Osfield <robert.osfi...@gmail.com> wrote:

> I really don't have enough information from your stack trace to know what the 
> problem would be, but from a code review it looks like the i value 
> initialized to a value over the end of the sizedInternalFormats array.  I 
> don't know why Alexander didn't just iterate forwards form i=0; and use a for 
> loop.  
> 
> My inclination is to the change the i start value to 0 and use a for loop as 
> it'll make the code both more compact and readable.  If we are to stick with 
> the original code then it would seem like replacing the i initialization with:
> 
> size_t i = formatsCount-1 or move the --i to in front of the if statement.  
> Either way it's a bit kludgey.  I regret not reviewing the code a bit more 
> closely now and getting a better explanation of the motivation of each part.  

Well in fairness to Alexander, based on comments in the code, the cases of 
texture format / size are ordered by how likely they are to occur (a subjective 
/ guess-timate definition of course). This is to reduce trips around the loop I 
guess. If you make the loop run forwards instead of back,  you /ought/ to 
invert the order of the arrays, although I suspect in practice this is not a 
hot code path and there is no measurable difference in performance.

I realise my original report was a little lacking in info, I am working to get 
everything compiled with additional debug / logging so I can verify if the 
issue is out-of-bounds i value or something else.

Kind regards,
James

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to