mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-16 09:21:51 +00:00
- fixed: overflow checks for dynamic light buffer were not correct.
This commit is contained in:
parent
066e53ae4c
commit
36b35e85f3
1 changed files with 8 additions and 1 deletions
|
@ -132,7 +132,7 @@ int FLightBuffer::UploadLights(FDynLightData &data)
|
||||||
|
|
||||||
if (totalsize <= 1) return -1;
|
if (totalsize <= 1) return -1;
|
||||||
|
|
||||||
if (mIndex + totalsize > mBufferSize)
|
if (mIndex + totalsize > mBufferSize/4)
|
||||||
{
|
{
|
||||||
// reallocate the buffer with twice the size
|
// reallocate the buffer with twice the size
|
||||||
unsigned int newbuffer;
|
unsigned int newbuffer;
|
||||||
|
@ -173,6 +173,13 @@ int FLightBuffer::UploadLights(FDynLightData &data)
|
||||||
if (mBufferPointer == NULL) return -1;
|
if (mBufferPointer == NULL) return -1;
|
||||||
copyptr = mBufferPointer + mIndex * 4;
|
copyptr = mBufferPointer + mIndex * 4;
|
||||||
|
|
||||||
|
static unsigned int lastindex = 0;
|
||||||
|
if (mIndex > lastindex)
|
||||||
|
{
|
||||||
|
Printf("Light index: %d, size: %d\n", mIndex, totalsize);
|
||||||
|
lastindex = mIndex;
|
||||||
|
}
|
||||||
|
|
||||||
float parmcnt[] = { 0, float(size0), float(size0 + size1), float(size0 + size1 + size2) };
|
float parmcnt[] = { 0, float(size0), float(size0 + size1), float(size0 + size1 + size2) };
|
||||||
|
|
||||||
memcpy(©ptr[0], parmcnt, 4 * sizeof(float));
|
memcpy(©ptr[0], parmcnt, 4 * sizeof(float));
|
||||||
|
|
Loading…
Reference in a new issue