Compare commits
28 Commits
v1.136.909
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 574dd75c69 | |||
|
|
98d6c112a4 | ||
|
|
75700d672a | ||
|
|
c3fa3b0e36 | ||
|
|
668550dc7c | ||
|
|
8cc59b3a23 | ||
|
|
884c624619 | ||
|
|
9ba6a8ae0f | ||
|
|
830133102d | ||
|
|
4a9973b9e3 | ||
|
|
78c265c3c9 | ||
|
|
10a9ed2220 | ||
|
|
26dbcda964 | ||
|
|
4f736eedd5 | ||
|
|
ceacf584eb | ||
|
|
7addeb2643 | ||
|
|
6e2138a920 | ||
|
|
af6a3b1f2f | ||
|
|
f40f4ca580 | ||
|
|
eda300c870 | ||
|
|
fc0cada1eb | ||
|
|
fbe794fa4c | ||
|
|
12dcf5f74c | ||
|
|
5a19118dec | ||
|
|
6a35cc27ed | ||
|
|
4ae9b3209b | ||
|
|
cbd0e09dd9 | ||
|
|
f104e89b0e |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +1,2 @@
|
||||
* @bwrsandman
|
||||
* @jsm174
|
||||
|
||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
env:
|
||||
CMAKE_VERSION: 3.20.0
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
CC: ${{ matrix.cc }}
|
||||
CXX: ${{ matrix.cxx }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
@@ -94,7 +94,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
|
||||
6
.github/workflows/format.yml
vendored
6
.github/workflows/format.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
name: cmake-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
needs: cmake-format-check
|
||||
if: always() && startsWith(github.event_name, 'pull_request') && needs.cmake-format-check.result == 'failure'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
args: --config-files .cmake-format.py --in-place
|
||||
- run: |
|
||||
git diff > cmake-format.patch
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: formatting-fix-${{github.sha}}
|
||||
path: cmake-format.patch
|
||||
|
||||
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
sha: ${{ steps.version.outputs.sha }}
|
||||
tag: ${{ steps.version.outputs.tag }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
CMAKE_INSTALL_DIR: ${{ github.workspace }}/install/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Linux dependencies
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install --config Release
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: ${{ github.workspace }}/install/
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
@@ -102,15 +102,15 @@ jobs:
|
||||
find src/bgfx.cmake -name ".git*" -exec rm -rf {} +
|
||||
find src/bgfx.cmake -name ".editorconfig" -delete
|
||||
rm src/bgfx.cmake/.cmake-format.py
|
||||
- uses: actions/download-artifact@v4
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: windows-latest
|
||||
path: ${{ github.workspace }}/install/windows/bgfx.cmake
|
||||
- uses: actions/download-artifact@v4
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: ubuntu-latest
|
||||
path: ${{ github.workspace }}/install/linux/bgfx.cmake
|
||||
- uses: actions/download-artifact@v4
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: macos-latest
|
||||
path: ${{ github.workspace }}/install/macos/bgfx.cmake
|
||||
|
||||
@@ -45,7 +45,7 @@ cmake_dependent_option(
|
||||
)
|
||||
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)
|
||||
cmake_dependent_option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON "NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten" OFF)
|
||||
option(BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF)
|
||||
option(BGFX_CONFIG_DEBUG_ANNOTATION "Enable gfx debug annotations (default: on in debug)" OFF)
|
||||
|
||||
|
||||
2
bgfx
2
bgfx
Submodule bgfx updated: d9d99f51ad...4481b9b46b
2
bimg
2
bimg
Submodule bimg updated: bf10ffbb3d...2317bb623a
2
bx
2
bx
Submodule bx updated: 01cf049f97...c6131ec676
11
cmake/bgfx/3rdparty/glslang.cmake
vendored
11
cmake/bgfx/3rdparty/glslang.cmake
vendored
@@ -55,9 +55,10 @@ set_target_properties(glslang PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
glslang
|
||||
PUBLIC ${GLSLANG} #
|
||||
${GLSLANG}/glslang/Public #
|
||||
PRIVATE ${GLSLANG}/.. #
|
||||
${SPIRV_TOOLS}/include #
|
||||
${SPIRV_TOOLS}/source #
|
||||
PUBLIC ${GLSLANG}
|
||||
${GLSLANG}/glslang/Public
|
||||
${GLSLANG}/glslang/Include
|
||||
PRIVATE ${GLSLANG}/..
|
||||
${SPIRV_TOOLS}/include
|
||||
${SPIRV_TOOLS}/source
|
||||
)
|
||||
|
||||
3
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
3
cmake/bgfx/3rdparty/spirv-opt.cmake
vendored
@@ -110,10 +110,12 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_debug.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_decorations.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_derivatives.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_dot_product.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_execution_limitations.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_extensions.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_function.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_graph.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_group.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_id.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_image.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_instruction.cpp
|
||||
@@ -129,6 +131,7 @@ file(
|
||||
${SPIRV_TOOLS}/source/val/validate_misc.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_mode_setting.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_non_uniform.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_pipe.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_primitives.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_query.cpp
|
||||
${SPIRV_TOOLS}/source/val/validate_ray_tracing.cpp
|
||||
|
||||
98
cmake/bgfx/3rdparty/tint.cmake
vendored
Normal file
98
cmake/bgfx/3rdparty/tint.cmake
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# bgfx.cmake - bgfx building in cmake
|
||||
# Written in 2017 by Joshua Brookover <joshua.al.brookover@gmail.com>
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all copyright
|
||||
# and related and neighboring rights to this software to the public domain
|
||||
# worldwide. This software is distributed without any warranty.
|
||||
#
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
if(TARGET tint)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY ${BGFX_DIR})
|
||||
message(SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(TINT_DIR ${BGFX_DIR}/3rdparty/dawn)
|
||||
set(SPIRV_HEADERS ${BGFX_DIR}/3rdparty/spirv-headers)
|
||||
set(SPIRV_TOOLS ${BGFX_DIR}/3rdparty/spirv-tools)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
TINT_SOURCES
|
||||
${TINT_DIR}/src/tint/utils/*.cc
|
||||
${TINT_DIR}/src/tint/utils/*.h
|
||||
${TINT_DIR}/src/tint/lang/core/*.cc
|
||||
${TINT_DIR}/src/tint/lang/core/*.h
|
||||
${TINT_DIR}/src/tint/lang/null/*.cc
|
||||
${TINT_DIR}/src/tint/lang/null/*.h
|
||||
${TINT_DIR}/src/tint/lang/spirv/*.cc
|
||||
${TINT_DIR}/src/tint/lang/spirv/*.h
|
||||
${TINT_DIR}/src/tint/lang/wgsl/*.cc
|
||||
${TINT_DIR}/src/tint/lang/wgsl/*.h
|
||||
${TINT_DIR}/src/tint/api/*.cc
|
||||
${TINT_DIR}/src/tint/api/*.h
|
||||
)
|
||||
|
||||
add_library(tint STATIC ${TINT_SOURCES})
|
||||
|
||||
set_target_properties(tint PROPERTIES FOLDER "bgfx")
|
||||
|
||||
target_include_directories(
|
||||
tint
|
||||
PUBLIC ${TINT_DIR}
|
||||
${TINT_DIR}/src/tint
|
||||
PRIVATE ${TINT_DIR}/third_party/protobuf/src
|
||||
${TINT_DIR}/third_party/abseil-cpp
|
||||
${SPIRV_TOOLS}
|
||||
${SPIRV_TOOLS}/include
|
||||
${SPIRV_TOOLS}/include/generated
|
||||
${SPIRV_HEADERS}/include
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_GLSL_WRITER=0
|
||||
TINT_BUILD_HLSL_WRITER=0
|
||||
TINT_BUILD_MSL_WRITER=0
|
||||
TINT_BUILD_NULL_WRITER=0
|
||||
TINT_BUILD_SPV_READER=1
|
||||
TINT_BUILD_SPV_WRITER=0
|
||||
TINT_BUILD_WGSL_READER=0
|
||||
TINT_BUILD_WGSL_WRITER=1
|
||||
TINT_ENABLE_IR_VALIDATION=0
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=0
|
||||
TINT_BUILD_IS_MAC=0
|
||||
TINT_BUILD_IS_WIN=1
|
||||
)
|
||||
elseif(APPLE)
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=0
|
||||
TINT_BUILD_IS_MAC=1
|
||||
TINT_BUILD_IS_WIN=0
|
||||
)
|
||||
else()
|
||||
target_compile_definitions(
|
||||
tint
|
||||
PRIVATE TINT_BUILD_IS_LINUX=1
|
||||
TINT_BUILD_IS_MAC=0
|
||||
TINT_BUILD_IS_WIN=0
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(
|
||||
tint
|
||||
PRIVATE "/Zc:preprocessor"
|
||||
)
|
||||
endif()
|
||||
@@ -26,6 +26,7 @@ if(BGFX_BUILD_TOOLS_SHADER)
|
||||
include(3rdparty/glsl-optimizer.cmake)
|
||||
include(3rdparty/fcpp.cmake)
|
||||
include(3rdparty/webgpu.cmake)
|
||||
include(3rdparty/tint.cmake)
|
||||
include(shaderc.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -29,14 +29,7 @@ file(
|
||||
${BGFX_DIR}/include/bgfx/c99/*.h
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
file(GLOB BGFX_OBJC_SOURCES ${BGFX_DIR}/src/*.mm)
|
||||
list(APPEND BGFX_SOURCES ${BGFX_OBJC_SOURCES})
|
||||
list(REMOVE_ITEM BGFX_SOURCES ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.mm)
|
||||
else()
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
endif()
|
||||
set(BGFX_AMALGAMATED_SOURCE ${BGFX_DIR}/src/amalgamated.cpp)
|
||||
|
||||
if(BGFX_AMALGAMATED)
|
||||
set(BGFX_NOBUILD ${BGFX_SOURCES})
|
||||
@@ -59,7 +52,6 @@ endif()
|
||||
|
||||
if(BGFX_CONFIG_RENDERER_WEBGPU)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/webgpu.cmake)
|
||||
target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_RENDERER_WEBGPU=1)
|
||||
if(EMSCRIPTEN)
|
||||
target_link_options(bgfx PRIVATE "-s USE_WEBGPU=1")
|
||||
else()
|
||||
@@ -192,13 +184,6 @@ if(UNIX
|
||||
target_link_libraries(bgfx PUBLIC ${X11_LIBRARIES} ${OPENGL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Exclude mm files if not on OS X
|
||||
if(NOT APPLE)
|
||||
set_source_files_properties(${BGFX_DIR}/src/glcontext_eagl.mm PROPERTIES HEADER_FILE_ONLY ON)
|
||||
set_source_files_properties(${BGFX_DIR}/src/glcontext_nsgl.mm PROPERTIES HEADER_FILE_ONLY ON)
|
||||
set_source_files_properties(${BGFX_DIR}/src/renderer_mtl.mm PROPERTIES HEADER_FILE_ONLY ON)
|
||||
endif()
|
||||
|
||||
# Exclude glx context on non-unix
|
||||
if(NOT UNIX OR APPLE)
|
||||
set_source_files_properties(${BGFX_DIR}/src/glcontext_glx.cpp PROPERTIES HEADER_FILE_ONLY ON)
|
||||
@@ -207,10 +192,14 @@ endif()
|
||||
# Put in a "bgfx" folder in Visual Studio
|
||||
set_target_properties(bgfx PROPERTIES FOLDER "bgfx")
|
||||
|
||||
# in Xcode we need to specify this file as objective-c++ (instead of renaming to .mm)
|
||||
# in Xcode we need to specify these files as objective-c++ (instead of renaming to .mm)
|
||||
if(XCODE)
|
||||
set_source_files_properties(
|
||||
${BGFX_DIR}/src/renderer_vk.cpp PROPERTIES LANGUAGE OBJCXX XCODE_EXPLICIT_FILE_TYPE sourcecode.cpp.objcpp
|
||||
${BGFX_DIR}/src/renderer_vk.cpp
|
||||
${BGFX_DIR}/src/renderer_webgpu.cpp
|
||||
PROPERTIES
|
||||
LANGUAGE OBJCXX
|
||||
XCODE_EXPLICIT_FILE_TYPE sourcecode.cpp.objcpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
set(COMMON FILE ${FILE} ${TYPE} INCLUDES ${BGFX_DIR}/src)
|
||||
set(OUTPUTS "")
|
||||
set(OUTPUTS_PRETTY "")
|
||||
set(OUTPUT_FILES "")
|
||||
set(COMMANDS "")
|
||||
|
||||
if(WIN32)
|
||||
# dx11
|
||||
@@ -85,11 +87,15 @@ function(add_bgfx_shader FILE FOLDER)
|
||||
set(SPIRV_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/spirv/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(SPIRV ${COMMON} LINUX PROFILE spirv OUTPUT ${SPIRV_OUTPUT})
|
||||
list(APPEND OUTPUTS "SPIRV")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}SPIRV")
|
||||
set(OUTPUT_FILES "")
|
||||
set(COMMANDS "")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}SPIRV, ")
|
||||
endif()
|
||||
|
||||
# wgsl
|
||||
set(WGSL_OUTPUT ${BGFX_DIR}/examples/runtime/shaders/wgsl/${FILENAME}.bin)
|
||||
_bgfx_shaderc_parse(WGSL ${COMMON} LINUX PROFILE wgsl OUTPUT ${WGSL_OUTPUT})
|
||||
list(APPEND OUTPUTS "WGSL")
|
||||
set(OUTPUTS_PRETTY "${OUTPUTS_PRETTY}WGSL")
|
||||
|
||||
foreach(OUT ${OUTPUTS})
|
||||
list(APPEND OUTPUT_FILES ${${OUT}_OUTPUT})
|
||||
list(APPEND COMMANDS COMMAND "bgfx::shaderc" ${${OUT}})
|
||||
@@ -163,38 +169,44 @@ function(add_example ARG_NAME)
|
||||
# on iOS we need to build a bundle so have to copy the data rather than symlink
|
||||
# and on windows we can't create symlinks
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME} COMMAND ${CMAKE_COMMAND} -E copy_directory ${BGFX_DIR}/examples/runtime/
|
||||
TARGET example-${ARG_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${BGFX_DIR}/examples/runtime/
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>
|
||||
)
|
||||
else()
|
||||
# For everything else symlink some folders into our output directory
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/font
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/font
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/images
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/images
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/meshes
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/meshes
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/shaders
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/shaders
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/text
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/text
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET example-${ARG_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${BGFX_DIR}/examples/runtime/textures
|
||||
$<TARGET_FILE_DIR:example-${ARG_NAME}>/textures
|
||||
)
|
||||
@@ -334,6 +346,10 @@ if(BGFX_BUILD_EXAMPLES)
|
||||
45-bokeh
|
||||
46-fsr
|
||||
47-pixelformats
|
||||
48-drawindirect
|
||||
49-hextile
|
||||
50-headless
|
||||
51-gpufont
|
||||
)
|
||||
|
||||
foreach(EXAMPLE ${BGFX_EXAMPLES})
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
#include "@BGFX_DIR@/src/shader.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_dxbc.cpp"
|
||||
#include "@BGFX_DIR@/src/shader_spirv.cpp"
|
||||
|
||||
@@ -19,16 +19,6 @@ file(
|
||||
|
||||
add_executable(shaderc ${SHADERC_SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
bgfx-vertexlayout
|
||||
fcpp
|
||||
glslang
|
||||
glsl-optimizer
|
||||
spirv-opt
|
||||
spirv-cross
|
||||
)
|
||||
target_link_libraries(
|
||||
shaderc
|
||||
PRIVATE bx
|
||||
@@ -40,7 +30,32 @@ target_link_libraries(
|
||||
spirv-opt
|
||||
spirv-cross
|
||||
webgpu
|
||||
tint
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
shaderc
|
||||
PRIVATE ${BGFX_DIR}/3rdparty/dawn
|
||||
${BGFX_DIR}/3rdparty/dawn/src
|
||||
)
|
||||
|
||||
set(DXCOMPILER_RUNTIME)
|
||||
if(UNIX
|
||||
AND NOT APPLE
|
||||
AND NOT EMSCRIPTEN
|
||||
AND NOT ANDROID
|
||||
)
|
||||
target_include_directories(
|
||||
shaderc
|
||||
PRIVATE ${BGFX_DIR}/3rdparty/directx-headers/include/directx
|
||||
${BGFX_DIR}/3rdparty/directx-headers/include
|
||||
${BGFX_DIR}/3rdparty/directx-headers/include/wsl/stubs
|
||||
)
|
||||
set(DXCOMPILER_RUNTIME ${BGFX_DIR}/tools/bin/linux/libdxcompiler.so)
|
||||
elseif(WIN32)
|
||||
set(DXCOMPILER_RUNTIME ${BGFX_DIR}/tools/bin/windows/dxcompiler.dll)
|
||||
endif()
|
||||
|
||||
if(BGFX_AMALGAMATED)
|
||||
target_link_libraries(shaderc PRIVATE bgfx-shader)
|
||||
endif()
|
||||
@@ -66,3 +81,15 @@ endif()
|
||||
if(BGFX_INSTALL)
|
||||
install(TARGETS shaderc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
# DXIL compiler will be dynamically loaded at runtime - no need
|
||||
# to link, just install the needed binaries alongside shaderc.exe
|
||||
if(DXCOMPILER_RUNTIME)
|
||||
add_custom_command(
|
||||
TARGET shaderc POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DXCOMPILER_RUNTIME} $<TARGET_FILE_DIR:shaderc>
|
||||
)
|
||||
if(BGFX_INSTALL)
|
||||
install(FILES ${DXCOMPILER_RUNTIME} DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -459,16 +459,10 @@ if(TARGET bgfx::shaderc)
|
||||
|
||||
# --define
|
||||
if(ARG_DEFINES)
|
||||
list(APPEND CLI "--defines")
|
||||
set(DEFINES "")
|
||||
foreach(DEFINE ${ARG_DEFINES})
|
||||
if(NOT "${DEFINES}" STREQUAL "")
|
||||
set(DEFINES "${DEFINES}\\\\;${DEFINE}")
|
||||
else()
|
||||
set(DEFINES "${DEFINE}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND CLI "${DEFINES}")
|
||||
# Add extra escapes or CMake will expand in the final CLI
|
||||
string(REPLACE ";" "\\\\\\;" DEFINES "${ARG_DEFINES}")
|
||||
# Also need to quote escape for Unix shells
|
||||
list(APPEND CLI "--define" "\"${DEFINES}\"")
|
||||
endif()
|
||||
|
||||
# --raw
|
||||
@@ -541,21 +535,25 @@ if(TARGET bgfx::shaderc)
|
||||
|
||||
# extensions consistent with those listed under bgfx/runtime/shaders
|
||||
function(_bgfx_get_profile_path_ext PROFILE PROFILE_PATH_EXT)
|
||||
string(REPLACE 100_es essl PROFILE ${PROFILE})
|
||||
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})
|
||||
string(REPLACE 430 glsl PROFILE ${PROFILE})
|
||||
string(REPLACE s_5_0 dxbc PROFILE ${PROFILE})
|
||||
string(REPLACE s_6_0 dxil 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 100_es essl PROFILE ${PROFILE})
|
||||
string(REPLACE 300_es essl PROFILE ${PROFILE})
|
||||
string(REPLACE 120 glsl PROFILE ${PROFILE})
|
||||
string(REPLACE 430 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})
|
||||
string(REPLACE s_5_0 dxbc PROFILE ${PROFILE})
|
||||
string(REPLACE s_6_0 dxil PROFILE ${PROFILE})
|
||||
set(${PROFILE_EXT} ${PROFILE} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -566,16 +564,25 @@ if(TARGET bgfx::shaderc)
|
||||
# OUTPUT_DIR directory
|
||||
# OUT_FILES_VAR variable name
|
||||
# INCLUDE_DIRS directories
|
||||
# DEFINES defines
|
||||
# [AS_HEADERS]
|
||||
# )
|
||||
#
|
||||
function(bgfx_compile_shaders)
|
||||
set(options AS_HEADERS)
|
||||
set(oneValueArgs TYPE VARYING_DEF OUTPUT_DIR OUT_FILES_VAR)
|
||||
set(multiValueArgs SHADERS INCLUDE_DIRS)
|
||||
set(multiValueArgs SHADERS INCLUDE_DIRS DEFINES)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||
|
||||
set(PROFILES 120 300_es spirv)
|
||||
set(PROFILES spirv)
|
||||
if(ARGS_TYPE STREQUAL "COMPUTE")
|
||||
list(APPEND PROFILES 430 300_es)
|
||||
else()
|
||||
list(APPEND PROFILES 120 100_es)
|
||||
endif()
|
||||
if(BGFX_CONFIG_RENDERER_WEBGPU)
|
||||
list(APPEND PROFILES wgsl)
|
||||
endif()
|
||||
if(IOS)
|
||||
set(PLATFORM IOS)
|
||||
list(APPEND PROFILES metal)
|
||||
@@ -595,8 +602,8 @@ if(TARGET bgfx::shaderc)
|
||||
OR CYGWIN
|
||||
)
|
||||
set(PLATFORM WINDOWS)
|
||||
list(APPEND PROFILES s_4_0)
|
||||
list(APPEND PROFILES s_5_0)
|
||||
list(APPEND PROFILES s_6_0)
|
||||
elseif(ORBIS) # ORBIS should be defined by a PS4 CMake toolchain
|
||||
set(PLATFORM ORBIS)
|
||||
list(APPEND PROFILES pssl)
|
||||
@@ -625,9 +632,6 @@ if(TARGET bgfx::shaderc)
|
||||
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)
|
||||
endif()
|
||||
set(BIN2C_PART "")
|
||||
if(ARGS_AS_HEADERS)
|
||||
set(BIN2C_PART BIN2C ${SHADER_FILE_NAME_WE}_${PROFILE_EXT})
|
||||
@@ -635,13 +639,14 @@ if(TARGET bgfx::shaderc)
|
||||
_bgfx_shaderc_parse(
|
||||
CLI #
|
||||
${BIN2C_PART} #
|
||||
${ARGS_TYPE} ${PLATFORM_I} WERROR "$<$<CONFIG:debug>:DEBUG>$<$<CONFIG:relwithdebinfo>:DEBUG>"
|
||||
${ARGS_TYPE} ${PLATFORM_I} "$<$<CONFIG:Debug,RelWithDebInfo>:DEBUG>"
|
||||
FILE ${SHADER_FILE_ABSOLUTE}
|
||||
OUTPUT ${OUTPUT}
|
||||
PROFILE ${PROFILE}
|
||||
O "$<$<CONFIG:debug>:0>$<$<CONFIG:release>:3>$<$<CONFIG:relwithdebinfo>:3>$<$<CONFIG:minsizerel>:3>"
|
||||
O "$<IF:$<CONFIG:Debug>,0,3>"
|
||||
VARYINGDEF ${ARGS_VARYING_DEF}
|
||||
INCLUDES ${BGFX_SHADER_INCLUDE_PATH} ${ARGS_INCLUDE_DIRS}
|
||||
DEFINES ${ARGS_DEFINES}
|
||||
)
|
||||
list(APPEND OUTPUTS ${OUTPUT})
|
||||
list(APPEND ALL_OUTPUTS ${OUTPUT})
|
||||
|
||||
2
cmake/bimg/3rdparty/miniz.cmake
vendored
2
cmake/bimg/3rdparty/miniz.cmake
vendored
@@ -19,5 +19,5 @@ if(NOT MINIZ_LIBRARIES)
|
||||
MINIZ_SOURCES #
|
||||
${BIMG_DIR}/3rdparty/tinyexr/deps/miniz/miniz.* #
|
||||
)
|
||||
set(MINIZ_INCLUDE_DIR ${BIMG_DIR}/3rdparty/tinyexr/deps/miniz)
|
||||
set(MINIZ_INCLUDE_DIR ${BIMG_DIR}/3rdparty/tinyexr/deps)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user