PDA

View Full Version : CL_PixelCommandSprite::render_sprite_scale bug



cdoty
11-30-2012, 07:47 PM
Incorrect bug fix.

sphair
12-01-2012, 10:32 AM
Sorry, what?

cdoty
12-01-2012, 06:25 PM
Sorry, what?

I had initially posted a bug fix, but then realized there were issues with the bug fix. The bug is that sometimes the values in box can create an access past the end of a texture. With a scale value of 25% and a width and height of 192 and 160, (CL_Rect) box was getting set with a width of 48 and a height of 41.

Here's the final fix I came up with for render_sprite_scale bug:

In CL_PixelCommandSprite::render_sprite_scale, insert the following code snippet before the first for loop:


while (dy * context->samplers[sampler].size.height * height >= context->samplers[sampler].size.height)
{
height--;
}

and replace the for loop with:


for (int y = box.top + skip_lines; y < box.top + height; y+=context->num_cores)


The same thing might need to be done for the width, and the code would need to be placed in the other scale functions.