mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Compare commits
12 Commits
v1.128.877
...
v1.129.886
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf79284dad | ||
|
|
06144dcb9b | ||
|
|
3b5115516c | ||
|
|
ef0ed485c5 | ||
|
|
2c33050257 | ||
|
|
b12eb2882a | ||
|
|
1139067c7d | ||
|
|
b135fa3d77 | ||
|
|
9af6a48ce0 | ||
|
|
f531516396 | ||
|
|
94184872a8 | ||
|
|
4ceffda6de |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
- uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: ${{ env.CMAKE_VERSION }}
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
|
||||
2
.github/workflows/format.yml
vendored
2
.github/workflows/format.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
args: --config-files .cmake-format.py --in-place
|
||||
- run: |
|
||||
git diff > cmake-format.patch
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: formatting-fix-${{github.sha}}
|
||||
path: cmake-format.patch
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -57,7 +57,7 @@ jobs:
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y libgl1-mesa-dev
|
||||
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
@@ -43,7 +43,7 @@ option(BGFX_INSTALL "Create installation target." ON)
|
||||
cmake_dependent_option(
|
||||
BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF "BGFX_INSTALL;BGFX_BUILD_EXAMPLES" OFF
|
||||
)
|
||||
cmake_dependent_option(BGFX_WITH_WAYLAND "Use Wayland backend." ON "CMAKE_SYSTEM_NAME STREQUAL 'Linux'" OFF)
|
||||
cmake_dependent_option(BGFX_WITH_WAYLAND "Use Wayland backend." ON "CMAKE_SYSTEM_NAME STREQUAL Linux" OFF)
|
||||
option(BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON)
|
||||
option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON)
|
||||
option(BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF)
|
||||
|
||||
@@ -94,7 +94,7 @@ bgfx_compile_shaders(
|
||||
SHADERS filenames
|
||||
VARYING_DEF filename
|
||||
OUTPUT_DIR directory
|
||||
[AS_HEADER]
|
||||
[AS_HEADERS]
|
||||
)
|
||||
```
|
||||
This defines a shaderc command to generate binaries or headers for a number of `TYPE` shaders with `SHADERS` files and `VARYING_DEF` file in the `OUTPUT_DIR` directory. There will be one generated shader for each supported rendering API on this current platform according to the `BGFX_EMBEDDED_SHADER` macro in `bgfx/embedded_shader.h` for headers and in the directory expected by `load_shader` in `bgfx_utils.h`.
|
||||
@@ -110,14 +110,14 @@ bgfx_compile_shaders(
|
||||
SHADERS vs.sc
|
||||
VARYING_DEF varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
AS_HEADER
|
||||
AS_HEADERS
|
||||
)
|
||||
bgfx_compile_shader_to_header(
|
||||
bgfx_compile_shaders(
|
||||
TYPE FRAGMENT
|
||||
SHADERS fs.sc
|
||||
VARYING_DEF ${CMAKE_SOURCE_DIR}/varying.def.sc
|
||||
OUTPUT_DIR ${CMAKE_BINARY_DIR}/include/generated/shaders
|
||||
AS_HEADER
|
||||
AS_HEADERS
|
||||
)
|
||||
|
||||
add_library(myLib main.cpp vs.sc fs.sc)
|
||||
|
||||
2
bgfx
2
bgfx
Submodule bgfx updated: af12904d8c...de56398919
2
bimg
2
bimg
Submodule bimg updated: 2afa64c14c...c5c7b6e187
2
bx
2
bx
Submodule bx updated: e7ede513dc...01c99ddd09
3
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
3
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
@@ -74,6 +74,8 @@ file(
|
||||
${SPIRV_TOOLS}/source/text.h
|
||||
${SPIRV_TOOLS}/source/text_handler.cpp
|
||||
${SPIRV_TOOLS}/source/text_handler.h
|
||||
${SPIRV_TOOLS}/source/to_string.cpp
|
||||
${SPIRV_TOOLS}/source/to_string.h
|
||||
${SPIRV_TOOLS}/source/util/bit_vector.cpp
|
||||
${SPIRV_TOOLS}/source/util/bit_vector.h
|
||||
${SPIRV_TOOLS}/source/util/bitutils.h
|
||||
@@ -127,6 +129,7 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing_reorder.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_scopes.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_small_type_uses.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_tensor_layout.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_type.cpp
|
||||
${SPIRV_TOOLS}/source/val/validation_state.cpp
|
||||
)
|
||||
|
||||
@@ -87,6 +87,7 @@ endif()
|
||||
|
||||
if(BGFX_WITH_WAYLAND)
|
||||
target_compile_definitions(bgfx PRIVATE "WL_EGL_PLATFORM=1")
|
||||
target_link_libraries(bgfx PRIVATE wayland-egl)
|
||||
endif()
|
||||
|
||||
set(BGFX_CONFIG_OPTIONS "")
|
||||
|
||||
@@ -136,14 +136,19 @@ function(add_example ARG_NAME)
|
||||
target_link_libraries(
|
||||
example-${ARG_NAME} PUBLIC bgfx bx bimg bimg_decode ${DEAR_IMGUI_LIBRARIES} ${MESHOPTIMIZER_LIBRARIES}
|
||||
)
|
||||
|
||||
if(BGFX_WITH_WAYLAND)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_WAYLAND=1)
|
||||
endif()
|
||||
|
||||
if(BGFX_WITH_GLFW)
|
||||
find_package(glfw3 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC glfw)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW=1)
|
||||
elseif(BGFX_WITH_SDL)
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC ${SDL2_LIBRARIES})
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL)
|
||||
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL=1)
|
||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
target_link_libraries(example-${ARG_NAME} PUBLIC X11)
|
||||
endif()
|
||||
|
||||
@@ -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()
|
||||
@@ -364,7 +364,7 @@ if(TARGET bgfx::shaderc)
|
||||
# FILE filename
|
||||
# OUTPUT filename
|
||||
# FRAGMENT|VERTEX|COMPUTE
|
||||
# ANDROID|ASM_JS|IOS|LINUX|NACL|OSX|WINDOWS
|
||||
# ANDROID|ASM_JS|IOS|LINUX|OSX|WINDOWS|ORBIS
|
||||
# PROFILE profile
|
||||
# [O 0|1|2|3]
|
||||
# [VARYINGDEF filename]
|
||||
@@ -382,7 +382,7 @@ if(TARGET bgfx::shaderc)
|
||||
function(_bgfx_shaderc_parse ARG_OUT)
|
||||
cmake_parse_arguments(
|
||||
ARG
|
||||
"DEPENDS;ANDROID;ASM_JS;IOS;LINUX;NACL;OSX;WINDOWS;PREPROCESS;RAW;FRAGMENT;VERTEX;COMPUTE;VERBOSE;DEBUG;DISASM;WERROR"
|
||||
"DEPENDS;ANDROID;ASM_JS;IOS;LINUX;OSX;WINDOWS;ORBIS;PREPROCESS;RAW;FRAGMENT;VERTEX;COMPUTE;VERBOSE;DEBUG;DISASM;WERROR"
|
||||
"FILE;OUTPUT;VARYINGDEF;BIN2C;PROFILE;O"
|
||||
"INCLUDES;DEFINES"
|
||||
${ARGN}
|
||||
@@ -423,7 +423,7 @@ if(TARGET bgfx::shaderc)
|
||||
|
||||
# --platform
|
||||
set(PLATFORM "")
|
||||
set(PLATFORMS "ANDROID;ASM_JS;IOS;LINUX;NACL;OSX;WINDOWS")
|
||||
set(PLATFORMS "ANDROID;ASM_JS;IOS;LINUX;OSX;WINDOWS;ORBIS")
|
||||
foreach(P ${PLATFORMS})
|
||||
if(ARG_${P})
|
||||
if(PLATFORM)
|
||||
@@ -436,20 +436,20 @@ if(TARGET bgfx::shaderc)
|
||||
if(PLATFORM STREQUAL "")
|
||||
message(SEND_ERROR "Call to _bgfx_shaderc_parse() must have a platform flag: ${PLATFORMS}")
|
||||
return()
|
||||
elseif(PLATFORM STREQUAL ANDROID)
|
||||
elseif(PLATFORM STREQUAL "ANDROID")
|
||||
list(APPEND CLI "--platform" "android")
|
||||
elseif(PLATFORM STREQUAL ASM_JS)
|
||||
elseif(PLATFORM STREQUAL "ASM_JS")
|
||||
list(APPEND CLI "--platform" "asm.js")
|
||||
elseif(PLATFORM STREQUAL IOS)
|
||||
elseif(PLATFORM STREQUAL "IOS")
|
||||
list(APPEND CLI "--platform" "ios")
|
||||
elseif(PLATFORM STREQUAL NACL)
|
||||
list(APPEND CLI "--platform" "nacl")
|
||||
elseif(PLATFORM STREQUAL OSX)
|
||||
elseif(PLATFORM STREQUAL "OSX")
|
||||
list(APPEND CLI "--platform" "osx")
|
||||
elseif(PLATFORM STREQUAL UNIX)
|
||||
elseif(PLATFORM STREQUAL "LINUX")
|
||||
list(APPEND CLI "--platform" "linux")
|
||||
elseif(PLATFORM STREQUAL WINDOWS)
|
||||
elseif(PLATFORM STREQUAL "WINDOWS")
|
||||
list(APPEND CLI "--platform" "windows")
|
||||
elseif(PLATFORM STREQUAL "ORBIS")
|
||||
list(APPEND CLI "--platform" "orbis")
|
||||
endif()
|
||||
|
||||
# --preprocess
|
||||
@@ -539,15 +539,23 @@ if(TARGET bgfx::shaderc)
|
||||
set(${ARG_OUT} ${CLI} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# 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_3_0 dx9 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()
|
||||
|
||||
@@ -568,7 +576,12 @@ if(TARGET bgfx::shaderc)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||
|
||||
set(PROFILES 120 300_es spirv)
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(IOS)
|
||||
set(PLATFORM IOS)
|
||||
list(APPEND PROFILES metal)
|
||||
elseif(ANDROID)
|
||||
set(PLATFORM ANDROID)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(PLATFORM LINUX)
|
||||
elseif(EMSCRIPTEN)
|
||||
set(PLATFORM ASM_JS)
|
||||
@@ -584,6 +597,9 @@ if(TARGET bgfx::shaderc)
|
||||
set(PLATFORM WINDOWS)
|
||||
list(APPEND PROFILES s_4_0)
|
||||
list(APPEND PROFILES s_5_0)
|
||||
elseif(ORBIS) # ORBIS should be defined by a PS4 CMake toolchain
|
||||
set(PLATFORM ORBIS)
|
||||
list(APPEND PROFILES pssl)
|
||||
else()
|
||||
# pssl for Agc and Gnm renderers
|
||||
# nvn for Nvn renderer
|
||||
@@ -602,8 +618,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)
|
||||
set(OUTPUT ${ARGS_OUTPUT_DIR}/${PROFILE_EXT}/${SHADER_FILE_BASENAME}.bin$<$<BOOL:ARGS_AS_HEADERS>:.h>)
|
||||
if(ARGS_AS_HEADERS)
|
||||
set(HEADER_PREFIX .h)
|
||||
endif()
|
||||
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 +652,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()
|
||||
|
||||
Reference in New Issue
Block a user