Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compositor "scripts" for the batch renderer #1969

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,7 @@ if(BUILD_GUI_VIEWERS)
add_subdirectory(utils/replayer)
endif()
endif()

# TODO some options? reuse BUILD_DATATOOL?
add_subdirectory(utils/compositor)
add_subdirectory(utils/importer)
18 changes: 12 additions & 6 deletions src/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,11 @@ if(NOT USE_SYSTEM_MAGNUM)

# These are enabled by default but we don't need them for anything yet
set(MAGNUM_WITH_SHADERTOOLS OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_MATERIALTOOLS OFF CACHE BOOL "" FORCE)

# These are enabled by default but we don't need them if not building GUI
# viewers -- disabling for slightly faster builds. If you need any of these
# always, simply delete a line.
set(MAGNUM_WITH_TEXT OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_TEXTURETOOLS OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_STBTRUETYPEFONT OFF CACHE BOOL "" FORCE)

# These are not enabled by default but we need them
Expand All @@ -224,10 +222,6 @@ if(NOT USE_SYSTEM_MAGNUM)
set(MAGNUM_WITH_EMSCRIPTENAPPLICATION OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_GLFWAPPLICATION OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_EIGEN ON CACHE BOOL "" FORCE) # Eigen integration
# GltfSceneConverter and KtxImageConverter are needed only by
# BatchRendererTest and are optional
#set(MAGNUM_WITH_GLTFSCENECONVERTER ON CACHE BOOL "" FORCE)
#set(MAGNUM_WITH_KTXIMAGECONVERTER ON CACHE BOOL "" FORCE)
if(BUILD_PYTHON_BINDINGS)
set(MAGNUM_WITH_PYTHON ON CACHE BOOL "" FORCE) # Python bindings
endif()
Expand All @@ -239,6 +233,18 @@ if(NOT USE_SYSTEM_MAGNUM)
set(MAGNUM_WITH_OPENGLTESTER ON CACHE BOOL "" FORCE)
endif()

# GltfSceneConverter and KtxImageConverter are needed by BatchRendererTest
# and composite file creating scripts
# TODO have an option for this? or enable always?
set(MAGNUM_WITH_GLTFSCENECONVERTER ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_KTXIMAGECONVERTER ON CACHE BOOL "" FORCE)
# These are needed by composite file creating scripts
# TODO build only if those utils are built
set(MAGNUM_WITH_MATERIALTOOLS ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_TEXTURETOOLS ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_STLIMPORTER ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_STBRESIZEIMAGECONVERTER ON CACHE BOOL "" FORCE)

