Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_data.c
| Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | static void drw_shgroup_uniform(DRWShadingGroup *shgroup, | ||||
| /* If location is -2, the uniform has not yet been queried. | /* If location is -2, the uniform has not yet been queried. | ||||
| * We save the name for query just before drawing. */ | * We save the name for query just before drawing. */ | ||||
| if (location == -2 || DRW_DEBUG_USE_UNIFORM_NAME) { | if (location == -2 || DRW_DEBUG_USE_UNIFORM_NAME) { | ||||
| int ofs = DST.uniform_names.buffer_ofs; | int ofs = DST.uniform_names.buffer_ofs; | ||||
| int max_len = DST.uniform_names.buffer_len - ofs; | int max_len = DST.uniform_names.buffer_len - ofs; | ||||
| size_t len = strlen(name) + 1; | size_t len = strlen(name) + 1; | ||||
| if (len >= max_len) { | if (len >= max_len) { | ||||
| DST.uniform_names.buffer_len += DRW_UNIFORM_BUFFER_NAME_INC; | DST.uniform_names.buffer_len += MAX2(DST.uniform_names.buffer_len, len); | ||||
brecht: I think we have to ensure that it increases the buffer size by at least `len`? | |||||
Done Inline ActionsNot sure if there are other limitations that make uniform names always small than 64. However, I agree. Will update the patch. JacquesLucke: Not sure if there are other limitations that make uniform names always small than `64`. However… | |||||
| DST.uniform_names.buffer = MEM_reallocN(DST.uniform_names.buffer, | DST.uniform_names.buffer = MEM_reallocN(DST.uniform_names.buffer, | ||||
| DST.uniform_names.buffer_len); | DST.uniform_names.buffer_len); | ||||
| } | } | ||||
| char *dst = DST.uniform_names.buffer + ofs; | char *dst = DST.uniform_names.buffer + ofs; | ||||
| memcpy(dst, name, len); /* Copies NULL terminator. */ | memcpy(dst, name, len); /* Copies NULL terminator. */ | ||||
| DST.uniform_names.buffer_ofs += len; | DST.uniform_names.buffer_ofs += len; | ||||
| ▲ Show 20 Lines • Show All 1,050 Lines • Show Last 20 Lines | |||||
I think we have to ensure that it increases the buffer size by at least len?