|
15 | 15 | #include "impeller/renderer/pipeline_descriptor.h" |
16 | 16 | #include "impeller/renderer/pipeline_library.h" |
17 | 17 | #include "impeller/renderer/render_target.h" |
| 18 | +#include "impeller/renderer/texture_mipmap.h" |
18 | 19 | #include "impeller/tessellator/tessellator.h" |
19 | 20 | #include "impeller/typographer/typographer_context.h" |
20 | 21 |
|
@@ -429,20 +430,21 @@ fml::StatusOr<RenderTarget> ContentContext::MakeSubpass( |
429 | 430 | const std::string& label, |
430 | 431 | ISize texture_size, |
431 | 432 | const SubpassCallback& subpass_callback, |
432 | | - bool msaa_enabled) const { |
| 433 | + bool msaa_enabled, |
| 434 | + int32_t mip_count) const { |
433 | 435 | const std::shared_ptr<Context>& context = GetContext(); |
434 | 436 | RenderTarget subpass_target; |
435 | 437 | if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) { |
436 | 438 | subpass_target = RenderTarget::CreateOffscreenMSAA( |
437 | | - *context, *GetRenderTargetCache(), texture_size, /*mip_count=*/1, |
438 | | - SPrintF("%s Offscreen", label.c_str()), |
| 439 | + *context, *GetRenderTargetCache(), texture_size, |
| 440 | + /*mip_count=*/mip_count, SPrintF("%s Offscreen", label.c_str()), |
439 | 441 | RenderTarget::kDefaultColorAttachmentConfigMSAA, |
440 | 442 | std::nullopt // stencil_attachment_config |
441 | 443 | ); |
442 | 444 | } else { |
443 | 445 | subpass_target = RenderTarget::CreateOffscreen( |
444 | | - *context, *GetRenderTargetCache(), texture_size, /*mip_count=*/1, |
445 | | - SPrintF("%s Offscreen", label.c_str()), |
| 446 | + *context, *GetRenderTargetCache(), texture_size, |
| 447 | + /*mip_count=*/mip_count, SPrintF("%s Offscreen", label.c_str()), |
446 | 448 | RenderTarget::kDefaultColorAttachmentConfig, // |
447 | 449 | std::nullopt // stencil_attachment_config |
448 | 450 | ); |
@@ -477,7 +479,21 @@ fml::StatusOr<RenderTarget> ContentContext::MakeSubpass( |
477 | 479 | return fml::Status(fml::StatusCode::kUnknown, ""); |
478 | 480 | } |
479 | 481 |
|
480 | | - if (!sub_command_buffer->EncodeAndSubmit(sub_renderpass)) { |
| 482 | + if (!sub_renderpass->EncodeCommands()) { |
| 483 | + return fml::Status(fml::StatusCode::kUnknown, ""); |
| 484 | + } |
| 485 | + |
| 486 | + const std::shared_ptr<Texture>& target_texture = |
| 487 | + subpass_target.GetRenderTargetTexture(); |
| 488 | + if (target_texture->GetMipCount() > 1) { |
| 489 | + fml::Status mipmap_status = |
| 490 | + AddMipmapGeneration(sub_command_buffer, context, target_texture); |
| 491 | + if (!mipmap_status.ok()) { |
| 492 | + return mipmap_status; |
| 493 | + } |
| 494 | + } |
| 495 | + |
| 496 | + if (!sub_command_buffer->SubmitCommands()) { |
481 | 497 | return fml::Status(fml::StatusCode::kUnknown, ""); |
482 | 498 | } |
483 | 499 |
|
|
0 commit comments