Crash on CowData
Godot version: Godot build accc51f3012e0010eba2c56b8ed48c11a0fee3a7 GDProcMesh build 39d39ab74ea4ee06150970e26e004f408e99652b
OS/device including version: Windows 10, GTX 1060
Issue description: I don't know if this is specific to my ProcMesh GDNative module or an issue in Godot itself but it's a weird one.
ProcMesh basically uses ArrayMesh to generate meshes. Meshes I've already generated previously work fine, I can alter them, regenerate them, etc. and it all goes well.
But starting with an empty ArrayMesh, setting ProcMesh as the script and then generating a simple box (or anything really) crashes Godot with the following:
OpenGL ES 3.0 Renderer: GeForce GTX 1060/PCIe/SSE2
ERROR: CowData<class RID>::get: FATAL: Index p_index=0 out of size (size()=0)
At: C:\Users\basti\Development\godot3-git\core/cowdata.h:149
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] CowData<RID>::get (c:\users\basti\development\godot3-git\core\cowdata.h:149)
[1] Vector<RID>::operator[] (c:\users\basti\development\godot3-git\core\vector.h:85)
[2] RasterizerSceneGLES3::_fill_render_list (c:\users\basti\development\godot3-git\drivers\gles3\rasterizer_scene_gles3.cpp:3170)
[3] RasterizerSceneGLES3::render_scene (c:\users\basti\development\godot3-git\drivers\gles3\rasterizer_scene_gles3.cpp:4147)
[4] VisualServerScene::_render_scene (c:\users\basti\development\godot3-git\servers\visual\visual_server_scene.cpp:2145)
[5] VisualServerScene::render_camera (c:\users\basti\development\godot3-git\servers\visual\visual_server_scene.cpp:1714)
[6] VisualServerViewport::_draw_viewport (c:\users\basti\development\godot3-git\servers\visual\visual_server_viewport.cpp:70)
[7] VisualServerViewport::draw_viewports (c:\users\basti\development\godot3-git\servers\visual\visual_server_viewport.cpp:308)
[8] VisualServerRaster::draw (c:\users\basti\development\godot3-git\servers\visual\visual_server_raster.cpp:107)
[9] VisualServerWrapMT::draw (c:\users\basti\development\godot3-git\servers\visual\visual_server_wrap_mt.cpp:104)
[10] Main::iteration (c:\users\basti\development\godot3-git\main\main.cpp:1874)
[11] OS_Windows::run (c:\users\basti\development\godot3-git\platform\windows\os_windows.cpp:2754)
[12] widechar_main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:150)
[13] _main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:172)
[14] main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:184)
[15] __scrt_common_main_seh (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283)
[16] BaseThreadInitThunk
-- END OF BACKTRACE --
Procmesh uses Pools extensively so I'm wondering if the recent changes to how COW is handled has something to do with it. Specifically if some of the pools in the surface array are empty/nil ?
Steps to reproduce: Easiest way is to clone my current procmesh master: https://github.com/BastiaanOlij/gdprocmesh It has a compiled 64bit binary and a demo project. Just use the test.tscn then:
- select the meshinstance
- select the associated mesh
- click on the edit procmesh graph button and hook up the output of the "box" node to the input of the "output" node
Minimal reproduction project: https://github.com/BastiaanOlij/gdprocmesh