Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_data.c
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | #define KEY(a) ((((size_t)((a).draw.batch)) >> 6) % ARRAY_SIZE(idx)) | ||||
| BLI_assert(array_len <= ARRAY_SIZE(idx)); | BLI_assert(array_len <= ARRAY_SIZE(idx)); | ||||
| for (int i = 0; i < array_len; i++) { | for (int i = 0; i < array_len; i++) { | ||||
| /* Early out if nothing to sort. */ | /* Early out if nothing to sort. */ | ||||
| if (++idx[KEY(array[i])] == array_len) { | if (++idx[KEY(array[i])] == array_len) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| /* Cumulate batch indices */ | /* Accumulate batch indices */ | ||||
| for (int i = 1; i < ARRAY_SIZE(idx); i++) { | for (int i = 1; i < ARRAY_SIZE(idx); i++) { | ||||
| idx[i] += idx[i - 1]; | idx[i] += idx[i - 1]; | ||||
| } | } | ||||
| /* Traverse in reverse to not change the order of the resource ID's. */ | /* Traverse in reverse to not change the order of the resource ID's. */ | ||||
| for (int src = array_len - 1; src >= 0; src--) { | for (int src = array_len - 1; src >= 0; src--) { | ||||
| array_tmp[--idx[KEY(array[src])]] = array[src]; | array_tmp[--idx[KEY(array[src])]] = array[src]; | ||||
| } | } | ||||
| #undef KEY | #undef KEY | ||||
| ▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void DRW_shgroup_vertex_buffer(DRWShadingGroup *shgroup, | void DRW_shgroup_vertex_buffer(DRWShadingGroup *shgroup, | ||||
| const char *name, | const char *name, | ||||
| GPUVertBuf *vertex_buffer) | GPUVertBuf *vertex_buffer) | ||||
| { | { | ||||
| int location = GPU_shader_get_ssbo(shgroup->shader, name); | int location = GPU_shader_get_ssbo(shgroup->shader, name); | ||||
| if (location == -1) { | if (location == -1) { | ||||
| BLI_assert(false && "Unable to locate binding of shader storage buffer objects."); | BLI_assert_msg(0, "Unable to locate binding of shader storage buffer objects."); | ||||
| return; | return; | ||||
| } | } | ||||
| drw_shgroup_uniform_create_ex( | drw_shgroup_uniform_create_ex( | ||||
| shgroup, location, DRW_UNIFORM_VERTEX_BUFFER_AS_STORAGE, vertex_buffer, 0, 0, 1); | shgroup, location, DRW_UNIFORM_VERTEX_BUFFER_AS_STORAGE, vertex_buffer, 0, 0, 1); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| ▲ Show 20 Lines • Show All 1,694 Lines • Show Last 20 Lines | |||||