Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a2d2e9d
Fix so that code can run in examples branch
Fletterio Jul 24, 2025
d9640fe
Merge branch 'master' into geotex_streaming
Fletterio Jul 31, 2025
b12d959
update examples
Erfan-Ahmadi Aug 8, 2025
3f610de
Merge branch 'master' into geotex_streaming
Erfan-Ahmadi Aug 8, 2025
1197852
update examples
Erfan-Ahmadi Sep 3, 2025
c94effb
Merge branch 'geotex_streaming' of github.com:Devsh-Graphics-Programm…
Fletterio Sep 9, 2025
9b41aae
pull master, resolve submodule conflicts
AnastaZIuk Sep 15, 2025
7f1cb7d
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk Sep 15, 2025
f334f90
ieee754::flipSign update, flipSign_helper::FloatingPoint fix
AnastaZIuk Sep 15, 2025
0e84d33
Change examples submodule
Fletterio Sep 15, 2025
0adfa1e
Update submodule pointer
Fletterio Sep 16, 2025
9bd7f3b
Update CMakePresets.json, forgot to commit and push new n4ce preset
AnastaZIuk Sep 20, 2025
824a55e
update examples
Erfan-Ahmadi Oct 3, 2025
f9cfa1e
asset::IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_NONE for NSC
AnastaZIuk Oct 11, 2025
111bd0e
pull master, resolve conflicts
AnastaZIuk Oct 12, 2025
7ecba27
pull geotex_streaming-package
AnastaZIuk Oct 12, 2025
29687f9
Merge branch 'nscUpdates' of github.com:Devsh-Graphics-Programming/Na…
AnastaZIuk Oct 12, 2025
029083d
add debug info flags to ILogicalDevice::compileShader
Erfan-Ahmadi Oct 13, 2025
db5156a
Point submodule to geotex branch
Fletterio Oct 14, 2025
f70af54
Merge branch 'geotex_streaming' of github.com:Devsh-Graphics-Programm…
Fletterio Oct 14, 2025
86c8426
IUtilities Allow for null (0 sized) staging buffers for download/upload
Erfan-Ahmadi Oct 15, 2025
6e13596
Cmake "NBL_SKIP_BUILD_OPTIONS_VALIDATION": "ON"
Erfan-Ahmadi Nov 6, 2025
fb62145
Small MonoDeviceApp fix and update examples
Erfan-Ahmadi Nov 11, 2025
f444ea3
update examples
Erfan-Ahmadi Nov 11, 2025
00363cc
Merge branch 'master' into geotex_streaming
Erfan-Ahmadi Nov 11, 2025
92e7d14
Update Vulkan-Headers to 1.4.332
AnastaZIuk Nov 12, 2025
542e0bf
update 3rdparty/Vulkan-Tools]
AnastaZIuk Nov 12, 2025
de16092
update smoke test to cover n4ce case, update 3rdparty/SPIRV-Tools sub…
AnastaZIuk Nov 12, 2025
f08a43c
add include/nbl/system/json.h and wipe nlohmann/json_fwd.hpp from pub…
AnastaZIuk Nov 13, 2025
0168ad7
fix json ambiguity, update examples_tests submodule
AnastaZIuk Nov 13, 2025
812398c
Merge pull request #948 from Devsh-Graphics-Programming/vkinfoUpdates
AnastaZIuk Nov 13, 2025
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
3 changes: 0 additions & 3 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,6 @@ nbl_install_dir(imath/src/Imath)

nbl_install_file(blake/c/blake3.h)

nbl_install_file_spec(nlohmann_json/include/nlohmann/json_fwd.hpp nlohmann)
nbl_install_file_spec(nlohmann_json/include/nlohmann/detail/abi_macros.hpp nlohmann/detail)

nbl_install_dir(boost/superproject/libs/preprocessor/include/boost)

