Fix invalid sizes when clearing gpu::Batch

For Batch::verts some values weren't cleared,
for Batch::inst values after the array would be cleared,
although as these were already zeroed this probably didn't cause
problems in practice.
This commit is contained in:
Campbell Barton 2024-03-28 13:45:22 +11:00
parent 115f8b0c59
commit b0328f67a9
1 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "GPU_batch.hh"
#include "GPU_batch_presets.hh"
@ -36,8 +37,8 @@ using namespace blender::gpu;
void GPU_batch_zero(Batch *batch)
{
std::fill_n(batch->verts, sizeof(GPU_BATCH_VBO_MAX_LEN), nullptr);
std::fill_n(batch->inst, sizeof(GPU_BATCH_INST_VBO_MAX_LEN), nullptr);
std::fill_n(batch->verts, ARRAY_SIZE(batch->verts), nullptr);
std::fill_n(batch->inst, ARRAY_SIZE(batch->inst), nullptr);
batch->elem = nullptr;
batch->resource_id_buf = nullptr;
batch->flag = eGPUBatchFlag(0);