Skip to content

Commit

Permalink
Revert "[Impeller] More sundry fixes to the Vulkan backend. (flutter#…
Browse files Browse the repository at this point in the history
…40244)" (flutter#40247)

Revert "[Impeller] More sundry fixes to the Vulkan backend."
  • Loading branch information
zanderso authored Mar 13, 2023
1 parent 3ac895e commit 650c6e3
Show file tree
Hide file tree
Showing 74 changed files with 1,423 additions and 2,539 deletions.
26 changes: 6 additions & 20 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1411,18 +1411,10 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_buffer_vk.cc +
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_buffer_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_encoder_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_encoder_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_pool_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/command_pool_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/context_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/context_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/debug_report_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/debug_report_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/pipeline_library_vk.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -1464,8 +1456,6 @@ ORIGIN: ../../../flutter/impeller/renderer/buffer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/buffer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/buffer_view.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/buffer_view.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/capabilities.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/capabilities.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/command.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/command.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/command_buffer.cc + ../../../flutter/LICENSE
Expand All @@ -1480,10 +1470,13 @@ ORIGIN: ../../../flutter/impeller/renderer/compute_pipeline_descriptor.cc + ../.
ORIGIN: ../../../flutter/impeller/renderer/compute_pipeline_descriptor.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/context.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/context.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/descriptor_set_layout.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_buffer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_buffer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_buffer_descriptor.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_buffer_descriptor.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_capabilities.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/device_capabilities.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/formats.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/formats.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/gpu_tracer.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -3947,18 +3940,10 @@ FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_buffer_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_buffer_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_encoder_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_encoder_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_pool_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/command_pool_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/context_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/context_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/debug_report_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/debug_report_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Expand Down Expand Up @@ -4000,8 +3985,6 @@ FILE: ../../../flutter/impeller/renderer/buffer.cc
FILE: ../../../flutter/impeller/renderer/buffer.h
FILE: ../../../flutter/impeller/renderer/buffer_view.cc
FILE: ../../../flutter/impeller/renderer/buffer_view.h
FILE: ../../../flutter/impeller/renderer/capabilities.cc
FILE: ../../../flutter/impeller/renderer/capabilities.h
FILE: ../../../flutter/impeller/renderer/command.cc
FILE: ../../../flutter/impeller/renderer/command.h
FILE: ../../../flutter/impeller/renderer/command_buffer.cc
Expand All @@ -4016,10 +3999,13 @@ FILE: ../../../flutter/impeller/renderer/compute_pipeline_descriptor.cc
FILE: ../../../flutter/impeller/renderer/compute_pipeline_descriptor.h
FILE: ../../../flutter/impeller/renderer/context.cc
FILE: ../../../flutter/impeller/renderer/context.h
FILE: ../../../flutter/impeller/renderer/descriptor_set_layout.h
FILE: ../../../flutter/impeller/renderer/device_buffer.cc
FILE: ../../../flutter/impeller/renderer/device_buffer.h
FILE: ../../../flutter/impeller/renderer/device_buffer_descriptor.cc
FILE: ../../../flutter/impeller/renderer/device_buffer_descriptor.h
FILE: ../../../flutter/impeller/renderer/device_capabilities.cc
FILE: ../../../flutter/impeller/renderer/device_capabilities.h
FILE: ../../../flutter/impeller/renderer/formats.cc
FILE: ../../../flutter/impeller/renderer/formats.h
FILE: ../../../flutter/impeller/renderer/gpu_tracer.cc
Expand Down
2 changes: 1 addition & 1 deletion impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool GenerateMipmap(const std::shared_ptr<Context>& context,
}
pass->GenerateMipmap(std::move(texture), std::move(label));
pass->EncodeCommands(context->GetResourceAllocator());
return buffer->SubmitCommands();
return true;
}

