Temp fix for vertex format with batch instancing

This prevents memory alignment from being screwed up when attributes are
optimized out in shader.
This commit is contained in:
Luca Rood 2017-05-23 18:11:50 +02:00
parent 9bc88b69d8
commit e1c4908771
1 changed files with 4 additions and 0 deletions

View File

@ -642,6 +642,9 @@ static void DRW_interface_attrib(DRWShadingGroup *shgroup, const char *name, DRW
attrib->type = type;
attrib->size = size;
/* Adding attribute even if not found for now (to keep memory alignment).
* Should ideally take vertex format automatically from batch eventually */
#if 0
if (attrib->location == -1 && !dummy) {
if (G.debug & G_DEBUG)
fprintf(stderr, "Attribute '%s' not found!\n", name);
@ -649,6 +652,7 @@ static void DRW_interface_attrib(DRWShadingGroup *shgroup, const char *name, DRW
MEM_freeN(attrib);
return;
}
#endif
BLI_assert(BLI_strnlen(name, 32) < 32);
BLI_strncpy(attrib->name, name, 32);