summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/storage/mesh_storage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/storage/mesh_storage.cpp')
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index ad4bdae272..381cf1a7c6 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -1075,6 +1075,7 @@ void MeshStorage::update_mesh_instances() {
}
glEnable(GL_RASTERIZER_DISCARD);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
// Process skeletons and blend shapes using transform feedback
while (dirty_mesh_instance_arrays.first()) {
MeshInstance *mi = dirty_mesh_instance_arrays.first()->self();
@@ -1284,13 +1285,17 @@ void MeshStorage::multimesh_allocate_data(RID p_multimesh, int p_instances, RS::
multimesh->data_cache_used_dirty_regions = 0;
}
+ // If we have either color or custom data, reserve space for both to make data handling logic simpler.
+ // This way we can always treat them both as a single, compressed uvec4.
+ int color_and_custom_strides = (p_use_colors || p_use_custom_data) ? 2 : 0;
+
multimesh->instances = p_instances;
multimesh->xform_format = p_transform_format;
multimesh->uses_colors = p_use_colors;
multimesh->color_offset_cache = p_transform_format == RS::MULTIMESH_TRANSFORM_2D ? 8 : 12;
multimesh->uses_custom_data = p_use_custom_data;
- multimesh->custom_data_offset_cache = multimesh->color_offset_cache + (p_use_colors ? 2 : 0);
- multimesh->stride_cache = multimesh->custom_data_offset_cache + (p_use_custom_data ? 2 : 0);
+ multimesh->custom_data_offset_cache = multimesh->color_offset_cache + color_and_custom_strides;
+ multimesh->stride_cache = multimesh->custom_data_offset_cache + color_and_custom_strides;
multimesh->buffer_set = false;
multimesh->data_cache = Vector<float>();