Skip to content

Commit c77e79a

Browse files
Michael Murraymeta-codesync[bot]
authored andcommitted
igl | Complete the manifest validator against the migrated corpus: coverage, layout and reader-seam gates
Differential Revision: D115582468 fbshipit-source-id: 04930ea2132c2b4c60cb160eab854ce142cc9452
1 parent 9bd88f8 commit c77e79a

9 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/igl/tests/Blending.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ TEST_F(BlendingTest, RGBASrcAndDstAddTest) {
262262
//----------------------
263263
// Read back framebuffer
264264
//----------------------
265+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
266+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(OFFSCREEN_TEX_WIDTH));
267+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(OFFSCREEN_TEX_HEIGHT));
268+
265269
auto pixels = std::vector<uint32_t>(OFFSCREEN_TEX_WIDTH * OFFSCREEN_TEX_HEIGHT);
266270

267271
framebuffer_->copyBytesColorAttachment(*cmdQueue_, 0, pixels.data(), rangeDesc_);

src/igl/tests/Framebuffer.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ TEST_F(FramebufferTest, Clear) {
265265
//----------------------
266266
// Read back framebuffer
267267
//----------------------
268+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
269+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(kOffscreenRtWidth));
270+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(kOffscreenRtHeight));
271+
268272
auto pixels = std::vector<uint32_t>(kOffscreenRtWidth * kOffscreenRtWidth);
269273
auto pixelsDepth = std::vector<float>(kOffscreenRtWidth * kOffscreenRtWidth);
270274
auto pixelsStencil = std::vector<uint8_t>(kOffscreenRtWidth * kOffscreenRtWidth);
@@ -444,6 +448,14 @@ TEST_F(FramebufferTest, blitFramebufferColor) {
444448
//----------------------
445449
// Read back framebuffer
446450
//----------------------
451+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
452+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(kOffscreenRtWidth));
453+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(kOffscreenRtHeight));
454+
455+
const auto dimensions2 = framebuffer2->getColorAttachment(0)->getDimensions();
456+
ASSERT_EQ(dimensions2.width, static_cast<uint32_t>(kOffscreenRtWidth));
457+
ASSERT_EQ(dimensions2.height, static_cast<uint32_t>(kOffscreenRtHeight));
458+
447459
auto pixels = std::vector<uint32_t>(kOffscreenRtWidth * kOffscreenRtWidth);
448460

449461
framebuffer_->copyBytesColorAttachment(*cmdQueue_, 0, pixels.data(), rangeDesc);
@@ -696,6 +708,10 @@ TEST_F(FramebufferTest, GetColorAttachmentTest) {
696708
//----------------------
697709
// Read back framebuffer
698710
//----------------------
711+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
712+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(textureWidth));
713+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(textureHeight));
714+
699715
const int outputImageWidth = textureWidth + 2;
700716
const int outputImageHeight = textureHeight;
701717
const int outputElementPerRow = outputImageWidth * channelCount;

