summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-22 21:37:17 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-22 21:37:17 +0100
commit834c7ff2c0a78acf957965e604e91617a10fb368 (patch)
tree6b2fb90a52c3193bcf9aa18c38f5167c98e1ec3f /servers
parentad20007970767106c7812391ae2d8cc3eac9f736 (diff)
parent454116716e7934f6bd80d7040a2c06a7c18d4c64 (diff)
Merge pull request #68997 from ueshita/fix_verts_65536
Fix some switching decisions for index format. (vertex length 65536)
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering_server.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 6cb1684baf..9551b983fc 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -625,7 +625,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
const int *src = indices.ptr();
for (int i = 0; i < p_index_array_len; i++) {
- if (p_vertex_array_len < (1 << 16) && p_vertex_array_len > 0) {
+ if (p_vertex_array_len <= (1 << 16) && p_vertex_array_len > 0) {
uint16_t v = src[i];
memcpy(&iw[i * 2], &v, 2);
@@ -835,10 +835,10 @@ void RenderingServer::mesh_surface_make_offsets_from_format(uint32_t p_format, i
break;
}
/* determine whether using 16 or 32 bits indices */
- if (p_vertex_len >= (1 << 16) || p_vertex_len == 0) {
- elem_size = 4;
- } else {
+ if (p_vertex_len <= (1 << 16) && p_vertex_len > 0) {
elem_size = 2;
+ } else {
+ elem_size = 4;
}
r_offsets[i] = elem_size;
continue;
@@ -1280,7 +1280,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector<int> arr;
arr.resize(p_index_len);
- if (p_vertex_len < (1 << 16)) {
+ if (p_vertex_len <= (1 << 16)) {
int *w = arr.ptrw();
for (int j = 0; j < p_index_len; j++) {