TEST_P(AiksTest, CanRenderTiledTexture) {
Expand Down
2 changes: 1 addition & 1 deletion impeller/aiks/picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::shared_ptr<Texture> Picture::RenderToTexture(
// features to Image someday.
auto impeller_context = context.GetContext();
RenderTarget target;
if (impeller_context->GetCapabilities()->SupportsOffscreenMSAA()) {
if (impeller_context->GetDeviceCapabilities().SupportsOffscreenMSAA()) {
target = RenderTarget::CreateOffscreenMSAA(*impeller_context, size);
} else {
target = RenderTarget::CreateOffscreen(*impeller_context, size);
Expand Down
12 changes: 8 additions & 4 deletions impeller/compiler/code_gen_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ constexpr std::string_view kReflectionHeaderTemplate =
#include "impeller/renderer/compute_command.h" {# // nogncheck #}
#include "impeller/renderer/descriptor_set_layout.h" {# // nogncheck #}
#include "impeller/renderer/sampler.h" {# // nogncheck #}
#include "impeller/renderer/shader_types.h" {# // nogncheck #}
Expand Down Expand Up @@ -164,15 +166,17 @@ std::move({{ arg.argument_name }}){% if not loop.is_last %}, {% endif %}
{% for buffer in buffers %}
DescriptorSetLayout{
{{buffer.binding}}, // binding = {{buffer.binding}}
DescriptorType::kUniformBuffer, // descriptor_type = Uniform Buffer
{{to_shader_stage(shader_stage)}}, // shader_stage = {{to_shader_stage(shader_stage)}}
DescriptorType::kUniformBuffer, // descriptorType = Uniform Buffer
1, // descriptorCount = 1
{{to_shader_stage(shader_stage)}}, // stageFlags = {{to_shader_stage(shader_stage)}}
},
{% endfor %}
{% for sampled_image in sampled_images %}
DescriptorSetLayout{
{{sampled_image.binding}}, // binding = {{sampled_image.binding}}
DescriptorType::kSampledImage, // descriptor_type = Sampled Image
{{to_shader_stage(shader_stage)}}, // shader_stage = {{to_shader_stage(shader_stage)}}
DescriptorType::kSampledImage, // descriptorType = Sampled Image
1, // descriptorCount = 1
{{to_shader_stage(shader_stage)}}, // stageFlags = {{to_shader_stage(shader_stage)}}
},
{% endfor %}
};
Expand Down
14 changes: 7 additions & 7 deletions impeller/entity/contents/content_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ static std::unique_ptr<PipelineT> CreateDefaultPipeline(
return nullptr;
}
// Apply default ContentContextOptions to the descriptor.
const auto default_color_fmt =
context.GetCapabilities()->GetDefaultColorFormat();
const auto default_color_fmt = context.GetColorAttachmentPixelFormat();
ContentContextOptions{.color_attachment_pixel_format = default_color_fmt}
.ApplyToPipelineDescriptor(*desc);
return std::make_unique<PipelineT>(context, desc);
Expand All @@ -176,15 +175,15 @@ ContentContext::ContentContext(std::shared_ptr<Context> context)
CreateDefaultPipeline<LinearGradientFillPipeline>(*context_);
radial_gradient_fill_pipelines_[{}] =
CreateDefaultPipeline<RadialGradientFillPipeline>(*context_);
if (context_->GetCapabilities()->SupportsSSBO()) {
if (context_->GetDeviceCapabilities().SupportsSSBO()) {
linear_gradient_ssbo_fill_pipelines_[{}] =
CreateDefaultPipeline<LinearGradientSSBOFillPipeline>(*context_);
radial_gradient_ssbo_fill_pipelines_[{}] =
CreateDefaultPipeline<RadialGradientSSBOFillPipeline>(*context_);
sweep_gradient_ssbo_fill_pipelines_[{}] =
CreateDefaultPipeline<SweepGradientSSBOFillPipeline>(*context_);
}
if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
if (context_->GetDeviceCapabilities().SupportsFramebufferFetch()) {
framebuffer_blend_color_pipelines_[{}] =
CreateDefaultPipeline<FramebufferBlendColorPipeline>(*context_);
framebuffer_blend_colorburn_pipelines_[{}] =
Expand Down Expand Up @@ -316,7 +315,8 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
auto context = GetContext();

RenderTarget subpass_target;
if (context->GetCapabilities()->SupportsOffscreenMSAA() && msaa_enabled) {
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA() &&
msaa_enabled) {
subpass_target = RenderTarget::CreateOffscreenMSAA(
*context, texture_size, SPrintF("%s Offscreen", label.c_str()),
RenderTarget::kDefaultColorAttachmentConfigMSAA, std::nullopt);
Expand Down Expand Up @@ -374,8 +374,8 @@ std::shared_ptr<Context> ContentContext::GetContext() const {
return context_;
}

const Capabilities& ContentContext::GetDeviceCapabilities() const {
return *context_->GetCapabilities();
const IDeviceCapabilities& ContentContext::GetDeviceCapabilities() const {
return context_->GetDeviceCapabilities();
}

void ContentContext::SetWireframe(bool wireframe) {
Expand Down
4 changes: 2 additions & 2 deletions impeller/entity/contents/content_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "impeller/entity/vertices.frag.h"
#include "impeller/entity/yuv_to_rgb_filter.frag.h"
#include "impeller/entity/yuv_to_rgb_filter.vert.h"
#include "impeller/renderer/capabilities.h"
#include "impeller/renderer/device_capabilities.h"
#include "impeller/renderer/formats.h"
#include "impeller/renderer/pipeline.h"
#include "impeller/scene/scene_context.h"
Expand Down Expand Up @@ -601,7 +601,7 @@ class ContentContext {

std::shared_ptr<GlyphAtlasContext> GetGlyphAtlasContext() const;

const Capabilities& GetDeviceCapabilities() const;
const IDeviceCapabilities& GetDeviceCapabilities() const;

void SetWireframe(bool wireframe);

Expand Down
7 changes: 4 additions & 3 deletions impeller/entity/contents/runtime_effect_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ bool RuntimeEffectContents::Render(const ContentContext& renderer,
/// Get or create runtime stage pipeline.
///

const auto& caps = context->GetCapabilities();
const auto color_attachment_format = caps->GetDefaultColorFormat();
const auto stencil_attachment_format = caps->GetDefaultStencilFormat();
const auto& device_capabilities = context->GetDeviceCapabilities();
const auto color_attachment_format = context->GetColorAttachmentPixelFormat();
const auto stencil_attachment_format =
device_capabilities.GetDefaultStencilFormat();

using VS = RuntimeEffectVertexShader;
PipelineDescriptor desc;
Expand Down
6 changes: 3 additions & 3 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static RenderTarget CreateRenderTarget(ContentContext& renderer,
/// What's important is the `StorageMode` of the textures, which cannot be
/// changed for the lifetime of the textures.

if (context->GetCapabilities()->SupportsOffscreenMSAA()) {
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA()) {
return RenderTarget::CreateOffscreenMSAA(
*context, // context
size, // size
Expand Down Expand Up @@ -210,8 +210,8 @@ bool EntityPass::Render(ContentContext& renderer,
command_buffer->SetLabel("EntityPass Root Command Buffer");

if (renderer.GetContext()
->GetCapabilities()
->SupportsTextureToTextureBlits()) {
->GetDeviceCapabilities()
.SupportsTextureToTextureBlits()) {
auto blit_pass = command_buffer->CreateBlitPass();

blit_pass->AddCopy(offscreen_target.GetRenderTargetTexture(),
Expand Down
5 changes: 3 additions & 2 deletions impeller/playground/backend/metal/playground_impl_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
}
data_->metal_layer = [CAMetalLayer layer];
data_->metal_layer.device = ContextMTL::Cast(*context).GetMTLDevice();
data_->metal_layer.pixelFormat =
ToMTLPixelFormat(context->GetCapabilities()->GetDefaultColorFormat());
// This pixel format is one of the documented supported formats.
const auto color_fmt = context->GetColorAttachmentPixelFormat();
data_->metal_layer.pixelFormat = ToMTLPixelFormat(color_fmt);
data_->metal_layer.framebufferOnly = NO;
cocoa_window.contentView.layer = data_->metal_layer;
cocoa_window.contentView.wantsLayer = YES;
Expand Down
9 changes: 2 additions & 7 deletions impeller/playground/playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,8 @@ std::shared_ptr<Texture> Playground::CreateTextureForFixture(
std::shared_ptr<Texture> Playground::CreateTextureForFixture(
const char* fixture_name,
bool enable_mipmapping) const {
auto texture = CreateTextureForFixture(OpenAssetAsMapping(fixture_name),
enable_mipmapping);
if (texture == nullptr) {
return nullptr;
}
texture->SetLabel(fixture_name);
return texture;
return CreateTextureForFixture(OpenAssetAsMapping(fixture_name),
enable_mipmapping);
}

std::shared_ptr<Texture> Playground::CreateTextureCubeForFixture(
Expand Down
5 changes: 3 additions & 2 deletions impeller/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ impeller_component("renderer") {
"buffer.h",
"buffer_view.cc",
"buffer_view.h",
"capabilities.cc",
"capabilities.h",
"command.cc",
"command.h",
"command_buffer.cc",
Expand All @@ -32,10 +30,13 @@ impeller_component("renderer") {
"compute_pipeline_descriptor.h",
"context.cc",
"context.h",
"descriptor_set_layout.h",
"device_buffer.cc",
"device_buffer.h",
"device_buffer_descriptor.cc",
"device_buffer_descriptor.h",
"device_capabilities.cc",
"device_capabilities.h",
"formats.cc",
"formats.h",
"gpu_tracer.cc",
Expand Down
14 changes: 9 additions & 5 deletions impeller/renderer/backend/gles/context_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "impeller/base/config.h"
#include "impeller/base/validation.h"
#include "impeller/base/work_queue_common.h"
#include "impeller/renderer/capabilities.h"
#include "impeller/renderer/device_capabilities.h"

namespace impeller {

Expand Down Expand Up @@ -72,7 +72,7 @@ ContextGLES::ContextGLES(std::unique_ptr<ProcTableGLES> gl,
// Create the device capabilities.
{
device_capabilities_ =
CapabilitiesBuilder()
DeviceCapabilitiesBuilder()
.SetHasThreadingRestrictions(true)
.SetSupportsOffscreenMSAA(false)
.SetSupportsSSBO(false)
Expand Down Expand Up @@ -145,9 +145,13 @@ std::shared_ptr<WorkQueue> ContextGLES::GetWorkQueue() const {
}

// |Context|
const std::shared_ptr<const Capabilities>& ContextGLES::GetCapabilities()
const {
return device_capabilities_;
const IDeviceCapabilities& ContextGLES::GetDeviceCapabilities() const {
return *device_capabilities_;
}

// |Context|
PixelFormat ContextGLES::GetColorAttachmentPixelFormat() const {
return PixelFormat::kR8G8B8A8UNormInt;
}

} // namespace impeller
9 changes: 6 additions & 3 deletions impeller/renderer/backend/gles/context_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "impeller/renderer/backend/gles/reactor_gles.h"
#include "impeller/renderer/backend/gles/sampler_library_gles.h"
#include "impeller/renderer/backend/gles/shader_library_gles.h"
#include "impeller/renderer/capabilities.h"
#include "impeller/renderer/context.h"
#include "impeller/renderer/device_capabilities.h"

namespace impeller {

Expand Down Expand Up @@ -41,7 +41,7 @@ class ContextGLES final : public Context,
std::shared_ptr<SamplerLibraryGLES> sampler_library_;
std::shared_ptr<WorkQueue> work_queue_;
std::shared_ptr<AllocatorGLES> resource_allocator_;
std::shared_ptr<const Capabilities> device_capabilities_;
std::unique_ptr<IDeviceCapabilities> device_capabilities_;
bool is_valid_ = false;

ContextGLES(
Expand Down Expand Up @@ -70,7 +70,10 @@ class ContextGLES final : public Context,
std::shared_ptr<WorkQueue> GetWorkQueue() const override;

// |Context|
const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
const IDeviceCapabilities& GetDeviceCapabilities() const override;

// |Context|
PixelFormat GetColorAttachmentPixelFormat() const override;

FML_DISALLOW_COPY_AND_ASSIGN(ContextGLES);
};
Expand Down
Loading

0 comments on commit 650c6e3

Please sign in to comment.