From 747250a4e4d2a1dd9109b30b3fcfad05d526b408 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 12 Mar 2026 20:52:15 +0100 Subject: fix(assets): regenerate assets when DEMO_STRIP_ALL toggles Write asset_packer_mode.flag at configure time so that switching between disk-load (debug) and embedded (STRIP_ALL) modes invalidates assets_data.cc. Previously a stale embedded assets_data.cc caused fopen() on WGSL bytes, silently failing all shader snippet registration (vs_main not found crash). Co-Authored-By: Claude Sonnet 4.6 --- cmake/DemoCodegen.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cmake/DemoCodegen.cmake') diff --git a/cmake/DemoCodegen.cmake b/cmake/DemoCodegen.cmake index aaf54a3..a353fc7 100644 --- a/cmake/DemoCodegen.cmake +++ b/cmake/DemoCodegen.cmake @@ -244,6 +244,14 @@ if(NOT DEMO_STRIP_ALL) set(ASSET_PACKER_FLAGS "--disk_load") endif() +# Write a flag file so that toggling DEMO_STRIP_ALL triggers asset regeneration. +set(ASSET_MODE_FLAG_FILE "${CMAKE_CURRENT_BINARY_DIR}/asset_packer_mode.flag") +if(DEMO_STRIP_ALL) + file(WRITE "${ASSET_MODE_FLAG_FILE}" "strip_all\n") +else() + file(WRITE "${ASSET_MODE_FLAG_FILE}" "disk_load\n") +endif() + set(GEN_DEMO_H_STAMP ${GEN_DEMO_H}.gen_stamp) add_custom_command( OUTPUT ${GEN_DEMO_H_STAMP} ${GEN_DEMO_CC} @@ -252,6 +260,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GEN_DEMO_H}.new ${GEN_DEMO_H} COMMAND ${CMAKE_COMMAND} -E touch ${GEN_DEMO_H_STAMP} DEPENDS ${ASSET_PACKER_DEPENDS} ${WORKSPACE_ASSETS} + ${ASSET_MODE_FLAG_FILE} ${GEN_DEMO_H}.shaders_stamp ${GEN_DEMO_H}.audio_stamp ${GEN_DEMO_H}.models_stamp -- cgit v1.2.3