[Impeller] In canvas_unittests, only create an MSAA offscreen texture if the platform supports MSAA (flutter/engine#56542)
This commit is contained in:
parent
157b28e3a9
commit
f03f05b51a
@ -34,20 +34,23 @@ std::unique_ptr<Canvas> CreateTestCanvas(
|
|||||||
context.GetContext()->GetResourceAllocator()->CreateTexture(
|
context.GetContext()->GetResourceAllocator()->CreateTexture(
|
||||||
onscreen_desc);
|
onscreen_desc);
|
||||||
|
|
||||||
TextureDescriptor onscreen_msaa_desc = onscreen_desc;
|
|
||||||
onscreen_msaa_desc.sample_count = SampleCount::kCount4;
|
|
||||||
onscreen_msaa_desc.storage_mode = StorageMode::kDeviceTransient;
|
|
||||||
onscreen_msaa_desc.type = TextureType::kTexture2DMultisample;
|
|
||||||
|
|
||||||
std::shared_ptr<Texture> onscreen_msaa =
|
|
||||||
context.GetContext()->GetResourceAllocator()->CreateTexture(
|
|
||||||
onscreen_msaa_desc);
|
|
||||||
|
|
||||||
ColorAttachment color0;
|
ColorAttachment color0;
|
||||||
color0.resolve_texture = onscreen;
|
|
||||||
color0.texture = onscreen_msaa;
|
|
||||||
color0.store_action = StoreAction::kMultisampleResolve;
|
|
||||||
color0.load_action = LoadAction::kClear;
|
color0.load_action = LoadAction::kClear;
|
||||||
|
if (context.GetContext()->GetCapabilities()->SupportsOffscreenMSAA()) {
|
||||||
|
TextureDescriptor onscreen_msaa_desc = onscreen_desc;
|
||||||
|
onscreen_msaa_desc.sample_count = SampleCount::kCount4;
|
||||||
|
onscreen_msaa_desc.storage_mode = StorageMode::kDeviceTransient;
|
||||||
|
onscreen_msaa_desc.type = TextureType::kTexture2DMultisample;
|
||||||
|
|
||||||
|
std::shared_ptr<Texture> onscreen_msaa =
|
||||||
|
context.GetContext()->GetResourceAllocator()->CreateTexture(
|
||||||
|
onscreen_msaa_desc);
|
||||||
|
color0.resolve_texture = onscreen;
|
||||||
|
color0.texture = onscreen_msaa;
|
||||||
|
color0.store_action = StoreAction::kMultisampleResolve;
|
||||||
|
} else {
|
||||||
|
color0.texture = onscreen;
|
||||||
|
}
|
||||||
|
|
||||||
RenderTarget render_target;
|
RenderTarget render_target;
|
||||||
render_target.SetColorAttachment(color0, 0);
|
render_target.SetColorAttachment(color0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user