Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project on Android and in Web crash when using create_trimesh_shape on GLES2 #33197

Closed
qarmin opened this issue Oct 31, 2019 · 4 comments · Fixed by #34794
Closed

Project on Android and in Web crash when using create_trimesh_shape on GLES2 #33197

qarmin opened this issue Oct 31, 2019 · 4 comments · Fixed by #34794

Comments

@qarmin
Copy link
Contributor

qarmin commented Oct 31, 2019

Godot version:
3.2.alpha.custom_build. b8daad9
OS/device including version:
Bluboo Maya Android 6.0 MALI 400 GLES 2
Issue description:
From adb logcat

10-31 09:23:44.806 15156 15170 E godot   : **ERROR**: OpenGL ES 2.0 does not allow retrieving mesh array data
10-31 09:23:44.806 15156 15170 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:2607:mesh_surface_get_array() - OpenGL ES 2.0 does not allow retrieving mesh array data
10-31 09:23:44.807 15156 15170 E godot   : **ERROR**: Condition ' vertex_data.size() == 0 ' is true. returned: Array()
10-31 09:23:44.807 15156 15170 E godot   :    At: servers/visual_server.cpp:1596:mesh_surface_get_arrays() - Condition ' vertex_data.size() == 0 ' is true. returned: Array()
10-31 09:23:44.807 15156 15170 E godot   : **ERROR**: FATAL: Index p_index=0 out of size (((Vector<T> *)(this))->_cowdata.size()=0)
10-31 09:23:44.807 15156 15170 E godot   :    At: ./core/vector.h:49:operator[]() - FATAL: Index p_index=0 out of size (((Vector<T> *)(this))->_cowdata.size()=0)
10-31 09:23:44.808 15156 15170 F libc    : Fatal signal 4 (SIGILL), code 1, fault addr 0xa2a9191c in tid 15170 (GLThread 5833)
10-31 09:23:44.808 15156 15170 F libc    : Unable to open connection to debuggerd: Connection refused

Steps to reproduce:

  1. Export project with this code
extends Node2D
var q_CubeMesh : CubeMesh = CubeMesh.new()
func _process(delta):
	if randi() % 2 == 1:
		q_CubeMesh = CubeMesh.new()
	if randi() % 2 == 1:
		q_CubeMesh.create_trimesh_shape()

Reproduction project(BIG):
The-worst-Godot-test-project.zip

@akien-mga
Copy link
Member

Confirmed on Xiaomi Pocophone F1 when using GLES2.

Simpler reproduction code:

extends Node2D

func _ready():
	var cubemesh = CubeMesh.new()
	cubemesh.create_trimesh_shape()

@akien-mga akien-mga changed the title Project on Android crash when using create_trimesh_shape Project on Android crash when using create_trimesh_shape on GLES2 Oct 31, 2019
@lawnjelly
Copy link
Member

lawnjelly commented Oct 31, 2019

Could it be because it doesn't retain the vertex data on GLES2, trying to read it back? Similar to the skinning fix I did a while back #29751.

**ERROR**: OpenGL ES 2.0 does not allow retrieving mesh array data

Ref<Shape> Mesh::create_trimesh_shape() const {

	PoolVector<Face3> faces = get_faces();
	if (faces.size() == 0)
		return Ref<Shape>();

@qarmin
Copy link
Contributor Author

qarmin commented Dec 28, 2019

This also happens with project exported to Firefox 71

**ERROR**: FATAL: Index p_index=0 out of size (((Vector<T> *)(this))->_cowdata.size()=0) tmp_js_export.js:7:37921
   At: ./core/vector.h:49:operator[]() - FATAL: Index p_index=0 out of size (((Vector<T> *)(this))->_cowdata.size()=0) tmp_js_export.js:7:37921

exception thrown: RuntimeError: unreachable executed,Array::operator[](int)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[594]:0x2d180
Mesh::generate_triangle_mesh() const@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[18048]:0x2fce45
Mesh::get_faces() const@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[9141]:0x1b65e3
Mesh::create_trimesh_shape() const@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[18049]:0x2fcff7
MethodBind0RC<Ref<Shape> >::call(Object*, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[44482]:0xa4b773
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0a16
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56081]:0xba2890
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0986
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56081]:0xba2890
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0986
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56081]:0xba2890
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0986
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56081]:0xba2890
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0986
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56081]:0xba2890
Object::call(StringName const&, Variant const**, int, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[14986]:0x2d0986
Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[7820]:0x18051b
GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[2736]:0x8edbf
GDScriptInstance::call_multilevel(StringName const&, Variant const**, int)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[56080]:0xba2824
Node::_notification(int)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[15037]:0x2d328a
Node::_notificationv(int, bool)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[1412]:0x5ab86
CanvasItem::_notificationv(int, bool)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[6903]:0x154d4d
Node2D::_notificationv(int, bool)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[990]:0x422f7
Object::notification(int, bool)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[902]:0x3ff94
SceneTree::_notify_group_pause(StringName const&, int)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[6152]:0x13a4b3
SceneTree::iteration(float)@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[32999]:0x81ba82
Main::iteration()@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[53865]:0xb2603a
OS_JavaScript::main_loop_iterate()@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[37509]:0x9329d3
OS_JavaScript::main_loop_callback()@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[37510]:0x9329e9
dynCall_v@http://localhost:8060/tmp_js_export.js line 96 > WebAssembly.instantiate:wasm-function[24877]:0x62eb0a
RuntimeEnvironment/Module.dynCall_v@http://localhost:8060/tmp_js_export.js:7:321875
browserIterationFunc@http://localhost:8060/tmp_js_export.js:7:133495
runIter@http://localhost:8060/tmp_js_export.js:7:136560
Browser_mainLoop_runner@http://localhost:8060/tmp_js_export.js:7:135029

@qarmin qarmin changed the title Project on Android crash when using create_trimesh_shape on GLES2 Project on Android and in Web crash when using create_trimesh_shape on GLES2 Dec 28, 2019
@clayjohn
Copy link
Member

clayjohn commented Jan 3, 2020

Actually it crashes on all non-tools builds.

@lawnjelly you are right, surface->data needs to always be available. I'm overriding your PR and just making surface->data available always, as it was originally.

PR coming shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants