DRW: Fix crashes with instanced data

Problem introduced on 101c277e3d.
This commit is contained in:
Dalai Felinto
2018-06-04 19:17:26 +02:00
parent da53c3f020
commit 17e9870221
2 changed files with 2 additions and 1 deletions

View File

@@ -31,7 +31,7 @@
#include "GPU_batch.h"
#define MAX_INSTANCE_DATA_SIZE 48 /* Can be adjusted for more */
#define MAX_INSTANCE_DATA_SIZE 64 /* Can be adjusted for more */
typedef struct DRWInstanceData DRWInstanceData;
typedef struct DRWInstanceDataList DRWInstanceDataList;

View File

@@ -764,6 +764,7 @@ ObjectEngineData *DRW_object_engine_data_ensure(
const size_t t = sizeof(float) - 1;
size = (size + t) & ~t;
size_t fsize = size / sizeof(float);
BLI_assert(fsize < MAX_INSTANCE_DATA_SIZE);
if (DST.object_instance_data[fsize] == NULL) {
DST.object_instance_data[fsize] = DRW_instance_data_request(DST.idatalist, fsize);
}