﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,phab_field
6718,[macOS] [Vulkan] Render Debug Crash,Langbart,,"originally posted on [https://code.wildfiregames.com/D4905#209770 D4905] (26/Jan/23) (can be seen within the video)

----

==== to reproduce
- enable `Vulkan` as `renderbackend`
- start any map, for example `random/mainland`
- open `Developer Overlay - Alt+D`
- select any option from the dropdown `Render Debug Mode`
- crash
[[Image(ren_deb.png, 600px, center)]]


==== bisect
(not possible, `Vulkan` support came with [27488] on macOS)


==== lldb 
{{{#!sh
GAME STARTED, ALL INIT COMPLETE
ERROR: Program 'spirv/dummy' with required defines not found.
ERROR:   ""PASS_SHADOWS"": ""1""
ERROR:   ""RENDER_DEBUG_MODE"": ""RENDER_DEBUG_MODE_AO""
ERROR:   ""SHADOWS_CASCADE_COUNT"": ""1""
ERROR:   ""USE_SHADOW"": ""1""
ERROR:   ""USE_SHADOW_PCF"": ""1""
ERROR:   ""USE_SHADOW_SAMPLER"": ""1""
ERROR:   ""USE_FOG"": ""1""
ERROR: Failed to load shader 'spirv/dummy'
[mvk-info] Created 3 swapchain images with initial size (1024, 768) and contents scale 1.0 for screen Built-in Retina Display.
Assertion failed: ""0 <= pass && pass < static_cast<int>(m_Passes.size())""
Location: ShaderTechnique.cpp:59 (GetGraphicsPipelineState)

Call stack:

(error while dumping stack: Function not supported)
errno = 0 (No error reported here)
OS error = ?


(C)ontinue, (S)uppress, (B)reak, Launch (D)ebugger, or (E)xit?
e
Redirecting call to abort() to mozalloc_abort

pyrogenesis was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 85772 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010115c390 pyrogenesis`::mozalloc_abort(msg=<unavailable>) at mozalloc_abort.cpp:33:3 [opt]
   30  	#ifdef MOZ_WIDGET_ANDROID
   31  	  abortThroughJava(msg);
   32  	#endif
-> 33  	  MOZ_CRASH();
   34  	}
   35  	
   36  	#ifdef MOZ_WIDGET_ANDROID
Target 0: (pyrogenesis) stopped.
(lldb) bt
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000000010115c390 pyrogenesis`::mozalloc_abort(msg=<unavailable>) at mozalloc_abort.cpp:33:3 [opt]
    frame #1: 0x0000000101cd5a0d pyrogenesis`::abort() at mozalloc_abort.cpp:86:3 [opt]
    frame #2: 0x00000001005641d6 pyrogenesis`sys_display_error(text=<unavailable>, flags=6) at unix.cpp:268:4 [opt]
    frame #3: 0x0000000100546933 pyrogenesis`debug_DisplayError(wchar_t const*, unsigned long, void*, wchar_t const*, wchar_t const*, int, char const*, long volatile*) [inlined] CallDisplayError(text=L""Assertion failed: \""0 <= pass && pass < static_cast<int>(m_Passes.size())\""\r\nLocation: ShaderTechnique.cpp:59 (GetGraphicsPipelineState)\r\n\r\nCall stack:\r\n\r\n(error while dumping stack: Function not supported)\r\nerrno = 0 (No error reported here)\r\nOS error = ?\r\n"", flags=6) at debug.cpp:374:8 [opt]
    frame #4: 0x0000000100546916 pyrogenesis`debug_DisplayError(description=L""Assertion failed: \""0 <= pass && pass < static_cast<int>(m_Passes.size())\"""", flags=6, context=0x00007ffeefbfda40, lastFuncToSkip=<unavailable>, pathname=L""../../../source/graphics/ShaderTechnique.cpp"", line=59, func=<unavailable>, suppress=0x0000000103d00eb8) at debug.cpp:460 [opt]
    frame #5: 0x000000010054719e pyrogenesis`debug_OnAssertionFailure(expr=<unavailable>, suppress=0x0000000103d00eb8, file=<unavailable>, line=<unavailable>, func=<unavailable>) at debug.cpp:547:9 [opt]
    frame #6: 0x000000010034247d pyrogenesis`CShaderTechnique::GetGraphicsPipelineState(this=0x0000000127559ac0, pass=0) const at ShaderTechnique.cpp:59:2 [opt]
    frame #7: 0x00000001003d2dfc pyrogenesis`TerrainRenderer::RenderPatches(this=0x00000001052f54a0, deviceCommandContext=0x000000010840b720, cullGroup=<unavailable>, defines=0x00007ffeefbfe3f8, color=0x00007ffeefbfe410) at TerrainRenderer.cpp:380:14 [opt]
    frame #8: 0x00000001003bae45 pyrogenesis`CSceneRenderer::RenderShadowMap(this=0x000000011400a268, deviceCommandContext=0x000000010840b720, context=<unavailable>) at SceneRenderer.cpp:322:23 [opt]
    frame #9: 0x00000001003bd94a pyrogenesis`CSceneRenderer::PrepareSubmissions(this=0x000000011400a268, deviceCommandContext=0x000000010840b720, waterScissor=0x000000011400a524) at SceneRenderer.cpp:821:3 [opt]
    frame #10: 0x00000001003bebb2 pyrogenesis`CSceneRenderer::PrepareScene(this=0x000000011400a268, deviceCommandContext=0x000000010840b720, scene=0x000000010e5d68c0) at SceneRenderer.cpp:1135:2 [opt]
    frame #11: 0x00000001003b1ae9 pyrogenesis`CRenderer::RenderFrameImpl(this=0x000000010840a1a0, renderGUI=<unavailable>, renderLogger=<unavailable>) at Renderer.cpp:487:22 [opt]
    frame #12: 0x00000001003afdfd pyrogenesis`CRenderer::RenderFrame(this=0x000000010840a1a0, needsPresent=true) at Renderer.cpp:457:3 [opt]
    frame #13: 0x0000000100007351 pyrogenesis`RunGameOrAtlas(PS::span<char const* const>) [inlined] Frame() at main.cpp:444:13 [opt]
    frame #14: 0x0000000100006a90 pyrogenesis`RunGameOrAtlas(argv=<unavailable>) at main.cpp:687 [opt]
    frame #15: 0x0000000100005077 pyrogenesis`main(argc=5, argv=0x00007ffeefbfef18) at main.cpp:740:2 [opt]
    frame #16: 0x00007fff6e921cc9 libdyld.dylib`start + 1
    frame #17: 0x00007fff6e921cc9 libdyld.dylib`start + 1
}}}

==== additional infos
- tested with default settings (empty `user.cfg`) and this command from the terminal
{{{#!sh
pyrogenesis -mod=public -mod=0ad-spirv -conf=rendererbackend:vulkan -autostart=""random/mainland""
}}}
- `0ad-spirv` version
{{{#!json
{
	""name"": ""0ad-spirv"",
	""version"": ""0.27.12"",
	""label"": ""SPIR-V shaders"",
	""url"": ""https://play0ad.com"",
	""description"": ""SPIR-V shaders for Vulkan backend."",
	""dependencies"": [""0ad>=0.0.27""]
}
}}}
",defect,new,Should Have,Alpha 27,Core engine,,,,
