travisvroman / kohi

A game engine made as part of the Kohi Game Engine series on YouTube (and Twitch!), where we make a game engine from the ground up using C and Vulkan.
https://kohiengine.com
Apache License 2.0
1.02k stars 97 forks source link

[BUG] Segfault while moving the camera around in testbed in full screen #194

Closed ghost closed 11 months ago

ghost commented 11 months ago

Describe the bug Segfault while moving the camera around in testbed in full screen.

Desktop (please complete the following information):

Additional context What follows is the full terminal output after ./testbed

[TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [TRACE]: Warning: kallocate_aligned called before the memory system is initialized. [DEBUG]: Memory system successfully allocated 2147483648 bytes. [INFO]: Input subsystem initialized. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [TRACE]: Loader registered. [INFO]: Resource system initialized with base path '../assets'. [INFO]: Vulkan Instance created. [DEBUG]: Creating Vulkan surface... [DEBUG]: Vulkan surface created. MESA-INTEL: warning: Haswell Vulkan support is incomplete [INFO]: Evaluating device: 'NVIDIA GeForce GTX 1080', index 0. [INFO]: Graphics | Present | Compute | Transfer | Name [INFO]: 1 | 1 | 1 | 1 | NVIDIA GeForce GTX 1080 [INFO]: Device meets queue requirements. [TRACE]: Graphics Family Index: 0 [TRACE]: Present Family Index: 0 [TRACE]: Transfer Family Index: 3 [TRACE]: Compute Family Index: 2 [INFO]: Selected device: 'NVIDIA GeForce GTX 1080'. [INFO]: GPU type is Descrete. [INFO]: GPU Driver version: 535.113.01 [INFO]: Vulkan API version: 1.3.3 [INFO]: Local GPU memory: 8.00 GiB [INFO]: Shared System memory: 11.57 GiB [INFO]: Local GPU memory: 0.24 GiB [INFO]: Physical device selected. [INFO]: Creating logical device... [INFO]: Logical device created. [INFO]: Vulkan device doesn't support native dynamic topology, but does via extension. Using extension. [INFO]: Vulkan device doesn't support native dynamic front-face, but does via extension. Using extension. [INFO]: Queues obtained. [INFO]: Graphics command pool created. [INFO]: Swapchain created successfully. [DEBUG]: Vulkan command buffers created. [INFO]: Vulkan renderer initialized successfully. [INFO]: 8 processor cores detected, 8 cores available. [TRACE]: Available threads: 7 [DEBUG]: Main thread id is: 0x8a62cb80 [DEBUG]: Spawning 7 job threads. [DEBUG]: Starting process on thread id: 0xc0bdb640 [DEBUG]: Starting process on thread id: 0xc03da640 [TRACE]: Starting job thread #0 (id=0xc0bdb640, type=0xe). [DEBUG]: Starting process on thread id: 0xbfbd9640 [TRACE]: Starting job thread #1 (id=0xc03da640, type=0x2). [DEBUG]: Starting process on thread id: 0xb73d8640 [TRACE]: Starting job thread #2 (id=0xbfbd9640, type=0x2). [TRACE]: Starting job thread #3 (id=0xb73d8640, type=0x2). [DEBUG]: Starting process on thread id: 0xbf3d8640 [DEBUG]: Starting process on thread id: 0xbebd7640 [TRACE]: Starting job thread #4 (id=0xbf3d8640, type=0x2). [DEBUG]: Starting process on thread id: 0xbe3d6640 [TRACE]: Starting job thread #5 (id=0xbebd7640, type=0x2). [INFO]: Booting testbed... [TRACE]: Starting job thread #6 (id=0xbe3d6640, type=0x2). [DEBUG]: Compiling shader 'shaders/Builtin.SkyboxShader.vert.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Compiling shader 'shaders/Builtin.SkyboxShader.frag.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Graphics pipeline created! [WARN]: Freelists are very inefficient with amounts of memory less than 448B; it is recommended to not use this structure in this case. [DEBUG]: Compiling shader 'shaders/Builtin.MaterialShader.vert.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Compiling shader 'shaders/Builtin.MaterialShader.frag.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Graphics pipeline created! [DEBUG]: Compiling shader 'shaders/Builtin.TerrainShader.vert.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Compiling shader 'shaders/Builtin.TerrainShader.frag.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Graphics pipeline created! [DEBUG]: Compiling shader 'shaders/Builtin.Colour3DShader.vert.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Compiling shader 'shaders/Builtin.Colour3DShader.frag.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Graphics pipeline created! [DEBUG]: Graphics pipeline created! [WARN]: Freelists are very inefficient with amounts of memory less than 448B; it is recommended to not use this structure in this case. [DEBUG]: Compiling shader 'shaders/Builtin.UIShader.vert.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Compiling shader 'shaders/Builtin.UIShader.frag.glsl'... [DEBUG]: Shader compiled successfully. [DEBUG]: Graphics pipeline created! [TRACE]: Job queued. [INFO]: Kohi Engine v. 0.1.2317.79903 [DEBUG]: game_initialize() called! [TRACE]: Loader registered. [TRACE]: Job queued. [TRACE]: Creating new camera named 'world'... [TRACE]: Creating new camera named 'world_2'... [INFO]: System memory use (tagged): UNKNOWN : 0.00B ARRAY : 87.93KiB LINEAR_ALLC: 128.00MiB DARRAY : 26.48KiB DICT : 0.00B RING_QUEUE : 192.00KiB BST : 0.00B STRING : 2.63KiB ENGINE : 20.46KiB JOB : 2.38KiB TEXTURE : 17179869184.00GiB MAT_INST : 224.00B RENDERER : 156.25MiB GAME : 13.70KiB TRANSFORM : 0.00B ENTITY : 0.00B ENTITY_NODE: 0.00B SCENE : 0.00B RESOURCE : 19.06MiB VULKAN : 244.59MiB VULKAN_EXT : 0.00B DIRECT3D : 0.00B OPENGL : 0.00B GPU_LOCAL : 1.05GiB BITMAP_FONT: 0.00B SYSTEM_FONT: 176.00B KEYMAP : 1.09KiB HASHTABLE : 10.00KiB Total memory usage: 304.12MiB of 2.00GiB (0.15%)

[DEBUG]: Window resize: 1280, 720 [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 1 [TRACE]: Successfully loaded texture 'UbuntuMono21px_0'. [TRACE]: Successfully loaded texture 'kohi'. [INFO]: Vulkan renderer plugin->resized: w/h/gen: 1280/720/1 [INFO]: Swapchain created successfully. [DEBUG]: Vulkan command buffers created. [INFO]: Resized, booting. [INFO]: Vulkan renderer plugin->resized: w/h/gen: 1280/720/2 [INFO]: Swapchain created successfully. [DEBUG]: Vulkan command buffers created. [INFO]: Resized, booting. [DEBUG]: Loading main scene... [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [WARN]: texture_system_acquire called for default texture. Use texture_system_get_default_specular_texture for texture 'default_SPEC'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 1 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Assigning job to thread: 5 [TRACE]: Assigning job to thread: 6 [TRACE]: Assigning job to thread: 1 [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Successfully loaded mesh 'falcon'. [TRACE]: Assigning job to thread: 6 [TRACE]: Successfully loaded texture 'wavy-sand_SPEC'. [TRACE]: Assigning job to thread: 0 [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Job queued. [TRACE]: Successfully loaded mesh 'sponza'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'river_rock1_SPEC'. [TRACE]: Assigning job to thread: 5 [TRACE]: Successfully loaded texture 'wavy-sand'. [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'river_rock1'. [TRACE]: Successfully loaded texture 'wavy-sand_NRM'. [TRACE]: Assigning job to thread: 1 [TRACE]: Assigning job to thread: 5 [TRACE]: Successfully loaded texture 'Crusted_snow2_SPEC'. [TRACE]: Assigning job to thread: 6 [TRACE]: Successfully loaded texture 'grass1'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'river_rock1_NRM'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_column_b_diff'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_column_b_spec'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_column_b_ddn'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'Crusted_snow2'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_curtain_diff'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'sponza_curtain_spec'. [TRACE]: Successfully loaded texture 'grass1_NRM'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_curtain_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Successfully loaded texture 'sponza_flagpole_diff'. [TRACE]: Successfully loaded texture 'sponza_flagpole_spec'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_flagpole_ddn'. [TRACE]: Successfully loaded texture 'sponza_curtain_blue_diff'. [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'Crusted_snow2_NRM'. [TRACE]: Assigning job to thread: 0 [TRACE]: Successfully loaded texture 'sponza_column_c_diff'. [TRACE]: Successfully loaded texture 'sponza_column_c_spec'. [TRACE]: Assigning job to thread: 4 [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'sponza_column_c_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Successfully loaded texture 'sponza_floor_a_diff'. [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_floor_a_spec'. [TRACE]: Successfully loaded texture 'sponza_floor_a_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'spnza_bricks_a_diff'. [TRACE]: Successfully loaded texture 'spnza_bricks_a_spec'. [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'spnza_bricks_a_ddn'. [TRACE]: Successfully loaded texture 'sponza_curtain_green_diff'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_column_a_spec'. [TRACE]: Successfully loaded texture 'sponza_column_a_diff'. [TRACE]: Successfully loaded texture 'sponza_details_diff'. [TRACE]: Successfully loaded texture 'sponza_column_a_ddn'. [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_details_spec'. [TRACE]: Successfully loaded texture 'vase_hanging'. [TRACE]: Successfully loaded texture 'sponza_details_ddn'. [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'chain_texture'. [TRACE]: Successfully loaded texture 'vase_hanging_ddn'. [TRACE]: Successfully loaded texture 'chain_texture_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 0 [TRACE]: Successfully loaded texture 'sponza_arch_diff'. [TRACE]: Successfully loaded texture 'chain_texture_spec'. [TRACE]: Successfully loaded texture 'vase_hanging_spec'. [TRACE]: Successfully loaded texture 'sponza_arch_spec'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_arch_ddn'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'sponza_ceiling_a_ddn'. [TRACE]: Successfully loaded texture 'sponza_fabric_green_diff'. [TRACE]: Successfully loaded texture 'sponza_ceiling_a_spec'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_ceiling_a_diff'. [TRACE]: Successfully loaded texture 'sponza_fabric_spec'. [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_thorn_diff'. [TRACE]: Successfully loaded texture 'sponza_thorn_spec'. [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'sponza_thorn_ddn'. [TRACE]: Successfully loaded texture 'sponza_fabric_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'sponza_fabric_blue_diff'. [TRACE]: Successfully loaded texture 'vase_round_spec'. [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 3 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'vase_round'. [TRACE]: Successfully loaded texture 'vase_plant'. [TRACE]: Assigning job to thread: 0 [TRACE]: Successfully loaded texture 'vase_round_ddn'. [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'background'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'vase_plant_ddn'. [TRACE]: Successfully loaded texture 'vase_plant_spec'. [TRACE]: Successfully loaded texture 'background_ddn'. [TRACE]: Successfully loaded texture 'background_spec'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'sponza_fabric_diff'. [TRACE]: Successfully loaded texture 'lion_spec'. [TRACE]: Successfully loaded texture 'lion_ddn'. [TRACE]: Assigning job to thread: 0 [TRACE]: Assigning job to thread: 2 [TRACE]: Assigning job to thread: 4 [TRACE]: Successfully loaded texture 'lion'. [TRACE]: Assigning job to thread: 3 [TRACE]: Successfully loaded texture 'vase_dif'. [TRACE]: Successfully loaded texture 'sponza_roof_diff'. [TRACE]: Assigning job to thread: 2 [TRACE]: Successfully loaded texture 'vase_ddn'. [TRACE]: Successfully loaded texture 'sponza_roof_ddn'. [TRACE]: Successfully loaded texture 'vase_spec'. [TRACE]: Successfully loaded texture 'sponza_roof_spec'. [TRACE]: Successfully loaded texture 'falc_wreck_low_DefaultMaterial_AlbedoTransparency'. [TRACE]: Successfully loaded texture 'falc_wreck_low_DefaultMaterial_Normal'. [TRACE]: Successfully loaded texture 'falc_wreck_low_DefaultMaterial_MetallicSmoothness'. [INFO]: Swapchain created successfully. [DEBUG]: Swapchain recreated because swapchain returned out of date or suboptimal. [DEBUG]: Window resize: 2560, 1368 [INFO]: Vulkan renderer plugin->resized: w/h/gen: 2560/1368/3 [INFO]: Swapchain created successfully. [DEBUG]: Vulkan command buffers created. [INFO]: Resized, booting. Segmentation fault (core dumped)

ghost commented 11 months ago

Was able to quickly reproduce the bug on a second attempt. I full-screened the app and moved the camera around, and encountered a segfault. Let me know if I can provide any additional information.

travisvroman commented 11 months ago

Thanks for reporting this! I can see this is happening here as well.