Skip to content

Commit

Permalink
IGL: Remove custom asserts from render sessions
Browse files Browse the repository at this point in the history
Reviewed By: corporateshark

Differential Revision: D63849438

fbshipit-source-id: 618b34674238b5bcf9bd3aa257c6547d29025f2f
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Oct 3, 2024
1 parent b9e357d commit cfdb61d
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions shell/renderSessions/BasicFramebufferSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,13 @@
#include <shell/shared/platform/Platform.h>
#include <shell/shared/renderSession/ShellParams.h>

// ===============================================================
// Mock gtest symbols
// ===============================================================

#if defined(IGL_PLATFORM_UWP)
#define IGL_ASSERT(x)
#endif
// TODO: Only use these definitions when debugging a test
#define ASSERT_TRUE(A) IGL_ASSERT((A))
#define ASSERT_FALSE(A) IGL_ASSERT(!(A))
#define ASSERT_EQ(A, B) IGL_ASSERT((A) == (B))
#define ASSERT_NE(A, B) IGL_ASSERT((A) != (B))
#define ASSERT_LT(A, B) IGL_ASSERT((A) < (B))
#define ASSERT_GT(A, B) IGL_ASSERT((A) > (B))
#define ASSERT_ANY_THROW(expr) \
do { \
try { \
expr; \
IGL_ASSERT(false); \
} catch (...) { \
IGL_ASSERT(true); \
} \
} while (0)

namespace igl::shell {

void BasicFramebufferSession::initialize() noexcept {
// Create commandQueue
const igl::CommandQueueDesc desc{igl::CommandQueueType::Graphics};
commandQueue_ = getPlatform().getDevice().createCommandQueue(desc, nullptr);
ASSERT_TRUE(commandQueue_ != nullptr);
IGL_ASSERT(commandQueue_ != nullptr);

// Initialize render pass
renderPass_.colorAttachments.resize(1);
Expand All @@ -59,19 +35,19 @@ void BasicFramebufferSession::update(igl::SurfaceTextures surfaceTextures) noexc
igl::FramebufferDesc framebufferDesc;
framebufferDesc.colorAttachments[0].texture = surfaceTextures.color;
framebuffer_ = getPlatform().getDevice().createFramebuffer(framebufferDesc, &ret);
ASSERT_TRUE(ret.isOk());
ASSERT_TRUE(framebuffer_ != nullptr);
IGL_ASSERT(ret.isOk());
IGL_ASSERT(framebuffer_ != nullptr);
} else {
framebuffer_->updateDrawable(surfaceTextures.color);
}

// Create/submit command buffer
const igl::CommandBufferDesc cbDesc;
auto buffer = commandQueue_->createCommandBuffer(cbDesc, &ret);
ASSERT_TRUE(buffer != nullptr);
ASSERT_TRUE(ret.isOk());
IGL_ASSERT(buffer != nullptr);
IGL_ASSERT(ret.isOk());
auto commands = buffer->createRenderCommandEncoder(renderPass_, framebuffer_);
ASSERT_TRUE(commands != nullptr);
IGL_ASSERT(commands != nullptr);
commands->endEncoding();
IGL_ASSERT(commandQueue_ != nullptr);
if (shellParams().shouldPresent) {
Expand Down

0 comments on commit cfdb61d

Please sign in to comment.