Skip to content

Commit 971a1ed

Browse files
Merge pull request #775 from Devsh-Graphics-Programming/ali_cbl
video: improve error logging in `IGPUCommandBuffer`
2 parents eebc9fe + 2675ce2 commit 971a1ed

File tree

2 files changed

+448
-51
lines changed

2 files changed

+448
-51
lines changed

include/nbl/video/IGPUCommandBuffer.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "nbl/video/IGPUCommandPool.h"
1212
#include "nbl/video/IQueue.h"
1313

14+
#include "git_info.h"
15+
#define NBL_LOG_FUNCTION m_logger.log
16+
#include "nbl/logging_macros.h"
17+
1418
// TODO: remove
1519
#define VK_NO_PROTOTYPES
1620
#include <vulkan/vulkan.h>
@@ -721,7 +725,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
721725
return true;
722726
if (!buffer->getCreationParams().usage.hasFlags(usages))
723727
{
724-
m_logger.log("Incorrect `IGPUBuffer` usage flags for the command!", system::ILogger::ELL_ERROR);
728+
NBL_LOG_ERROR("Incorrect `IGPUBuffer` usage flags for the command!");
725729
return true;
726730
}
727731
return false;
@@ -732,7 +736,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
732736
return true;
733737
if (binding.offset&(alignment-1))
734738
{
735-
m_logger.log("Offset %d not aligned to %d for the command!", system::ILogger::ELL_ERROR, binding.offset, alignment);
739+
NBL_LOG_ERROR("Offset %d not aligned to %d for the command!", binding.offset, alignment);
736740
return true;
737741
}
738742
return false;
@@ -742,17 +746,23 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
742746
if (invalidBufferBinding({range.offset,range.buffer},alignment,usages))
743747
return true;
744748
if ((range.size&(alignment-1)) && range.size!=asset::SBufferRange<IGPUBuffer>::WholeBuffer)
749+
{
750+
NBL_LOG_ERROR("Size %d not aligned to %d for the command!", range.size, alignment);
745751
return true;
752+
}
746753
return false;
747754
}
748755

749756
inline bool invalidImage(const IGPUImage* image, const IGPUImage::E_USAGE_FLAGS usages) const
750757
{
751758
if (!image || !this->isCompatibleDevicewise(image))
759+
{
760+
NBL_LOG_ERROR("invalid image!");
752761
return true;
762+
}
753763
if (!image->getCreationParameters().usage.hasFlags(usages))
754764
{
755-
m_logger.log("Incorrect `IGPUImage` usage flags for the command!", system::ILogger::ELL_ERROR);
765+
NBL_LOG_ERROR("Incorrect `IGPUImage` usage flags for the command!");
756766
return true;
757767
}
758768
return false;
@@ -767,14 +777,18 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
767777
case IGPUImage::LAYOUT::SHARED_PRESENT:
768778
break;
769779
default:
780+
NBL_LOG_ERROR("invalid destination image layout!");
770781
return true;
771782
}
772783
if (invalidImage(image,IGPUImage::EUF_TRANSFER_DST_BIT))
773784
return true;
774785
if constexpr (!clear)
775786
{
776787
if (image->getCreationParameters().samples!=IGPUImage::E_SAMPLE_COUNT_FLAGS::ESCF_1_BIT)
788+
{
789+
NBL_LOG_ERROR("destination image sample count must be 1!");
777790
return true;
791+
}
778792
}
779793
return false;
780794
}
@@ -787,6 +801,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
787801
case IGPUImage::LAYOUT::SHARED_PRESENT:
788802
break;
789803
default:
804+
NBL_LOG_ERROR("invalid source image layout!");
790805
return true;
791806
}
792807
return invalidImage(image,IGPUImage::EUF_TRANSFER_SRC_BIT);
@@ -847,4 +862,5 @@ extern template bool IGPUCommandBuffer::invalidDependency(const SDependencyInfo<
847862

848863
}
849864

865+
#include "nbl/undef_logging_macros.h"
850866
#endif

0 commit comments

Comments
 (0)