Skip to content

Commit

Permalink
Migrate to use shared ptr to assert the command buffer surviving up t…
Browse files Browse the repository at this point in the history
…o whenever the lambda scope guard gets called

Summary: ^

Reviewed By: EricGriffith

Differential Revision: D50603128

fbshipit-source-id: 4f1ab51db235f3b0b40727004007ce92ef31e0e8
  • Loading branch information
francoiscoulombe authored and facebook-github-bot committed Oct 26, 2023
1 parent 31e22a0 commit 2d34246
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions samples/ios/snapshot_test_support/IGLSnapshotTestCase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ - (void)render {
renderPass.colorAttachments[0].clearColor = {1.0, 1.0, 1.0, 1.0};

auto cmds = commandBuffer->createRenderCommandEncoder(renderPass, _framebuffer);
IGL_DEBUG_BUFFER_LABEL_START(*commandBuffer, "draw renderable");
IGL_DEBUG_BUFFER_LABEL_START(commandBuffer, "draw renderable");
_renderable->submit(*cmds);
IGL_DEBUG_BUFFER_LABEL_END(*commandBuffer);
IGL_DEBUG_BUFFER_LABEL_END(commandBuffer);
cmds->endEncoding();

_commandQueue->submit(*commandBuffer); // Guarantees ordering between command buffers
Expand Down
6 changes: 3 additions & 3 deletions src/igl/CommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class ICommandBuffer {
} // namespace igl

#if IGL_DEBUG && !defined(IGL_DISABLE_DEBUG_BUFFER_LABEL)
#define IGL_DEBUG_BUFFER_LABEL_START(buffer, x) (buffer).pushDebugGroupLabel(x)
#define IGL_DEBUG_BUFFER_LABEL_END(buffer) (buffer).popDebugGroupLabel()
#define IGL_DEBUG_BUFFER_LABEL_START(buffer, x) (buffer)->pushDebugGroupLabel(x);
#define IGL_DEBUG_BUFFER_LABEL_END(buffer) (buffer)->popDebugGroupLabel()
#define IGL_DEBUG_BUFFER_LABEL_START_GUARD(buffer, x) \
IGL_DEBUG_BUFFER_LABEL_START(buffer, x); \
auto popDebugGroupLabelScope = \
folly::makeGuard([&cmdBuffer = (buffer)]() { IGL_DEBUG_BUFFER_LABEL_END(cmdBuffer); });
folly::makeGuard([cmdBuffer = (buffer)]() { IGL_DEBUG_BUFFER_LABEL_END(cmdBuffer); });
#else
#define IGL_DEBUG_BUFFER_LABEL_START(buffer, x)
#define IGL_DEBUG_BUFFER_LABEL_END(buffer)
Expand Down

0 comments on commit 2d34246

Please sign in to comment.