Skip to content

Commit

Permalink
Setting the igl assert to check the equivalent of isempty
Browse files Browse the repository at this point in the history
Summary: the original assert was checking for empty() which is not the same as just checking if it's a null pointer.

Differential Revision: D50691968

fbshipit-source-id: 75839ee5334671cdc00d1b2e9562e11083890c2d
  • Loading branch information
francoiscoulombe authored and facebook-github-bot committed Oct 26, 2023
1 parent 2d34246 commit a1460d6
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/igl/metal/CommandBuffer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

void CommandBuffer::pushDebugGroupLabel(const char* label, const igl::Color& /*color*/) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
[value_ pushDebugGroup:[NSString stringWithUTF8String:label] ?: @""];
}

Expand Down
4 changes: 2 additions & 2 deletions src/igl/metal/ComputeCommandEncoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
void ComputeCommandEncoder::pushDebugGroupLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(encoder_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
[encoder_ pushDebugGroup:[NSString stringWithUTF8String:label] ?: @""];
}

void ComputeCommandEncoder::insertDebugEventLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(encoder_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
[encoder_ insertDebugSignpost:[NSString stringWithUTF8String:label] ?: @""];
}

Expand Down
4 changes: 2 additions & 2 deletions src/igl/metal/RenderCommandEncoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@
void RenderCommandEncoder::pushDebugGroupLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(encoder_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
[encoder_ pushDebugGroup:[NSString stringWithUTF8String:label] ?: @""];
}

void RenderCommandEncoder::insertDebugEventLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(encoder_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
[encoder_ insertDebugSignpost:[NSString stringWithUTF8String:label] ?: @""];
}

Expand Down
2 changes: 1 addition & 1 deletion src/igl/opengl/CommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void CommandBuffer::waitUntilCompleted() {
}

void CommandBuffer::pushDebugGroupLabel(const char* label, const igl::Color& /*color*/) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
if (getContext().deviceFeatures().hasInternalFeature(InternalFeatures::DebugMessage)) {
std::string_view labelSV(label);
getContext().pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, labelSV.length(), labelSV.data());
Expand Down
4 changes: 2 additions & 2 deletions src/igl/opengl/ComputeCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void ComputeCommandEncoder::dispatchThreadGroups(const Dimensions& threadgroupCo

void ComputeCommandEncoder::pushDebugGroupLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
if (getContext().deviceFeatures().hasInternalFeature(InternalFeatures::DebugMessage)) {
std::string_view labelSV(label);
getContext().pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, labelSV.length(), labelSV.data());
Expand All @@ -74,7 +74,7 @@ void ComputeCommandEncoder::pushDebugGroupLabel(const char* label,

void ComputeCommandEncoder::insertDebugEventLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
if (getContext().deviceFeatures().hasInternalFeature(InternalFeatures::DebugMessage)) {
std::string_view labelSV(label);
getContext().debugMessageInsert(GL_DEBUG_SOURCE_APPLICATION,
Expand Down
4 changes: 2 additions & 2 deletions src/igl/opengl/RenderCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void RenderCommandEncoder::endEncoding() {
void RenderCommandEncoder::pushDebugGroupLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(adapter_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
if (getContext().deviceFeatures().hasInternalFeature(InternalFeatures::DebugMessage)) {
std::string_view labelSV(label);
getContext().pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, labelSV.length(), labelSV.data());
Expand All @@ -170,7 +170,7 @@ void RenderCommandEncoder::pushDebugGroupLabel(const char* label,
void RenderCommandEncoder::insertDebugEventLabel(const char* label,
const igl::Color& /*color*/) const {
IGL_ASSERT(adapter_);
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
if (getContext().deviceFeatures().hasInternalFeature(InternalFeatures::DebugMessage)) {
std::string_view labelSV(label);
getContext().debugMessageInsert(GL_DEBUG_SOURCE_APPLICATION,
Expand Down
2 changes: 1 addition & 1 deletion src/igl/vulkan/CommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void CommandBuffer::present(std::shared_ptr<ITexture> surface) const {
}

void CommandBuffer::pushDebugGroupLabel(const char* label, const igl::Color& color) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
ivkCmdBeginDebugUtilsLabel(&ctx_.vf_, wrapper_.cmdBuf_, label, color.toFloatPtr());
}

Expand Down
4 changes: 2 additions & 2 deletions src/igl/vulkan/ComputeCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ void ComputeCommandEncoder::dispatchThreadGroups(const Dimensions& threadgroupCo
}

void ComputeCommandEncoder::pushDebugGroupLabel(const char* label, const igl::Color& color) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
ivkCmdBeginDebugUtilsLabel(&ctx_.vf_, cmdBuffer_, label, color.toFloatPtr());
}

void ComputeCommandEncoder::insertDebugEventLabel(const char* label,
const igl::Color& color) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
ivkCmdInsertDebugUtilsLabel(&ctx_.vf_, cmdBuffer_, label, color.toFloatPtr());
}

Expand Down
4 changes: 2 additions & 2 deletions src/igl/vulkan/RenderCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,12 @@ void RenderCommandEncoder::endEncoding() {
}

void RenderCommandEncoder::pushDebugGroupLabel(const char* label, const igl::Color& color) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
ivkCmdBeginDebugUtilsLabel(&ctx_.vf_, cmdBuffer_, label, color.toFloatPtr());
}

void RenderCommandEncoder::insertDebugEventLabel(const char* label, const igl::Color& color) const {
IGL_ASSERT(label != nullptr);
IGL_ASSERT(label != nullptr && *label);
ivkCmdInsertDebugUtilsLabel(&ctx_.vf_, cmdBuffer_, label, color.toFloatPtr());
}

Expand Down

0 comments on commit a1460d6

Please sign in to comment.