Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 12 additions & 3 deletions impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ static vk::AttachmentDescription CreatePlaceholderAttachmentDescription(
/// spec:
/// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap8.html#renderpass-compatibility
///
static vk::UniqueRenderPass CreateRenderPass(const vk::Device& device,
const PipelineDescriptor& desc) {
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(
const vk::Device& device,
const PipelineDescriptor& desc) {
std::vector<vk::AttachmentDescription> attachments;

std::vector<vk::AttachmentReference> color_refs;
Expand Down Expand Up @@ -128,6 +129,13 @@ static vk::UniqueRenderPass CreateRenderPass(const vk::Device& device,
return {};
}

// This pass is not used with the render pass. It is only necessary to tell
// Vulkan the expected render pass layout. The actual pass will be created
// later during render pass setup and will need to be compatible with this
// one.
ContextVK::SetDebugName(device, pass.get(),
"Compat Render Pass: " + desc.GetLabel());

return std::move(pass);
}

Expand Down Expand Up @@ -332,7 +340,8 @@ std::unique_ptr<PipelineVK> PipelineLibraryVK::CreatePipeline(
return nullptr;
}

auto render_pass = CreateRenderPass(strong_device->GetDevice(), desc);
auto render_pass =
CreateCompatRenderPassForPipeline(strong_device->GetDevice(), desc);
if (render_pass) {
pipeline_info.setBasePipelineHandle(VK_NULL_HANDLE);
pipeline_info.setSubpass(0);
Expand Down
14 changes: 13 additions & 1 deletion impeller/renderer/renderer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ TEST_P(RendererTest, CanCreateBoxPrimitive) {
auto desc = BoxPipelineBuilder::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(desc.has_value());
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);

// Vertex buffer.
VertexBufferBuilder<VS::PerVertexData> vertex_builder;
Expand Down Expand Up @@ -130,6 +131,7 @@ TEST_P(RendererTest, CanRenderPerspectiveCube) {
desc->SetCullMode(CullMode::kBackFace);
desc->SetWindingOrder(WindingOrder::kCounterClockwise);
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);
auto pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
ASSERT_TRUE(pipeline);
Expand Down Expand Up @@ -219,6 +221,7 @@ TEST_P(RendererTest, CanRenderMultiplePrimitives) {
auto desc = BoxPipelineBuilder::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(desc.has_value());
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);
auto box_pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
ASSERT_TRUE(box_pipeline);
Expand Down Expand Up @@ -420,7 +423,9 @@ TEST_P(RendererTest, CanRenderInstanced) {
->GetPipelineLibrary()
->GetPipeline(PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(
*GetContext())
->SetSampleCount(SampleCount::kCount4))
->SetSampleCount(SampleCount::kCount4)
.SetStencilAttachmentDescriptors(std::nullopt))

.Get();
ASSERT_TRUE(pipeline && pipeline->IsValid());

Expand Down Expand Up @@ -459,6 +464,7 @@ TEST_P(RendererTest, CanBlitTextureToTexture) {
auto desc = PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(desc.has_value());
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);
auto mipmaps_pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
ASSERT_TRUE(mipmaps_pipeline);
Expand Down Expand Up @@ -571,6 +577,7 @@ TEST_P(RendererTest, CanBlitTextureToBuffer) {
auto desc = PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(desc.has_value());
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);
auto mipmaps_pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
ASSERT_TRUE(mipmaps_pipeline);
Expand Down Expand Up @@ -702,6 +709,7 @@ TEST_P(RendererTest, CanGenerateMipmaps) {
auto desc = PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(desc.has_value());
desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);
auto mipmaps_pipeline =
context->GetPipelineLibrary()->GetPipeline(std::move(desc)).Get();
ASSERT_TRUE(mipmaps_pipeline);
Expand Down Expand Up @@ -818,6 +826,7 @@ TEST_P(RendererTest, TheImpeller) {
PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(pipeline_descriptor.has_value());
pipeline_descriptor->SetSampleCount(SampleCount::kCount4);
pipeline_descriptor->SetStencilAttachmentDescriptors(std::nullopt);
auto pipeline =
context->GetPipelineLibrary()->GetPipeline(pipeline_descriptor).Get();
ASSERT_TRUE(pipeline && pipeline->IsValid());
Expand Down Expand Up @@ -878,6 +887,7 @@ TEST_P(RendererTest, ArrayUniforms) {
PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(pipeline_descriptor.has_value());
pipeline_descriptor->SetSampleCount(SampleCount::kCount4);
pipeline_descriptor->SetStencilAttachmentDescriptors(std::nullopt);
auto pipeline =
context->GetPipelineLibrary()->GetPipeline(pipeline_descriptor).Get();
ASSERT_TRUE(pipeline && pipeline->IsValid());
Expand Down Expand Up @@ -934,6 +944,7 @@ TEST_P(RendererTest, InactiveUniforms) {
PipelineBuilder<VS, FS>::MakeDefaultPipelineDescriptor(*context);
ASSERT_TRUE(pipeline_descriptor.has_value());
pipeline_descriptor->SetSampleCount(SampleCount::kCount4);
pipeline_descriptor->SetStencilAttachmentDescriptors(std::nullopt);
auto pipeline =
context->GetPipelineLibrary()->GetPipeline(pipeline_descriptor).Get();
ASSERT_TRUE(pipeline && pipeline->IsValid());
Expand Down Expand Up @@ -1120,6 +1131,7 @@ TEST_P(RendererTest, StencilMask) {
ASSERT_TRUE(vertex_buffer);

desc->SetSampleCount(SampleCount::kCount4);
desc->SetStencilAttachmentDescriptors(std::nullopt);

auto bridge = CreateTextureForFixture("bay_bridge.jpg");
auto boston = CreateTextureForFixture("boston.jpg");
Expand Down