[PATCH] [try 4] ddraw: Grow indexbuffer as needed

Stefan Dösinger stefandoesinger at gmx.at
Thu Jun 24 10:40:12 CDT 2010


> +        while(size < IndexCount * sizeof(WORD))
> +        {
> +            size <<= 1;

> +        }
Thinking about it, is there a reason for growing the buffer in power of two sizes, and not simply set it to the size required for the draw call? E.g. if the app passes index data with a size somewhere between 2^31 and 2^32-1(which still still fits in the UINT variable) the power of two growing will try to create a 2^32 byte buffer which overflows and fails. So you're cutting the possible index buffer size in half.

(Of course if an app actually tries to create a >2GB index buffer we have bigger problems than the UINT, especially in a 32 bit process)




More information about the wine-devel mailing list