Skip to content

Commit 4018e72

Browse files
Merge PR: Fix all sort of validation errors and image usage stuff
2 parents 684cabb + 57a69bd commit 4018e72

File tree

13 files changed

+71
-16
lines changed

13 files changed

+71
-16
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,6 @@
8787
[submodule "3rdparty/imgui"]
8888
path = 3rdparty/imgui
8989
url = git@github.com:ocornut/imgui.git
90+
[submodule "3rdparty/implot"]
91+
path = 3rdparty/implot
92+
url = git@github.com:epezent/implot.git

3rdparty/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,24 @@ if(NBL_BUILD_IMGUI)
250250
PUBLIC "imgui/backends"
251251
)
252252

253+
# ImPlot
254+
add_library(implot STATIC
255+
"implot/implot.h"
256+
"implot/implot_internal.h"
257+
"implot/implot.cpp"
258+
"implot/implot_items.cpp"
259+
)
260+
target_include_directories(implot
261+
PUBLIC "imgui"
262+
)
263+
target_link_libraries(implot PUBLIC imgui)
264+
target_compile_definitions(implot PUBLIC IMPLOT_DEBUG IMPLOT_DLL_EXPORT)
265+
set_property(TARGET implot PROPERTY CXX_STANDARD 11)
266+
if(MSVC)
267+
target_compile_options(implot PRIVATE /MT /W4 /WX /arch:AVX2 /fp:fast /permissive-)
268+
else()
269+
target_compile_options(implot PRIVATE -Wall -Wextra -pedantic -Werror -mavx2 -Ofast)
270+
endif()
253271
endif()
254272

