mirror of https://github.com/godotengine/godot
Handle overflow properly
The code would misbehave if frames_drawn overflows. Realistically this should not happen since UINT64_MAX is a lot of frames, Godot could probably render until the end of the universe before it triggers. However any future intentional tampering with frames_drawn could trigger this.
This commit is contained in:
parent
e567f49cbb
commit
70eb2fd995
|
|
@ -357,7 +357,7 @@ Error RenderingDevice::_staging_buffer_allocate(StagingBuffers &p_staging_buffer
|
|||
}
|
||||
}
|
||||
|
||||
} else if (p_staging_buffers.blocks[p_staging_buffers.current].frame_used <= frames_drawn - frames.size()) {
|
||||
} else if (frames_drawn - p_staging_buffers.blocks[p_staging_buffers.current].frame_used >= frames.size()) {
|
||||
// This is an old block, which was already processed, let's reuse.
|
||||
p_staging_buffers.blocks.write[p_staging_buffers.current].frame_used = frames_drawn;
|
||||
p_staging_buffers.blocks.write[p_staging_buffers.current].fill_amount = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue