mayingzhen / nvidia-texture-tools

Automatically exported from code.google.com/p/nvidia-texture-tools
Other
0 stars 0 forks source link

Not allocating enough memory in ColorSetCompressor::compress() function #151

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

I think this 4th line in the function should be changed from:

        uint8 * mem = malloc<uint8>(bs * bw);

to:

        uint8 * mem = malloc<uint8>(bs * bw * bh);

Original issue reported on code.google.com by pope...@gmail.com on 6 Dec 2010 at 6:43

GoogleCodeExporter commented 8 years ago
this line also needs to be changed from:
                outputOptions.outputHandler->writeData(mem, bs * bw);
to:
                outputOptions.outputHandler->writeData(mem, bs * bw * bh);

Original comment by pope...@gmail.com on 6 Dec 2010 at 6:50

GoogleCodeExporter commented 8 years ago
Thanks, several users had complained about that issue, but I have not had the 
time to look for the problem. This is now fixed in revision 1212.

Original comment by cast...@gmail.com on 6 Dec 2010 at 7:29

GoogleCodeExporter commented 8 years ago
stupid me! the real problem is uint8 * ptr = mem; was outside of y-for loop.

Ignore all my message above: instead just simply moving unit8* ptr = mem; right 
after for (uint y=0; y<h ; y+=4) solves all the problem :)

Original comment by pope...@gmail.com on 6 Dec 2010 at 7:40