255273
add_library(aesGladman OBJECT

3rdparty/implot

Submodule implot added at 18758e2

cmake/common.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ macro(nbl_create_ext_library_project EXT_NAME LIB_HEADERS LIB_SOURCES LIB_INCLUD
238238
target_link_libraries(${LIB_NAME} PUBLIC Nabla)
239239
target_compile_options(${LIB_NAME} PUBLIC ${LIB_OPTIONS})
240240
target_compile_definitions(${LIB_NAME} PUBLIC ${DEF_OPTIONS})
241-
set_target_properties(${LIB_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
241+
if(NBL_DYNAMIC_MSVC_RUNTIME)
242+
set_target_properties(${LIB_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
243+
else()
244+
set_target_properties(${LIB_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
245+
endif()
242246

243247
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
244248
add_compile_options(

include/nbl/ext/ImGui/ImGui.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#ifndef NBL_EXT_IMGUI_UI_H
22
#define NBL_EXT_IMGUI_UI_H
33

4-
#include <glm/vec3.hpp>
54

65
namespace nbl::ext::imgui
76
{
8-
class NBL_API2 UI final : public core::IReferenceCounted{
7+
class UI final : public core::IReferenceCounted{
98
public:
109

11-
explicit UI(
10+
UI(
1211
core::smart_refctd_ptr<video::ILogicalDevice> device,
1312
int maxFramesInFlight,
1413
core::smart_refctd_ptr<video::IGPURenderpass>& renderPass,
@@ -52,7 +51,7 @@ namespace nbl::ext::imgui
5251

5352
void InputFloat4(char const* label, float* value);
5453

55-
void InputFloat3(char const* label, glm::vec3& value);
54+
void InputFloat3(char const* label, nbl::core::vector3df& value);
5655

5756
bool Combo(
5857
char const* label,

include/nbl/system/CFileArchive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CInnerArchiveFile : public CFileView<T>
6868

6969

7070
//!
71-
class CFileArchive : public IFileArchive
71+
class NBL_API2 CFileArchive : public IFileArchive
7272
{
7373
static inline constexpr size_t SIZEOF_INNER_ARCHIVE_FILE = std::max(sizeof(CInnerArchiveFile<CPlainHeapAllocator>), sizeof(CInnerArchiveFile<VirtualMemoryAllocator>));
7474
static inline constexpr size_t ALIGNOF_INNER_ARCHIVE_FILE = std::max(alignof(CInnerArchiveFile<CPlainHeapAllocator>), alignof(CInnerArchiveFile<VirtualMemoryAllocator>));

include/nbl/system/atomic_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define _NBL_SYSTEM_ATOMIC_STATE_H_INCLUDED_
33

44
#include <atomic>
5+
#include "assert.h"
56

67
namespace nbl::system
78
{

src/nbl/builtin/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,6 @@ LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "glsl/blit/normalization/shared_nor
240240
LIST_BUILTIN_RESOURCE(NBL_RESOURCES_TO_EMBED "hlsl/shapes/line.hlsl")
241241

242242
macro(NBL_ADD_BUILTIN_RESOURCES _TARGET_) # internal & Nabla only, must be added with the macro to properly propagate scope
243-
ADD_CUSTOM_BUILTIN_RESOURCES("${_TARGET_}" NBL_RESOURCES_TO_EMBED "${NBL_ROOT_PATH}/include" "nbl/builtin" "nbl::builtin" "${NBL_ROOT_PATH_BINARY}/include" "${NBL_ROOT_PATH_BINARY}/src")
243+
ADD_CUSTOM_BUILTIN_RESOURCES("${_TARGET_}" NBL_RESOURCES_TO_EMBED "${NBL_ROOT_PATH}/include" "nbl/builtin" "nbl::builtin" "${NBL_ROOT_PATH_BINARY}/include" "${NBL_ROOT_PATH_BINARY}/src" "STATIC" "INTERNAL")
244244
endmacro()
245245

src/nbl/builtin/builtinHeaderGen.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828

2929
outp.write("#ifndef _" + guardSuffix + "_BUILTINRESOURCEDATA_H_\n")
3030
outp.write("#define _" + guardSuffix + "_BUILTINRESOURCEDATA_H_\n")
31+
32+
outp.write("#ifdef __INTELLISENSE__\n")
33+
outp.write("#include <codeanalysis\warnings.h>\n")
34+
outp.write("#pragma warning( push )\n")
35+
outp.write("#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )\n")
36+
outp.write("#endif // __INTELLISENSE__\n")
37+
3138
outp.write("#include <stdlib.h>\n")
3239
outp.write("#include <cstdint>\n")
3340
outp.write("#include <string>\n")
@@ -76,7 +83,12 @@
7683
else:
7784
outp.write('\n\t\ttemplate<> const std::pair<const uint8_t*, size_t> get_resource<NBL_CORE_UNIQUE_STRING_LITERAL_TYPE("%s")>();' % itemData[i].rstrip())
7885

79-
outp.write("\n\t}")
80-
outp.write("\n#endif // _" + guardSuffix + "_BUILTINRESOURCEDATA_H_")
86+
outp.write("\n\t}\n")
87+
88+
outp.write("#ifdef __INTELLISENSE__\n")
89+
outp.write("#pragma warning( pop )\n")
90+
outp.write("#endif // __INTELLISENSE__\n")
91+
92+
outp.write("#endif // _" + guardSuffix + "_BUILTINRESOURCEDATA_H_")
8193

8294
outp.close()

src/nbl/builtin/template/CArchive.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
#define _@_GUARD_SUFFIX_@_C_ARCHIVE_H_
33

44
#include "nbl/system/CFileArchive.h"
5+
#include "nbl/core/def/smart_refctd_ptr.h"
56
#include "@NBL_BS_HEADER_FILENAME@"
67

78
namespace @_NAMESPACE_@
89
{
910
constexpr std::string_view pathPrefix = "@_BUNDLE_ARCHIVE_ABSOLUTE_PATH_@";
1011
constexpr bool hasPathPrefix(std::string_view str) { return str.find(pathPrefix) == 0ull; }
1112

12-
class @_NBL_BR_API_@ CArchive final : public nbl::system::CFileArchive
13+
class @NBL_BR_API@ CArchive final : public nbl::system::CFileArchive
1314
{
1415
public:
1516
CArchive(nbl::system::logger_opt_smart_ptr&& logger);

src/nbl/builtin/utils.cmake

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _BUNDLE_NAME_ _BUNDLE_SEARCH
5555
set(_SHARED_ False)
5656
unset(NBL_BR_API)
5757
endif()
58+
59+
if("${ARGV8}" STREQUAL "INTERNAL")
60+
set(_NBL_INTERNAL_BR_CREATION_ ON)
61+
else()
62+
set(_NBL_INTERNAL_BR_CREATION_ OFF)
63+
endif()
5864

5965
set(NBL_TEMPLATE_RESOURCES_ARCHIVE_HEADER "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/CArchive.h.in")
6066
set(NBL_TEMPLATE_RESOURCES_ARCHIVE_SOURCE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/template/CArchive.cpp.in")
@@ -150,7 +156,17 @@ function(ADD_CUSTOM_BUILTIN_RESOURCES _TARGET_NAME_ _BUNDLE_NAME_ _BUNDLE_SEARCH
150156
)
151157
endif()
152158

153-
get_target_property(_NABLA_INCLUDE_DIRECTORIES_ Nabla INCLUDE_DIRECTORIES)
159+
if(TARGET Nabla)
160+
get_target_property(_NABLA_INCLUDE_DIRECTORIES_ Nabla INCLUDE_DIRECTORIES)
161+
162+
if(NBL_STATIC_BUILD AND _LIB_TYPE_ STREQUAL SHARED)
163+
message(FATAL_ERROR "Nabla must be built as dynamic library in order to combine this tool with SHARED setup!")
164+
endif()
165+
166+
if(NOT _NBL_INTERNAL_BR_CREATION_)
167+
target_link_libraries(${_TARGET_NAME_} Nabla) # be aware Nabla must be linked to the BRs
168+
endif()
169+
endif()
154170

155171
if(NOT DEFINED _NABLA_INCLUDE_DIRECTORIES_) # TODO, validate by populating generator expressions if any and checking whether a path to the BuildConfigOptions.h exists per config
156172
message(ERROR "_NABLA_INCLUDE_DIRECTORIES_ has been not found. You are required to define _NABLA_INCLUDE_DIRECTORIES_ containing at least include search directory path to BuildConfigOptions.h")

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,14 +879,14 @@ namespace nbl::ext::imgui
879879

880880
//-------------------------------------------------------------------------------------------------
881881

882-
void UI::InputFloat3(char const* label, glm::vec3& value)
882+
void UI::InputFloat3(char const* label, nbl::core::vector3df&value)
883883
{
884-
float tempValue[3]{ value.x, value.y, value.z };
884+
float tempValue[3]{ value.X, value.Y, value.Z };
885885
InputFloat3(label, tempValue);
886886

887-
if (memcmp(tempValue, &value[0], sizeof(float) * 3) != 0)
887+
if (memcmp(tempValue, &value.X, sizeof(float) * 3) != 0)
888888
{
889-
memcpy(&value[0], tempValue, sizeof(float) * 3);
889+
memcpy(&value.X, tempValue, sizeof(float) * 3);
890890
}
891891
}
892892

0 commit comments

Comments
 (0)