Skip to content

Commit 2675ce2

Browse files
committed
video: use NBL_LOG_ERROR in IGPUCommandBuffer.h
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
1 parent 8d5e0b0 commit 2675ce2

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

include/nbl/video/IGPUCommandBuffer.h

Lines changed: 13 additions & 8 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>
@@ -716,7 +720,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
716720
return true;
717721
if (!buffer->getCreationParams().usage.hasFlags(usages))
718722
{
719-
m_logger.log("Incorrect `IGPUBuffer` usage flags for the command!", system::ILogger::ELL_ERROR);
723+
NBL_LOG_ERROR("Incorrect `IGPUBuffer` usage flags for the command!");
720724
return true;
721725
}
722726
return false;
@@ -727,7 +731,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
727731
return true;
728732
if (binding.offset&(alignment-1))
729733
{
730-
m_logger.log("Offset %d not aligned to %d for the command!", system::ILogger::ELL_ERROR, binding.offset, alignment);
734+
NBL_LOG_ERROR("Offset %d not aligned to %d for the command!", binding.offset, alignment);
731735
return true;
732736
}
733737
return false;
@@ -738,7 +742,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
738742
return true;
739743
if ((range.size&(alignment-1)) && range.size!=asset::SBufferRange<IGPUBuffer>::WholeBuffer)
740744
{
741-
m_logger.log("Size %d not aligned to %d for the command!", system::ILogger::ELL_ERROR, range.size, alignment);
745+
NBL_LOG_ERROR("Size %d not aligned to %d for the command!", range.size, alignment);
742746
return true;
743747
}
744748
return false;
@@ -748,12 +752,12 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
748752
{
749753
if (!image || !this->isCompatibleDevicewise(image))
750754
{
751-
m_logger.log("invalid image!", system::ILogger::ELL_ERROR);
755+
NBL_LOG_ERROR("invalid image!");
752756
return true;
753757
}
754758
if (!image->getCreationParameters().usage.hasFlags(usages))
755759
{
756-
m_logger.log("Incorrect `IGPUImage` usage flags for the command!", system::ILogger::ELL_ERROR);
760+
NBL_LOG_ERROR("Incorrect `IGPUImage` usage flags for the command!");
757761
return true;
758762
}
759763
return false;
@@ -768,7 +772,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
768772
case IGPUImage::LAYOUT::SHARED_PRESENT:
769773
break;
770774
default:
771-
m_logger.log("invalid destination image layout!", system::ILogger::ELL_ERROR);
775+
NBL_LOG_ERROR("invalid destination image layout!");
772776
return true;
773777
}
774778
if (invalidImage(image,IGPUImage::EUF_TRANSFER_DST_BIT))
@@ -777,7 +781,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
777781
{
778782
if (image->getCreationParameters().samples!=IGPUImage::E_SAMPLE_COUNT_FLAGS::ESCF_1_BIT)
779783
{
780-
m_logger.log("destination image sample count must be 1!", system::ILogger::ELL_ERROR);
784+
NBL_LOG_ERROR("destination image sample count must be 1!");
781785
return true;
782786
}
783787
}
@@ -792,7 +796,7 @@ class NBL_API2 IGPUCommandBuffer : public IBackendObject
792796
case IGPUImage::LAYOUT::SHARED_PRESENT:
793797
break;
794798
default:
795-
m_logger.log("invalid source image layout!", system::ILogger::ELL_ERROR);
799+
NBL_LOG_ERROR("invalid source image layout!");
796800
return true;
797801
}
798802
return invalidImage(image,IGPUImage::EUF_TRANSFER_SRC_BIT);
@@ -853,4 +857,5 @@ extern template bool IGPUCommandBuffer::invalidDependency(const SDependencyInfo<
853857

854858
}
855859

860+
#include "nbl/undef_logging_macros.h"
856861
#endif

src/nbl/video/IGPUCommandBuffer.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,8 +1440,10 @@ bool IGPUCommandBuffer::clearAttachments(const SClearAttachments& info)
14401440
}
14411441
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdClearAttachments.html#VUID-vkCmdClearAttachments-aspectMask-07885
14421442
if (info.clearStencil && asset::isDepthOnlyFormat(depthStencilAttachment.format))
1443+
{
14431444
NBL_LOG_ERROR("depth only asset can't be cleared with the 'clearStencil' parameter!");
1444-
return false;
1445+
return false;
1446+
}
14451447
}
14461448
for (auto i=0; i<sizeof(info.clearColorMask)*8; i++)
14471449
{
@@ -1556,7 +1558,7 @@ bool IGPUCommandBuffer::drawIndirect(const asset::SBufferBinding<const IGPUBuffe
15561558
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CIndirectCmd>(m_commandList,core::smart_refctd_ptr<const IGPUBuffer>(binding.buffer)))
15571559
{
15581560
NBL_LOG_ERROR("out of host memory!");
1559-
return true;
1561+
return false;
15601562
}
15611563

15621564
m_noCommands = false;
@@ -1571,7 +1573,7 @@ bool IGPUCommandBuffer::drawIndexedIndirect(const asset::SBufferBinding<const IG
15711573
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CIndirectCmd>(m_commandList, core::smart_refctd_ptr<const IGPUBuffer>(binding.buffer)))
15721574
{
15731575
NBL_LOG_ERROR("out of host memory!");
1574-
return true;
1576+
return false;
15751577
}
15761578

15771579
m_noCommands = false;
@@ -1586,7 +1588,7 @@ bool IGPUCommandBuffer::drawIndirectCount(const asset::SBufferBinding<const IGPU
15861588
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CDrawIndirectCountCmd>(m_commandList, core::smart_refctd_ptr<const IGPUBuffer>(indirectBinding.buffer), core::smart_refctd_ptr<const IGPUBuffer>(countBinding.buffer)))
15871589
{
15881590
NBL_LOG_ERROR("out of host memory!");
1589-
return true;
1591+
return false;
15901592
}
15911593

15921594
m_noCommands = false;
@@ -1601,7 +1603,7 @@ bool IGPUCommandBuffer::drawIndexedIndirectCount(const asset::SBufferBinding<con
16011603
if (!m_cmdpool->m_commandListPool.emplace<IGPUCommandPool::CDrawIndirectCountCmd>(m_commandList, core::smart_refctd_ptr<const IGPUBuffer>(indirectBinding.buffer), core::smart_refctd_ptr<const IGPUBuffer>(countBinding.buffer)))
16021604
{
16031605
NBL_LOG_ERROR("out of host memory!");
1604-
return true;
1606+
return false;
16051607
}
16061608

16071609
m_noCommands = false;

0 commit comments

Comments
 (0)