nbl_install_file_spec(renderdoc/renderdoc_app.h renderdoc)
Expand Down
27 changes: 26 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,32 @@
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
}
},
{
"name": "n4ce-configure-windows-msvc",
"hidden": false,
"binaryDir": "build/production/n4ce",
"cacheVariables": {
"NBL_STATIC_BUILD": "OFF",
"NBL_SKIP_BUILD_OPTIONS_VALIDATION": "ON",
"CMAKE_SUPPRESS_REGENERATION": "OFF",
"NBL_COMPILER_DYNAMIC_RUNTIME": "ON",
"NBL_EMBED_BUILTIN_RESOURCES": "ON",
"NBL_UPDATE_GIT_SUBMODULE": "OFF",
"NBL_COMPILE_WITH_CUDA": "OFF",
"NBL_BUILD_OPTIX": "OFF",
"NBL_BUILD_MITSUBA_LOADER": "OFF",
"NBL_BUILD_RADEON_RAYS": "OFF",
"_NBL_COMPILE_WITH_OPEN_EXR_": "ON",
"NBL_EXPLICIT_MODULE_LOAD_LOG": "ON",
"NBL_CPACK_NO_BUILD_DIRECTORY_MODULES": "ON",
"GIT_FAIL_IF_NONZERO_EXIT": "OFF"
},
"displayName": "[N4CE]: Dynamic library target, Visual Studio 17 2022 generator, MSVC v143 toolset",
"description": "Configure as dynamic library with Visual Studio 17 2022 generator and MSVC v143 toolset",
"generator": "Visual Studio 17 2022",
"toolset": "v143"
}
],
"buildPresets": [
{
Expand Down
3 changes: 2 additions & 1 deletion include/nbl/application_templates/MonoDeviceApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class MonoDeviceApplication : public virtual MonoSystemMonoLoggerApplication
virtual bool onAppTerminated() override
{
// break the circular references from queues tracking submit resources
m_device->waitIdle();
if (m_device)
m_device->waitIdle();
m_device = nullptr;
m_api = nullptr;
return base_t::onAppTerminated();
Expand Down
18 changes: 6 additions & 12 deletions include/nbl/asset/utils/IShaderCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

#include "nbl/asset/IShader.h"
#include "nbl/asset/utils/ISPIRVOptimizer.h"

// Less leakage than "nlohmann/json.hpp" only forward declarations
#include "nlohmann/json_fwd.hpp"
#include "nbl/system/json.h"

#include "nbl/builtin/hlsl/enums.hlsl"

Expand Down Expand Up @@ -111,11 +109,10 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
//
struct SMacroDefinition
{
friend void to_json(nlohmann::json&, const SMacroDefinition&);
friend void from_json(const nlohmann::json&, SMacroDefinition&);

std::string_view identifier;
std::string_view definition;

friend struct system::json::adl_serializer<SMacroDefinition>;
};

//
Expand Down Expand Up @@ -216,9 +213,8 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
inline SPreprocessingDependency() {}

private:
friend void to_json(nlohmann::json& j, const SEntry::SPreprocessingDependency& dependency);
friend void from_json(const nlohmann::json& j, SEntry::SPreprocessingDependency& dependency);
friend class CCache;
friend struct system::json::adl_serializer<SEntry::SPreprocessingDependency>;

// path or identifier
system::path requestingSourceDir = "";
Expand Down Expand Up @@ -252,8 +248,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
friend class SCompilerArgs;
friend class SEntry;
friend class CCache;
friend void to_json(nlohmann::json&, const SPreprocessorArgs&);
friend void from_json(const nlohmann::json&, SPreprocessorArgs&);
friend struct system::json::adl_serializer<SPreprocessorArgs>;

// Default constructor needed for json serialization of SCompilerArgs
SPreprocessorArgs() {};
Expand Down Expand Up @@ -295,8 +290,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
private:
friend class SEntry;
friend class CCache;
friend void to_json(nlohmann::json&, const SCompilerArgs&);
friend void from_json(const nlohmann::json&, SCompilerArgs&);
friend struct system::json::adl_serializer<SCompilerArgs>;

// Default constructor needed for json serialization of SEntry
SCompilerArgs() {}
Expand Down
4 changes: 2 additions & 2 deletions include/nbl/builtin/hlsl/ieee754.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ struct flipSignIfRHSNegative_helper<Vectorial NBL_PARTIAL_REQ_BOT(concepts::Floa
};
}

template <typename T, typename U>
NBL_CONSTEXPR_INLINE_FUNC T flipSign(T val, U flip)
template <typename T, typename U = bool>
NBL_CONSTEXPR_INLINE_FUNC T flipSign(T val, U flip = true)
{
return impl::flipSign_helper<T, U>::__call(val, flip);
}
Expand Down
15 changes: 15 additions & 0 deletions include/nbl/system/json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef _NBL_SYSTEM_JSON_H_INCLUDED_
#define _NBL_SYSTEM_JSON_H_INCLUDED_

namespace nbl::system::json {
template<typename T, typename SFINAE = void> struct adl_serializer;
}

#define NBL_JSON_IMPL_BIND_ADL_SERIALIZER(T) \
namespace nlohmann { \
template<> \
struct adl_serializer<typename T::value_t> \
: T {}; \
}

#endif // _NBL_SYSTEM_JSON_H_INCLUDED_
1 change: 1 addition & 0 deletions include/nbl/video/ILogicalDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
asset::IShaderCompiler::CCache* writeCache = nullptr;
std::span<const asset::IShaderCompiler::SMacroDefinition> extraDefines = {};
hlsl::ShaderStage stage = hlsl::ShaderStage::ESS_ALL_OR_LIBRARY;
core::bitflag<asset::IShaderCompiler::E_DEBUG_INFO_FLAGS> debugInfoFlags = asset::IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_NONE;
};
core::smart_refctd_ptr<asset::IShader> compileShader(const SShaderCreationParameters& creationParams);

Expand Down
18 changes: 16 additions & 2 deletions include/nbl/video/utilities/IUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
, m_allocationAlignment(allocationAlignment)
, m_allocationAlignmentForBufferImageCopy(allocationAlignmentForBufferImageCopy)
{
m_defaultDownloadBuffer->getBuffer()->setObjectDebugName(("Default Download Buffer of Utilities "+std::to_string(ptrdiff_t(this))).c_str());
m_defaultUploadBuffer->getBuffer()->setObjectDebugName(("Default Upload Buffer of Utilities "+std::to_string(ptrdiff_t(this))).c_str());
if (m_defaultDownloadBuffer)
m_defaultDownloadBuffer->getBuffer()->setObjectDebugName(("Default Download Buffer of Utilities "+std::to_string(ptrdiff_t(this))).c_str());
if (m_defaultUploadBuffer)
m_defaultUploadBuffer->getBuffer()->setObjectDebugName(("Default Upload Buffer of Utilities "+std::to_string(ptrdiff_t(this))).c_str());
}

IUtilities() = delete;
Expand Down Expand Up @@ -94,6 +96,7 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
core::smart_refctd_ptr<StreamingTransientDataBufferMT<> > defaultDownloadBuffer = nullptr;

// Try Create Download Buffer
if (downstreamSize > 0u)
{
IGPUBuffer::SCreationParams streamingBufferCreationParams = {};
streamingBufferCreationParams.size = downstreamSize;
Expand Down Expand Up @@ -127,6 +130,7 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
defaultDownloadBuffer = core::make_smart_refctd_ptr<StreamingTransientDataBufferMT<>>(asset::SBufferRange<video::IGPUBuffer>{0ull,downstreamSize,std::move(buffer)},maxStreamingBufferAllocationAlignment,minStreamingBufferAllocationSize);
}
// Try Create Upload Buffer
if (upstreamSize > 0u)
{
IGPUBuffer::SCreationParams streamingBufferCreationParams = {};
streamingBufferCreationParams.size = upstreamSize;
Expand Down Expand Up @@ -374,6 +378,11 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
//! * data must not be nullptr
inline bool updateBufferRangeViaStagingBuffer(SIntendedSubmitInfo& nextSubmit, const asset::SBufferRange<IGPUBuffer>& bufferRange, IUpstreamingDataProducer& callback)
{
if (!m_defaultUploadBuffer)
{
m_logger.log("no staging buffer available for upload. check `upstreamSize` passed to `IUtilities::create`",system::ILogger::ELL_ERROR);
return false;
}
if (!bufferRange.isValid() || !bufferRange.buffer->getCreationParams().usage.hasFlags(asset::IBuffer::EUF_TRANSFER_DST_BIT))
{
m_logger.log("Invalid `bufferRange` or buffer has no `EUF_TRANSFER_DST_BIT` usage flag, cannot `updateBufferRangeViaStagingBuffer`!", system::ILogger::ELL_ERROR);
Expand Down Expand Up @@ -623,6 +632,11 @@ class NBL_API2 IUtilities : public core::IReferenceCounted
template<typename IntendedSubmitInfo> requires std::is_same_v<std::decay_t<IntendedSubmitInfo>, SIntendedSubmitInfo>
inline bool downloadBufferRangeViaStagingBuffer(const std::function<data_consumption_callback_t>& consumeCallback, IntendedSubmitInfo&& nextSubmit, const asset::SBufferRange<IGPUBuffer>& srcBufferRange)
{
if (!m_defaultDownloadBuffer)
{
m_logger.log("no staging buffer available for download. check `downstreamSize` passed to `IUtilities::create`",system::ILogger::ELL_ERROR);
return false;
}
if (!srcBufferRange.isValid() || !srcBufferRange.buffer->getCreationParams().usage.hasFlags(asset::IBuffer::EUF_TRANSFER_SRC_BIT))
{
m_logger.log("Invalid `srcBufferRange` or buffer has no `EUF_TRANSFER_SRC_BIT` usage flag, cannot `downloadBufferRangeViaStagingBuffer`!",system::ILogger::ELL_ERROR);
Expand Down
1 change: 1 addition & 0 deletions smoke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ find_package(Nabla REQUIRED CONFIG

add_executable(smoke main.cpp pch.hpp cdb.ps1)
target_link_libraries(smoke PRIVATE Nabla::Nabla)
target_compile_definitions(smoke PRIVATE _AFXDLL)
target_precompile_headers(smoke PRIVATE pch.hpp)

set(CMAKE_CTEST_ARGUMENTS --verbose)
Expand Down
67 changes: 55 additions & 12 deletions smoke/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <afxwin.h>

#define ENABLE_SMOKE

using namespace nbl;
Expand Down Expand Up @@ -36,45 +38,86 @@ class Smoke final : public system::IApplicationFramework
return false;
}

exportGpuProfiles();
if (!AfxWinInit(GetModuleHandle(nullptr), nullptr, GetCommandLineA(), 0))
{
std::cerr << "[ERROR]: Could not init AFX, terminating!\n";
return false;
}

try {
createAfxDummyWindow(320, 240, nullptr, _T("Dummy 1"));
exportGpuProfiles();
createAfxDummyWindow(320, 240, nullptr, _T("Dummy 2"));
}
catch (const std::exception& e) {
std::cerr << "[ERROR]: " << e.what() << '\n';
return false;
}
catch (...) {
std::cerr << "[ERROR]: Unknown exception!\n";
return false;
}

return true;
}

void workLoopBody() override {}
bool keepRunning() override { return false; }

bool onAppTerminated() override
{
AfxWinTerm();
return true;
}

private:
static void exportGpuProfiles()
{
std::string arg2 = "-o";
std::string buf;
std::string arg1;
std::string arg3;
std::string buf, arg1, arg2 = "-o", arg3;

for (size_t i = 0;; i++)
{
auto stringifiedIndex = std::to_string(i);
arg1 = "--json=" + stringifiedIndex;
arg3 = "device_" + stringifiedIndex + ".json";
std::array<const char*, 3> args = { arg1.data(), arg2.data(), arg3.data() };
auto six = std::to_string(i);
arg1 = "--json=" + six;
arg3 = "device_" + six + ".json";

auto args = std::to_array<const char*>({ arg1.data(), arg2.data(), arg3.data()});
int code = nbl::video::vulkaninfo(args);

if (code != 0)
break;

// print out file content
std::ifstream input(arg3);

while (std::getline(input, buf))
{
std::cout << buf << "\n";
}

std::cout << "\n\n";
}
}

static bool createAfxDummyWindow(int w, int h, HWND parent, LPCTSTR windowName)
{
CWnd wnd;
LPCTSTR cls = AfxRegisterWndClass(0, ::LoadCursor(nullptr, IDC_ARROW));
if (!cls) return false;

if (!wnd.CreateEx(0, cls, windowName, WS_POPUP | WS_VISIBLE, 0, 0, w, h, parent, nullptr))
return false;

MSG msg {};
const ULONGLONG end = GetTickCount64() + 1000;
while (GetTickCount64() < end) {
while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(1);
}

wnd.DestroyWindow();
return true;
}
};

NBL_MAIN_FUNC(Smoke)
Expand Down
Loading
Loading