Skip to content

Commit

Permalink
Add unit tests for IContext::isCurrentSharegroup()
Browse files Browse the repository at this point in the history
Summary: This augments the test added in D49297661 to validate `Context::isCurrentContext()` and `Context::isCurrentSharegroup()`.

Reviewed By: EricGriffith

Differential Revision: D50542256

fbshipit-source-id: 748c6da5c713926d607716530e7725abdf8dd806
  • Loading branch information
Thiago Goulart authored and facebook-github-bot committed Oct 24, 2023
1 parent 20d51c4 commit 0b2884e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/igl/tests/ogl/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ TEST_F(ContextOGLTest, BasicSharedContexts) {

// Create texture from context (1)
context_->setCurrent();

ASSERT_TRUE(context_->isCurrentContext());
ASSERT_FALSE(sharedContext->isCurrentContext());
ASSERT_FALSE(unsharedContext->isCurrentContext());

ASSERT_TRUE(context_->isCurrentSharegroup());
ASSERT_TRUE(sharedContext->isCurrentSharegroup());
ASSERT_FALSE(unsharedContext->isCurrentSharegroup());

const igl::TextureDesc textureDesc = igl::TextureDesc::new2D(
igl::TextureFormat::RGBA_UNorm8, 16, 16, igl::TextureDesc::TextureUsageBits::Sampled);
auto texture = device_->createTexture(textureDesc, &result);
Expand All @@ -339,10 +348,28 @@ TEST_F(ContextOGLTest, BasicSharedContexts) {

// Confirm that texture is visible from context (2)
sharedContext->setCurrent();

ASSERT_FALSE(context_->isCurrentContext());
ASSERT_TRUE(sharedContext->isCurrentContext());
ASSERT_FALSE(unsharedContext->isCurrentContext());

ASSERT_TRUE(context_->isCurrentSharegroup());
ASSERT_TRUE(sharedContext->isCurrentSharegroup());
ASSERT_FALSE(unsharedContext->isCurrentSharegroup());

ASSERT_TRUE(sharedContext->isTexture(glTextureId));

// Confirm that texture is not visible from context (3)
unsharedContext->setCurrent();

ASSERT_FALSE(context_->isCurrentContext());
ASSERT_FALSE(sharedContext->isCurrentContext());
ASSERT_TRUE(unsharedContext->isCurrentContext());

ASSERT_FALSE(context_->isCurrentSharegroup());
ASSERT_FALSE(sharedContext->isCurrentSharegroup());
ASSERT_TRUE(unsharedContext->isCurrentSharegroup());

ASSERT_FALSE(unsharedContext->isTexture(glTextureId));
}

Expand Down

0 comments on commit 0b2884e

Please sign in to comment.