From 0ab676275741babe6768e19b7569eea1d36651f0 Mon Sep 17 00:00:00 2001 From: Andrew Feng Date: Thu, 19 Sep 2024 01:02:52 -0400 Subject: [PATCH 1/3] remove profile extension incompatible with those listed under examples/runtime/shaders; fix incorrect parameter names; enforce consistent syntax when appending to CLI. --- cmake/bgfxToolUtils.cmake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmake/bgfxToolUtils.cmake b/cmake/bgfxToolUtils.cmake index 85942852..757ab378 100644 --- a/cmake/bgfxToolUtils.cmake +++ b/cmake/bgfxToolUtils.cmake @@ -215,7 +215,7 @@ if(TARGET bgfx::texturec) add_custom_command( OUTPUT ${ARG_OUTPUT} # COMMAND bgfx::texturec ${CLI} # - MAIN_DEPENDENCY ${ARG_INPUT} # + MAIN_DEPENDENCY ${ARG_FILE} # ) endfunction() endif() @@ -279,12 +279,12 @@ if(TARGET bgfx::geometryc) # --packnormal if(ARG_PACKNORMAL) - list(APPEND CLI "--packnormal ${ARG_PACKNORMAL}") + list(APPEND CLI "--packnormal" "${ARG_PACKNORMAL}") endif() # --packuv if(ARG_PACKUV) - list(APPEND CLI "--packuv" ${ARG_PACKUV}) + list(APPEND CLI "--packuv" "${ARG_PACKUV}") endif() # --tangent @@ -352,7 +352,7 @@ if(TARGET bgfx::geometryc) add_custom_command( OUTPUT ${ARG_OUTPUT} # COMMAND bgfx::geometryc ${CLI} # - MAIN_DEPENDENCY ${ARG_INPUT} # + MAIN_DEPENDENCY ${ARG_FILE} # ) endfunction() endif() @@ -542,8 +542,6 @@ if(TARGET bgfx::shaderc) function(_bgfx_get_profile_ext PROFILE PROFILE_EXT) string(REPLACE 300_es essl PROFILE ${PROFILE}) string(REPLACE 120 glsl PROFILE ${PROFILE}) - string(REPLACE spirv spv PROFILE ${PROFILE}) - string(REPLACE metal mtl PROFILE ${PROFILE}) string(REPLACE s_3_0 dx9 PROFILE ${PROFILE}) string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) From d31246c159929208b788428a6256da8de90a13de Mon Sep 17 00:00:00 2001 From: Andrew Feng Date: Thu, 19 Sep 2024 15:00:00 -0400 Subject: [PATCH 2/3] remove dx9 --- cmake/bgfxToolUtils.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/bgfxToolUtils.cmake b/cmake/bgfxToolUtils.cmake index 757ab378..305c5445 100644 --- a/cmake/bgfxToolUtils.cmake +++ b/cmake/bgfxToolUtils.cmake @@ -542,7 +542,6 @@ if(TARGET bgfx::shaderc) function(_bgfx_get_profile_ext PROFILE PROFILE_EXT) string(REPLACE 300_es essl PROFILE ${PROFILE}) string(REPLACE 120 glsl PROFILE ${PROFILE}) - string(REPLACE s_3_0 dx9 PROFILE ${PROFILE}) string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) From d51a484b627ad7ca8bcf22958f8107c76f0121e2 Mon Sep 17 00:00:00 2001 From: Andrew Feng Date: Fri, 20 Sep 2024 14:04:47 -0400 Subject: [PATCH 3/3] add separate profile extension for paths vs profile extension --- cmake/bgfxToolUtils.cmake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmake/bgfxToolUtils.cmake b/cmake/bgfxToolUtils.cmake index 305c5445..210b2ad3 100644 --- a/cmake/bgfxToolUtils.cmake +++ b/cmake/bgfxToolUtils.cmake @@ -539,12 +539,23 @@ if(TARGET bgfx::shaderc) set(${ARG_OUT} ${CLI} PARENT_SCOPE) endfunction() - function(_bgfx_get_profile_ext PROFILE PROFILE_EXT) + # extensions consistent with those listed under bgfx/runtime/shaders + function(_bgfx_get_profile_path_ext PROFILE PROFILE_PATH_EXT) string(REPLACE 300_es essl PROFILE ${PROFILE}) string(REPLACE 120 glsl PROFILE ${PROFILE}) string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) + set(${PROFILE_PATH_EXT} ${PROFILE} PARENT_SCOPE) + endfunction() + # extensions consistent with embedded_shader.h + function(_bgfx_get_profile_ext PROFILE PROFILE_EXT) + string(REPLACE 300_es essl PROFILE ${PROFILE}) + string(REPLACE 120 glsl PROFILE ${PROFILE}) + string(REPLACE spirv spv PROFILE ${PROFILE}) + string(REPLACE metal mtl PROFILE ${PROFILE}) + string(REPLACE s_4_0 dx10 PROFILE ${PROFILE}) + string(REPLACE s_5_0 dx11 PROFILE ${PROFILE}) set(${PROFILE_EXT} ${PROFILE} PARENT_SCOPE) endfunction() @@ -599,11 +610,12 @@ if(TARGET bgfx::shaderc) set(COMMANDS "") set(MKDIR_COMMANDS "") foreach(PROFILE ${PROFILES}) + _bgfx_get_profile_path_ext(${PROFILE} PROFILE_PATH_EXT) _bgfx_get_profile_ext(${PROFILE} PROFILE_EXT) if(ARGS_AS_HEADERS) set(HEADER_PREFIX .h) endif() - set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_EXT}/${SHADER_FILE_BASENAME}.bin${HEADER_PREFIX}) + set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT}/${SHADER_FILE_BASENAME}.bin${HEADER_PREFIX}) set(PLATFORM_I ${PLATFORM}) if(PROFILE STREQUAL "spirv") set(PLATFORM_I LINUX) @@ -632,7 +644,7 @@ if(TARGET bgfx::shaderc) ${CMAKE_COMMAND} -E make_directory - ${ARGS_OUTPUT_DIR}/${PROFILE_EXT} + ${ARGS_OUTPUT_DIR}/${PROFILE_PATH_EXT} ) list(APPEND COMMANDS COMMAND bgfx::shaderc ${CLI}) endforeach()