Skip to content

Commit 5ba096a

Browse files
committed
update imgui submodule (move autogen imgui config to a header commited into the submodule)
1 parent faeff6d commit 5ba096a

File tree

2 files changed

+8
-74
lines changed

2 files changed

+8
-74
lines changed

3rdparty/CMakeLists.txt

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ NBL_GENERATE_GIT_TRACKING_META()
293293

294294
if(NBL_BUILD_IMGUI)
295295
set(NBL_IMGUI_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
296-
set(NBL_IMGUI_USER_CONFIG_ISD "${CMAKE_CURRENT_BINARY_DIR}/imgui/config/include")
297296
set(NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT "${THIRD_PARTY_SOURCE_DIR}/imgui_test_engine")
298297
set(NBL_IMGUI_TEST_ENGINE_ROOT "${NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT}/imgui_test_engine")
299298
set(NBL_IMGUI_TEST_SUITE_ROOT "${NBL_IMGUI_TEST_ENGINE_PROJECT_ROOT}/imgui_test_suite")
@@ -381,79 +380,14 @@ if(NBL_BUILD_IMGUI)
381380

382381
set(IMGUIZMO_BUILD_EXAMPLE OFF)
383382
add_subdirectory(imguizmo EXCLUDE_FROM_ALL)
383+
384+
if(NOT EXISTS "${NBL_IMGUI_USER_CONFIG_FILEPATH}")
385+
message(FATAL_ERROR "\"${NBL_IMGUI_USER_CONFIG_FILEPATH}\" doesn't exist!")
386+
endif()
387+
388+
# note we override imgui config with our own
389+
set(NBL_IMGUI_USER_CONFIG_FILEPATH "${NBL_IMGUI_ROOT}/nabla_imconfig.h")
384390

385-
# override test engine config with our own
386-
string(APPEND NBL_IMPL_IMCONFIG_CONTENT
387-
[=[
388-
#include "imgui_test_suite_imconfig.h" // use test engine's config
389-
390-
// note we override it with default imguis (void*) type
391-
#include <cstdint>
392-
393-
//! Custom "ImTextureID" info struct for Nabla UI backend purposes about resource sampler & texture descriptor binding's array indicies
394-
//! must be 4 bytes size & alignment to pass imgui static asserts (it checks for contiguous blocks in memory to make sure it can do some memcpies)
395-
struct SImResourceInfo
396-
{
397-
//! texture descriptor binding's array index
398-
uint32_t textureID : 26;
399-
400-
//! sampler descriptor binding's array index
401-
uint32_t samplerIx : 6;
402-
403-
SImResourceInfo() : textureID(0u), samplerIx(0u) {}
404-
405-
SImResourceInfo(uint32_t texID)
406-
{
407-
textureID = texID;
408-
samplerIx = 0u;
409-
}
410-
411-
explicit operator intptr_t() const
412-
{
413-
return static_cast<intptr_t>(textureID);
414-
}
415-
416-
bool operator==(const SImResourceInfo& other) const
417-
{
418-
return textureID == other.textureID;
419-
}
420-
421-
bool operator!=(const SImResourceInfo& other) const
422-
{
423-
return textureID != other.textureID;
424-
}
425-
426-
bool operator<(const SImResourceInfo& other) const
427-
{
428-
return textureID < other.textureID;
429-
}
430-
431-
bool operator>(const SImResourceInfo& other) const
432-
{
433-
return textureID > other.textureID;
434-
}
435-
436-
bool operator<=(const SImResourceInfo& other) const
437-
{
438-
return textureID <= other.textureID;
439-
}
440-
441-
bool operator>=(const SImResourceInfo& other) const
442-
{
443-
return textureID >= other.textureID;
444-
}
445-
};
446-
447-
#define ImTextureID SImResourceInfo
448-
#define IMGUI_ENABLE_FREETYPE
449-
#define IMGUI_DISABLE_OBSOLETE_KEYIO
450-
#undef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // but remove this cuz it break things
451-
]=]
452-
)
453-
set(NBL_IMGUI_USER_CONFIG_FILEPATH "${NBL_IMGUI_USER_CONFIG_ISD}/nabla_imconfig.h")
454-
file(WRITE "${NBL_IMGUI_USER_CONFIG_FILEPATH}" "${NBL_IMPL_IMCONFIG_CONTENT}")
455-
456-
# USER DEFINED IMGUI CONFIG, IMPACTS THE BUILD
457391
target_compile_definitions(imgui PUBLIC
458392
IMGUI_USER_CONFIG="${NBL_IMGUI_USER_CONFIG_FILEPATH}"
459393
)

3rdparty/imgui

0 commit comments

Comments
 (0)