diff options
author | Matias N. Goldberg <dark_sylinc@yahoo.com.ar> | 2023-09-03 19:59:03 -0300 |
---|---|---|
committer | Matias N. Goldberg <dark_sylinc@yahoo.com.ar> | 2023-09-03 19:59:10 -0300 |
commit | 53837adc0057c583450d331b58eec46dbc740d2e (patch) | |
tree | bcfcb667318ed018f5807cd61d79fb3445749296 /servers/rendering/renderer_rd/effects/debug_effects.cpp | |
parent | fa3428ff25bc577d2a3433090478a6d615567056 (diff) | |
download | redot-engine-53837adc0057c583450d331b58eec46dbc740d2e.tar.gz |
Use 16-bit index buffers instead of 32 when unnecessary
Diffstat (limited to 'servers/rendering/renderer_rd/effects/debug_effects.cpp')
-rw-r--r-- | servers/rendering/renderer_rd/effects/debug_effects.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/servers/rendering/renderer_rd/effects/debug_effects.cpp b/servers/rendering/renderer_rd/effects/debug_effects.cpp index 3d26a9a8df..357d035ae9 100644 --- a/servers/rendering/renderer_rd/effects/debug_effects.cpp +++ b/servers/rendering/renderer_rd/effects/debug_effects.cpp @@ -85,7 +85,7 @@ void DebugEffects::_create_frustum_arrays() { } if (frustum.index_buffer.is_null()) { - uint32_t indices[6 * 2 * 3] = { + uint16_t indices[6 * 2 * 3] = { // Far 0, 1, 2, // FLT, FLB, FRT 1, 3, 2, // FLB, FRB, FRT @@ -111,19 +111,19 @@ void DebugEffects::_create_frustum_arrays() { data.resize(6 * 2 * 3 * 4); { uint8_t *w = data.ptrw(); - int *p32 = (int *)w; + uint16_t *p16 = (uint16_t *)w; for (int i = 0; i < 6 * 2 * 3; i++) { - *p32 = indices[i]; - p32++; + *p16 = indices[i]; + p16++; } } - frustum.index_buffer = RD::get_singleton()->index_buffer_create(6 * 2 * 3, RenderingDevice::INDEX_BUFFER_FORMAT_UINT32, data); + frustum.index_buffer = RD::get_singleton()->index_buffer_create(6 * 2 * 3, RenderingDevice::INDEX_BUFFER_FORMAT_UINT16, data); frustum.index_array = RD::get_singleton()->index_array_create(frustum.index_buffer, 0, 6 * 2 * 3); } if (frustum.lines_buffer.is_null()) { - uint32_t indices[12 * 2] = { + uint16_t indices[12 * 2] = { 0, 1, // FLT - FLB 1, 3, // FLB - FRB 3, 2, // FRB - FRT @@ -145,14 +145,14 @@ void DebugEffects::_create_frustum_arrays() { data.resize(12 * 2 * 4); { uint8_t *w = data.ptrw(); - int *p32 = (int *)w; + uint16_t *p16 = (uint16_t *)w; for (int i = 0; i < 12 * 2; i++) { - *p32 = indices[i]; - p32++; + *p16 = indices[i]; + p16++; } } - frustum.lines_buffer = RD::get_singleton()->index_buffer_create(12 * 2, RenderingDevice::INDEX_BUFFER_FORMAT_UINT32, data); + frustum.lines_buffer = RD::get_singleton()->index_buffer_create(12 * 2, RenderingDevice::INDEX_BUFFER_FORMAT_UINT16, data); frustum.lines_array = RD::get_singleton()->index_array_create(frustum.lines_buffer, 0, 12 * 2); } } |