Browse Source

Merge pull request #29751 from lawnjelly/skin-fix

Fixes crash with rigged meshes on some OpenGLES2 devices
Rémi Verschelde 6 years ago
parent
commit
0cdbf7315b
1 changed files with 12 additions and 0 deletions
  1. 12 0
      drivers/gles2/rasterizer_storage_gles2.cpp

+ 12 - 0
drivers/gles2/rasterizer_storage_gles2.cpp

@@ -2427,6 +2427,18 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
 	}
 	surface->data = array;
 	surface->index_data = p_index_array;
+#else
+	// Even on non-tools builds, a copy of the surface->data is needed in certain circumstances.
+	// Rigged meshes using the USE_SKELETON_SOFTWARE path need to read bone data
+	// from surface->data.
+
+	// if USE_SKELETON_SOFTWARE is active
+	if (!config.float_texture_supported) {
+		// if this geometry is used specifically for skinning
+		if (p_format & (VS::ARRAY_FORMAT_BONES | VS::ARRAY_FORMAT_WEIGHTS))
+			surface->data = array;
+	}
+	// An alternative is to always make a copy of surface->data.
 #endif
 
 	surface->total_data_size += surface->array_byte_size + surface->index_array_byte_size;