src/igl/tests/Multiview.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ TEST_F(MultiviewTest, SinglePassStereo) {
307307
//----------------------
308308
// Read back framebuffer
309309
//----------------------
310+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
311+
EXPECT_EQ(dimensions.width, static_cast<uint32_t>(kOffScreenWidth));
312+
EXPECT_EQ(dimensions.height, static_cast<uint32_t>(kOffScreenHeight));
313+
310314
auto pixels = std::vector<uint32_t>(kOffScreenWidth * kOffScreenHeight);
311315
auto rangeDesc = TextureRangeDesc::new2D(0, 0, kOffScreenWidth, kOffScreenHeight);
312316

src/igl/tests/RenderCommandEncoder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ class RenderCommandEncoderTest : public ::testing::Test {
260260
}
261261

262262
void verifyFrameBuffer(const std::vector<uint32_t>& expectedPixels) {
263+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
264+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(OFFSCREEN_RT_WIDTH));
265+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(OFFSCREEN_RT_HEIGHT));
266+
263267
auto pixels =
264268
std::vector<uint32_t>(static_cast<size_t>(OFFSCREEN_RT_WIDTH * OFFSCREEN_RT_WIDTH));
265269
framebuffer_->copyBytesColorAttachment(

src/igl/tests/Texture.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ constexpr std::array<std::pair<const void*, uint32_t>, 4> kPixelAlignments = {
369369
TEST_F(TextureTest, RepackData) {
370370
const auto properties = TextureFormatProperties::fromTextureFormat(TextureFormat::RGBA_UNorm8);
371371
const auto range = TextureRangeDesc::new2D(0, 0, kAlignedPixelsWidth, kAlignedPixelsHeight);
372+
EXPECT_EQ(range.width, kAlignedPixelsWidth);
373+
EXPECT_EQ(range.height, kAlignedPixelsHeight);
372374

373375
for (const auto& [data, bytesPerRow] : kPixelAlignments) {
374376
const size_t alignedSize =

src/igl/tests/iglu/TextureAccessor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ class TextureAccessorTest : public ::testing::Test {
7575
// Tests synchronous texture readback
7676
//
7777
TEST_F(TextureAccessorTest, testRequestAndGetBytesSync) {
78+
const auto dimensions = texture_->getDimensions();
79+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(OFFSCREEN_TEX_WIDTH));
80+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(OFFSCREEN_TEX_HEIGHT));
81+
7882
ASSERT_NO_THROW(textureAccessor_ =
7983
iglu::textureaccessor::TextureAccessorFactory::createTextureAccessor(
8084
iglDev_->getBackendType(), texture_, *iglDev_));
@@ -102,6 +106,10 @@ TEST_F(TextureAccessorTest, testRequestAndGetBytesSync) {
102106
}
103107

104108
TEST_F(TextureAccessorTest, reuseTextureAccessor) {
109+
const auto dimensions = texture_->getDimensions();
110+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(OFFSCREEN_TEX_WIDTH));
111+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(OFFSCREEN_TEX_HEIGHT));
112+
105113
ASSERT_NO_THROW(textureAccessor_ =
106114
iglu::textureaccessor::TextureAccessorFactory::createTextureAccessor(
107115
iglDev_->getBackendType(), texture_, *iglDev_));

src/igl/tests/iglu/TextureAccessorDesignatedInit.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ TEST_F(TextureAccessorDesignatedInitTest, DesignatedInitMatchesFieldByField) {
132132
// verify pixel data matches what was uploaded.
133133
//
134134
TEST_F(TextureAccessorDesignatedInitTest, TextureAccessorReadbackWithDesignatedInit) {
135+
const auto dimensions = texture_->getDimensions();
136+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(OFFSCREEN_TEX_WIDTH));
137+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(OFFSCREEN_TEX_HEIGHT));
138+
135139
auto textureAccessor = iglu::textureaccessor::TextureAccessorFactory::createTextureAccessor(
136140
iglDev_->getBackendType(), texture_, *iglDev_);
137141
ASSERT_TRUE(textureAccessor != nullptr);

src/igl/tests/metal/RenderPass.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ void TearDown() override {}
175175
commandBuffer_->waitUntilCompleted();
176176

177177
// Read back and verify the clear color
178+
const auto dimensions = framebuffer->getColorAttachment(0)->getDimensions();
179+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(RP_TEX_WIDTH));
180+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(RP_TEX_HEIGHT));
181+
178182
const size_t bytesPerPixel = 4; // RGBA_UNorm8
179183
const size_t rowBytes = RP_TEX_WIDTH * bytesPerPixel;
180184
std::vector<uint8_t> pixels(RP_TEX_WIDTH * RP_TEX_HEIGHT * bytesPerPixel);

src/igl/tests/ogl/UniformBuffer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,10 @@ TEST_F(UniformBufferTest, UniformBufferBinding) {
766766
//----------------------
767767
// Read back framebuffer
768768
//----------------------
769+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
770+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(kOffscreenTexWidth));
771+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(kOffscreenTexHeight));
772+
769773
auto pixels = std::vector<uint32_t>(kOffscreenTexWidth * kOffscreenTexHeight);
770774

771775
framebuffer_->copyBytesColorAttachment(*cmdQueue_, 0, pixels.data(), rangeDesc);
@@ -1168,6 +1172,10 @@ TEST_F(UniformBufferTest, UniformArrayBinding) {
11681172
//----------------------
11691173
// Read back framebuffer
11701174
//----------------------
1175+
const auto dimensions = framebuffer_->getColorAttachment(0)->getDimensions();
1176+
ASSERT_EQ(dimensions.width, static_cast<uint32_t>(kOffscreenTexWidth));
1177+
ASSERT_EQ(dimensions.height, static_cast<uint32_t>(kOffscreenTexHeight));
1178+
11711179
auto pixels = std::vector<uint32_t>(kOffscreenTexWidth * kOffscreenTexHeight);
11721180

11731181
framebuffer_->copyBytesColorAttachment(*cmdQueue_, 0, pixels.data(), rangeDesc);

0 commit comments

Comments
 (0)