Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
++
  • Loading branch information
jonahwilliams committed Nov 27, 2024
commit c65046afe87988e93e67e209217bb60e5ecdcbe7
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ TEST(RenderPassBuilder, RenderPassWithLoadOpUsesCurrentLayout) {

EXPECT_TRUE(!!render_pass);

auto maybe_color = builder.GetColor0();
std::optional<vk::AttachmentDescription> maybe_color = builder.GetColor0();
ASSERT_TRUE(maybe_color.has_value());
if (!maybe_color.has_value()) {
return;
}
auto color = maybe_color.value();
vk::AttachmentDescription color = maybe_color.value();

EXPECT_EQ(color.initialLayout, vk::ImageLayout::eColorAttachmentOptimal);
EXPECT_EQ(color.finalLayout, vk::ImageLayout::eGeneral);
Expand All @@ -69,24 +69,25 @@ TEST(RenderPassBuilder, CreatesRenderPassWithCombinedDepthStencil) {

EXPECT_TRUE(!!render_pass);

auto maybe_color = builder.GetColor0();
std::optional<vk::AttachmentDescription> maybe_color = builder.GetColor0();
ASSERT_TRUE(maybe_color.has_value());
if (!maybe_color.has_value()) {
return;
}
auto color = maybe_color.value();
vk::AttachmentDescription color = maybe_color.value();

EXPECT_EQ(color.initialLayout, vk::ImageLayout::eUndefined);
EXPECT_EQ(color.finalLayout, vk::ImageLayout::eGeneral);
EXPECT_EQ(color.loadOp, vk::AttachmentLoadOp::eClear);
EXPECT_EQ(color.storeOp, vk::AttachmentStoreOp::eStore);

auto maybe_depth_stencil = builder.GetDepthStencil();
std::optional<vk::AttachmentDescription> maybe_depth_stencil =
builder.GetDepthStencil();
ASSERT_TRUE(maybe_depth_stencil.has_value());
if (!maybe_depth_stencil.has_value()) {
return;
}
auto depth_stencil = maybe_depth_stencil.value();
vk::AttachmentDescription depth_stencil = maybe_depth_stencil.value();

EXPECT_EQ(depth_stencil.initialLayout, vk::ImageLayout::eUndefined);
EXPECT_EQ(depth_stencil.finalLayout,
Expand All @@ -112,12 +113,13 @@ TEST(RenderPassBuilder, CreatesRenderPassWithOnlyStencil) {

EXPECT_TRUE(!!render_pass);

auto maybe_depth_stencil = builder.GetDepthStencil();
std::optional<vk::AttachmentDescription> maybe_depth_stencil =
builder.GetDepthStencil();
ASSERT_TRUE(maybe_depth_stencil.has_value());
if (!maybe_depth_stencil.has_value()) {
return;
}
auto depth_stencil = maybe_depth_stencil.value();
vk::AttachmentDescription depth_stencil = maybe_depth_stencil.value();

EXPECT_EQ(depth_stencil.initialLayout, vk::ImageLayout::eUndefined);
EXPECT_EQ(depth_stencil.finalLayout,
Expand Down Expand Up @@ -146,17 +148,20 @@ TEST(RenderPassBuilder, CreatesMSAAResolveWithCorrectStore) {
if (!maybe_color.has_value()) {
return;
}
auto color = maybe_color.value();
vk::AttachmentDescription color = maybe_color.value();

// MSAA Texture.
EXPECT_EQ(color.initialLayout, vk::ImageLayout::eUndefined);
EXPECT_EQ(color.finalLayout, vk::ImageLayout::eGeneral);
EXPECT_EQ(color.loadOp, vk::AttachmentLoadOp::eClear);
EXPECT_EQ(color.storeOp, vk::AttachmentStoreOp::eDontCare);

auto maybe_resolve = builder.GetResolves().find(0u);
ASSERT_NE(maybe_resolve, builder.GetResolves().end());
auto resolve = maybe_resolve->second;
auto maybe_resolve = builder.GetColor0Resolve();
ASSERT_TRUE(maybe_resolve.has_value());
if (!maybe_resolve.has_value()) {
return;
}
vk::AttachmentDescription resolve = maybe_resolve.value();

// MSAA Resolve Texture.
EXPECT_EQ(resolve.initialLayout, vk::ImageLayout::eUndefined);
Expand Down