# Basis Universal. The repo is extremely huge and so instead of a Git
# submodule we bundle just the transcoder files, and only a subset of the
# formats (BC7 mode 6 has > 1 MB tables, ATC/FXT1/PVRTC2 are quite rare and
Expand Down
4 changes: 2 additions & 2 deletions src/esp/gfx_batch/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ bool Renderer::addFile(const Cr::Containers::StringView filename,
Mn::UnsignedInt offset = meshViewOffset;
for (Mn::UnsignedLong root : scene->childrenFor(-1)) {
Cr::Containers::Array<Mn::UnsignedLong> children =
scene->childrenFor(root);
scene->childrenFor(root); // TODO ugh slow AF

Cr::Containers::String name = importer->objectName(root);
if (!name) {
Expand Down Expand Up @@ -819,7 +819,7 @@ bool Renderer::addFile(const Cr::Containers::StringView filename,
{{}, Mn::Shaders::PhongGL::Flag::VertexColor}) {
Mn::Shaders::PhongGL::Flags shaderFlags =
extraFlags | Mn::Shaders::PhongGL::Flag::MultiDraw |
Mn::Shaders::PhongGL::Flag::UniformBuffers |
Mn::Shaders::PhongGL::Flag::ShaderStorageBuffers |
Mn::Shaders::PhongGL::Flag::NoSpecular |
Mn::Shaders::PhongGL::Flag::LightCulling;
if (!(state_->flags >= RendererFlag::NoTextures)) {
Expand Down
71 changes: 49 additions & 22 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ find_package(
OPTIONAL_COMPONENTS GltfSceneConverter KtxImageConverter
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h
)
# If Magnum is built as static (i.e., the bundled submodule), the plugin is
# static as well, and gets linked to the test. Otherwise it's dynamic and
# loaded through its filename.
if(MAGNUM_BUILD_STATIC)
set(HABITAT_IMPORTER_PLUGIN "HabitatImporter")
else()
set(HABITAT_IMPORTER_PLUGIN $<TARGET_FILE:HabitatImporter>)
endif()

# First replace ${} variables, then $<> generator expressions
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h.in)
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/configure.h
INPUT ${CMAKE_CURRENT_BINARY_DIR}/configure.h.in)

corrade_add_test(
AttributesConfigsTest
Expand All @@ -20,7 +31,7 @@ corrade_add_test(
assets
metadata
)
target_include_directories(AttributesConfigsTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(AttributesConfigsTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
AttributesManagersTest
Expand All @@ -30,7 +41,7 @@ corrade_add_test(
assets
metadata
)
target_include_directories(AttributesManagersTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(AttributesManagersTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
GfxBatchRendererTest
Expand All @@ -43,7 +54,7 @@ corrade_add_test(
MagnumPlugins::KtxImporter
MagnumPlugins::StbImageImporter
)
target_include_directories(GfxBatchRendererTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(GfxBatchRendererTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
if(BUILD_WITH_CUDA)
target_include_directories(
GfxBatchRendererTest PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
Expand All @@ -56,10 +67,26 @@ if(MagnumPlugins_KtxImageConverter_FOUND)
target_link_libraries(GfxBatchRendererTest PRIVATE MagnumPlugins::KtxImageConverter)
endif()

corrade_add_test(
FloorplannerProcessingTest
FloorplannerProcessingTest.cpp
LIBRARIES
gfx_batch
Magnum::DebugTools
Magnum::AnySceneImporter
MagnumPlugins::GltfImporter
MagnumPlugins::KtxImporter
MagnumPlugins::StbImageImporter
)
target_include_directories(FloorplannerProcessingTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
if(MAGNUM_BUILD_STATIC)
target_link_libraries(FloorplannerProcessingTest PRIVATE HabitatImporter)
endif()

corrade_add_test(CoreTest CoreTest.cpp LIBRARIES core io)

corrade_add_test(CullingTest CullingTest.cpp LIBRARIES gfx)
target_include_directories(CullingTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(CullingTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
DepthUnprojectionTest
Expand All @@ -73,7 +100,7 @@ corrade_add_test(
)

corrade_add_test(DrawableTest DrawableTest.cpp LIBRARIES gfx)
target_include_directories(DrawableTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(DrawableTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(GeoTest GeoTest.cpp LIBRARIES geo)

Expand All @@ -85,7 +112,7 @@ corrade_add_test(
gfx
sim
)
target_include_directories(GfxReplayTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(GfxReplayTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

if(BUILD_WITH_BACKGROUND_RENDERER)
corrade_add_test(
Expand All @@ -98,29 +125,29 @@ if(BUILD_WITH_BACKGROUND_RENDERER)
sim
)
target_include_directories(
BatchReplayRendererTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
BatchReplayRendererTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
)
endif()

corrade_add_test(GibsonSceneTest GibsonSceneTest.cpp LIBRARIES scene sim)
target_include_directories(GibsonSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(GibsonSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(HM3DSceneTest HM3DSceneTest.cpp LIBRARIES scene sim)
target_include_directories(HM3DSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(HM3DSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(IOTest IOTest.cpp LIBRARIES io metadata)
target_include_directories(IOTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(IOTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(LoggingTest LoggingTest.cpp LIBRARIES core)
set_tests_properties(LoggingTest PROPERTIES ENVIRONMENT HABITAT_SIM_LOG="")

corrade_add_test(
MetadataMediatorTest MetadataMediatorTest.cpp LIBRARIES assets metadata
)
target_include_directories(MetadataMediatorTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(MetadataMediatorTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(Mp3dTest Mp3dTest.cpp LIBRARIES scene)
target_include_directories(Mp3dTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(Mp3dTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
NavTest
Expand All @@ -131,7 +158,7 @@ corrade_add_test(
io
assets
)
target_include_directories(NavTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(NavTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
PathFinderTest
Expand All @@ -141,10 +168,10 @@ corrade_add_test(
io
Corrade::Utility
)
target_include_directories(PathFinderTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(PathFinderTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(PhysicsTest PhysicsTest.cpp LIBRARIES physics)
target_include_directories(PhysicsTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(PhysicsTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(
ReplicaSceneTest
Expand All @@ -154,10 +181,10 @@ corrade_add_test(
assets
sim
)
target_include_directories(ReplicaSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(ReplicaSceneTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES assets)
target_include_directories(ResourceManagerTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(ResourceManagerTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

corrade_add_test(SceneGraphTest SceneGraphTest.cpp LIBRARIES scene)

Expand All @@ -172,7 +199,7 @@ corrade_add_test(
Magnum::AnyImageConverter
MagnumPlugins::StbImageImporter
)
target_include_directories(SimTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(SimTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)

if(BUILD_WITH_VHACD)
corrade_add_test(
Expand All @@ -186,7 +213,7 @@ if(BUILD_WITH_VHACD)
Magnum::AnyImageConverter
MagnumPlugins::StbImageImporter
)
target_include_directories(VoxelGridTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(VoxelGridTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
endif()

# Some tests are LOUD, we don't want to include their full log (but OTOH we
Expand Down