Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Fix glslang compile error and allow BGFX_CONFIG_MULTITHREADED to be controlled. #105

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ install_manifest.txt
generated/*
!generated/*.in
cmake_install.cmake
.vs/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[submodule "bgfx"]
path = bgfx
url = https://github.com/bkaradzic/bgfx.git
branch = master
[submodule "bx"]
path = bx
url = https://github.com/bkaradzic/bx.git
branch = master
[submodule "bimg"]
path = bimg
url = https://github.com/bkaradzic/bimg.git
branch = master
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ option( BGFX_USE_OVR "Build with OVR support." OF
option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF )
option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF )
option( BGFX_CONFIG_DEBUG "Enables debug configuration on all builds" OFF )
option( BGFX_CONFIG_MULTITHREADED "Enables multithreaded renderering" ON )
option( BGFX_CONFIG_RENDERER_WEBGPU "Enables the webgpu renderer" OFF )

set( BGFX_OPENGL_VERSION "" CACHE STRING "Specify minimum opengl version" )
Expand Down
15 changes: 15 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
2 changes: 1 addition & 1 deletion bgfx
Submodule bgfx updated 2445 files
2 changes: 1 addition & 1 deletion bx
Submodule bx updated 132 files
4 changes: 3 additions & 1 deletion cmake/3rdparty/glslang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()
file( GLOB GLSLANG_SOURCES
${BGFX_DIR}/3rdparty/glslang/glslang/GenericCodeGen/*.cpp
${BGFX_DIR}/3rdparty/glslang/glslang/MachineIndependent/*.cpp
${BGFX_DIR}/3rdparty/glslang/glslang/MachineIndependent/preprocessor/*.cpp
${BGFX_DIR}/3rdparty/glslang/glslang/MachineIndependent/preprocessor/*.cpp
${BGFX_DIR}/3rdparty/glslang/glslang/HLSL/*.cpp
${BGFX_DIR}/3rdparty/glslang/hlsl/*.cpp
${BGFX_DIR}/3rdparty/glslang/SPIRV/*.cpp
Expand All @@ -35,6 +35,8 @@ target_include_directories( glslang PUBLIC
${BGFX_DIR}/3rdparty/glslang
${BGFX_DIR}/3rdparty/glslang/glslang/Include
${BGFX_DIR}/3rdparty/glslang/glslang/Public
PRIVATE
${BGFX_DIR}/3rdparty
)

set_target_properties( glslang PROPERTIES FOLDER "bgfx/3rdparty" )
Expand Down
8 changes: 3 additions & 5 deletions cmake/bgfx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ if(BGFX_CONFIG_RENDERER_WEBGPU)
endif()
endif()

# Enable BGFX_CONFIG_DEBUG in Debug configuration
target_compile_definitions( bgfx PRIVATE "$<$<CONFIG:Debug>:BGFX_CONFIG_DEBUG=1>" )
if(BGFX_CONFIG_DEBUG)
target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_DEBUG=1)
endif()
target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_DEBUG=$<BOOL:${BGFX_CONFIG_DEBUG}>)

target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_MULTITHREADED=$<BOOL:${BGFX_CONFIG_MULTITHREADED}>)

if( NOT ${BGFX_OPENGL_VERSION} STREQUAL "" )
target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION=${BGFX_OPENGL_VERSION} )
Expand Down
9 changes: 7 additions & 2 deletions cmake/examples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,15 @@ if( BGFX_BUILD_EXAMPLES )
34-mvs
35-dynamic
36-sky
# 37-gpudrivenrendering
37-gpudrivenrendering
38-bloom
39-assao
# 40-svt
40-svt
41-tess
42-bunnylod
43-denoise
44-sss
45-bokeh
)

foreach( EXAMPLE ${BGFX_EXAMPLES} )
Expand Down
17 changes: 16 additions & 1 deletion cmake/tools/shaderc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@ include( cmake/3rdparty/spirv-cross.cmake )
include( cmake/3rdparty/spirv-tools.cmake )
include( cmake/3rdparty/webgpu.cmake )

add_executable( shaderc ${BGFX_DIR}/tools/shaderc/shaderc.cpp ${BGFX_DIR}/tools/shaderc/shaderc.h ${BGFX_DIR}/tools/shaderc/shaderc_glsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_hlsl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_pssl.cpp ${BGFX_DIR}/tools/shaderc/shaderc_spirv.cpp ${BGFX_DIR}/tools/shaderc/shaderc_metal.cpp )
add_executable( shaderc
${BGFX_DIR}/tools/shaderc/shaderc.cpp
${BGFX_DIR}/tools/shaderc/shaderc.h
${BGFX_DIR}/tools/shaderc/shaderc_glsl.cpp
${BGFX_DIR}/tools/shaderc/shaderc_hlsl.cpp
${BGFX_DIR}/tools/shaderc/shaderc_pssl.cpp
${BGFX_DIR}/tools/shaderc/shaderc_spirv.cpp
${BGFX_DIR}/tools/shaderc/shaderc_metal.cpp

# odd dependencies
${BGFX_DIR}/src/shader_dx9bc.cpp
${BGFX_DIR}/src/shader_dxbc.cpp
${BGFX_DIR}/src/shader.cpp
)

target_include_directories( shaderc PRIVATE ${BGFX_DIR}/include/ )
target_compile_definitions( shaderc PRIVATE "-D_CRT_SECURE_NO_WARNINGS" )
set_target_properties( shaderc PROPERTIES FOLDER "bgfx/tools" )
target_link_libraries(shaderc PRIVATE bx bimg bgfx-vertexlayout bgfx-shader-spirv fcpp glsl-optimizer glslang spirv-cross spirv-tools webgpu)
Expand Down