You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
remove SIntendedSubmitInfo from UI::render, we cannot overflow while recording non-dynamic renderpass - bring back command buffer + add semaphore wait info for deferred memory deallocation, clean more code, add comments regarding linear allocator TODO, update examples_tests submodule
@@ -59,7 +61,7 @@ class UI final : public core::IReferenceCounted
59
61
//! what we pass to ImGuiIO::AddMousePosEvent
60
62
nbl::hlsl::float32_t2 mousePosition,
61
63
62
-
//! main display size in pixels (generally == GetMainViewport()->Size)
64
+
//! main display size in pixels
63
65
displaySize;
64
66
65
67
//! Nabla events you want to be handled with the backend
@@ -75,14 +77,14 @@ class UI final : public core::IReferenceCounted
75
77
UI(S_CREATION_PARAMETERS&& params);
76
78
~UI() override;
77
79
78
-
//! Nabla ImGUI backend reserves this index for font atlas, any attempt to hook user defined texture within the index will cause runtime error [TODO: could have a setter & getter to control the default & currently hooked font texture ID and init 0u by default]
//! Nabla ImGUI backend reserves this index for font atlas, any attempt to hook user defined texture within the index will result in undefined behaviour
81
+
staticconstexprauto NBL_FONT_ATLAS_TEX_ID = 0u;
80
82
81
-
//! update ImGuiIO & record ImGUI *cpu* draw command lists, call it before .render
83
+
//! updates ImGuiIO & records ImGUI *cpu* draw command lists, you have to call it before .render
82
84
boolupdate(const S_UPDATE_PARAMETERS& params);
83
85
84
-
//! updates mapped mdi buffer & records *gpu* draw commands, handles overflows for mdi allocation failure cases (pop & submit)
auto allocation = m_creationParams.utilities->getLogicalDevice()->allocate(memoryReqs, buffer.get(), requiredAllocateFlags);
833
+
auto allocation = m_creationParams.utilities->getLogicalDevice()->allocate(memoryReqs, buffer.get(), MDI::MDI_BUFFER_REQUIRED_ALLOCATE_FLAGS);
836
834
{
837
835
constbool allocated = allocation.isValid();
838
836
assert(allocated);
@@ -851,9 +849,9 @@ namespace nbl::ext::imgui
851
849
852
850
constauto validation = std::to_array
853
851
({
854
-
std::make_pair(buffer->getCreationParams().usage.hasFlags(requiredUsageFlags), "MDI buffer must be created with IBuffer::EUF_INDIRECT_BUFFER_BIT | IBuffer::EUF_INDEX_BUFFER_BIT | IBuffer::EUF_VERTEX_BUFFER_BIT | IBuffer::EUF_SHADER_DEVICE_ADDRESS_BIT enabled!"),
852
+
std::make_pair(buffer->getCreationParams().usage.hasFlags(MDI::MDI_BUFFER_REQUIRED_USAGE_FLAGS), "MDI buffer must be created with IBuffer::EUF_INDIRECT_BUFFER_BIT | IBuffer::EUF_INDEX_BUFFER_BIT | IBuffer::EUF_VERTEX_BUFFER_BIT | IBuffer::EUF_SHADER_DEVICE_ADDRESS_BIT enabled!"),
855
853
std::make_pair(bool(buffer->getMemoryReqs().memoryTypeBits & m_creationParams.utilities->getLogicalDevice()->getPhysicalDevice()->getUpStreamingMemoryTypeBits()), "MDI buffer must have up-streaming memory type bits enabled!"),
856
-
std::make_pair(binding.memory->getAllocateFlags().hasFlags(requiredAllocateFlags), "MDI buffer's memory must be allocated with IDeviceMemoryAllocation::EMAF_DEVICE_ADDRESS_BIT enabled!"),
854
+
std::make_pair(binding.memory->getAllocateFlags().hasFlags(MDI::MDI_BUFFER_REQUIRED_ALLOCATE_FLAGS), "MDI buffer's memory must be allocated with IDeviceMemoryAllocation::EMAF_DEVICE_ADDRESS_BIT enabled!"),
857
855
std::make_pair(binding.memory->isCurrentlyMapped(), "MDI buffer's memory must be mapped!"), // streaming buffer contructor already validates it, but cannot assume user won't unmap its own buffer for some reason (sorry if you have just hit it)
ImGui::Render(); // note it doesn't touch GPU or graphics API at all, its an internal ImGUI call to update & prepare the data for rendering so we can call GetDrawData()
875
+
if (commandBuffer->getState() != IGPUCommandBuffer::STATE::RECORDING)
876
+
{
877
+
m_creationParams.utilities->getLogger()->log("Command buffer is not in recording state!", system::ILogger::ELL_ERROR);
ImGui::Render(); // note it doesn't touch GPU or graphics API at all, its an internal ImGUI call to update & prepare the data for rendering so we can call GetDrawData()
880
882
881
883
ImGuiIO& io = ImGui::GetIO();
882
884
@@ -983,9 +985,13 @@ namespace nbl::ext::imgui
983
985
// calculate upper bound byte size limit for mdi buffer
TODO: use linear allocator instead, we could try to fill our tightly packed mdi buffer in a loop if full big request is impossible with single allocation call
990
+
*/
991
+
986
992
auto mdiBuffer = smart_refctd_ptr<IGPUBuffer>(m_mdi.streamingTDBufferST->getBuffer());
// still no? then we will try suballocating smaller pieces of memory due to possible fragmentation issues & upstream in nice loop (if we get to a point when suballocation could not cover whole 1 sub draw call then we need to submit overflow & rerecord stuff + repeat)
998
-
// that's TODO but first a small test for not tightly packed index + vertex buffer
999
-
1000
1003
if (unallocatedSize != 0u)
1001
1004
{
1005
+
#ifdef NBL_IMPL_PRINT_DEBUG_ALLOC_RET_INFO
1002
1006
m_creationParams.utilities->getLogger()->log("Could not multi alloc mdi buffer!", system::ILogger::ELL_ERROR);
1003
1007
1004
1008
auto getOffsetStr = [&](const MDI::COMPOSE_T::value_type offset) -> std::string
m_mdi.streamingTDBufferST->multi_deallocate(MDI_ALLOCATION_COUNT, multiAllocParams.offsets.data(), multiAllocParams.byteSizes.data()); // fail, get rid of all requests instantly
0 commit comments