Skip to content

Commit

Permalink
Merge entity renderer impl into the entity renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent 55396bc commit 28af36b
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 120 deletions.
2 changes: 1 addition & 1 deletion impeller/aiks/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ impeller_component("aiks") {
"picture.h",
"picture_recorder.cc",
"picture_recorder.h",
"picture_renderer.cc",
"picture_renderer.h",
"picture_renderer.mm",
]

public_deps = [
Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions impeller/entity/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ impeller_shaders("entity_shaders") {

impeller_component("entity") {
sources = [
"content_renderer.cc",
"content_renderer.h",
"content_renderer.mm",
"contents.cc",
"contents.h",
"contents.mm",
"entity.cc",
"entity.h",
"entity_renderer.cc",
"entity_renderer.h",
"entity_renderer.mm",
"entity_renderer_impl.h",
"entity_renderer_impl.mm",
]

deps = [ ":entity_shaders" ]
Expand All @@ -40,7 +38,7 @@ impeller_component("entity") {
impeller_component("entity_unittests") {
testonly = true

sources = [ "entity_unittests.mm" ]
sources = [ "entity_unittests.cc" ]

deps = [
":entity",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions impeller/entity/content_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <memory>

#include "flutter/fml/macros.h"
#include "impeller/entity/gradient_fill.frag.h"
#include "impeller/entity/gradient_fill.vert.h"
#include "flutter/impeller/entity/gradient_fill.frag.h"
#include "flutter/impeller/entity/gradient_fill.vert.h"
#include "impeller/renderer/pipeline.h"

namespace impeller {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "impeller/entity/entity_renderer_impl.h"
#include "flutter/impeller/entity/entity_renderer.h"

#include "flutter/fml/trace_event.h"
#include "impeller/renderer/tessellator.h"
#include "impeller/renderer/vertex_buffer_builder.h"

namespace impeller {

EntityRendererImpl::EntityRendererImpl(std::shared_ptr<Context> context)
EntityRenderer::EntityRenderer(std::shared_ptr<Context> context)
: context_(std::move(context)) {
if (!context_ || !context_->IsValid()) {
return;
Expand All @@ -26,13 +26,30 @@
is_valid_ = true;
}

EntityRendererImpl::~EntityRendererImpl() = default;
EntityRenderer::~EntityRenderer() = default;

bool EntityRendererImpl::IsValid() const {
bool EntityRenderer::IsValid() const {
return is_valid_;
}

EntityRendererImpl::RenderResult EntityRendererImpl::RenderEntity(
bool EntityRenderer::RenderEntities(const Surface& surface,
RenderPass& onscreen_pass,
const std::vector<Entity>& entities) {
if (!IsValid()) {
return false;
}

for (const auto& entity : entities) {
if (RenderEntity(surface, onscreen_pass, entity) ==
EntityRenderer::RenderResult::kFailure) {
return false;
}
}

return true;
}

EntityRenderer::RenderResult EntityRenderer::RenderEntity(
const Surface& surface,
RenderPass& pass,
const Entity& entity) {
Expand Down
32 changes: 25 additions & 7 deletions impeller/entity/entity_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
#include <memory>

#include "flutter/fml/macros.h"
#include "flutter/impeller/entity/solid_fill.frag.h"
#include "flutter/impeller/entity/solid_fill.vert.h"
#include "impeller/entity/content_renderer.h"
#include "impeller/entity/entity.h"
#include "impeller/renderer/context.h"
#include "impeller/renderer/pipeline.h"
#include "impeller/renderer/pipeline_builder.h"
#include "impeller/renderer/render_pass.h"
#include "impeller/renderer/surface.h"

namespace impeller {

class Surface;
class RenderPass;
class Context;
class EntityRendererImpl;

class EntityRenderer {
public:
EntityRenderer(std::shared_ptr<Context> context);
Expand All @@ -26,10 +29,25 @@ class EntityRenderer {

[[nodiscard]] bool RenderEntities(const Surface& surface,
RenderPass& onscreen_pass,
const std::vector<Entity>& entities) const;
const std::vector<Entity>& entities);

enum class RenderResult {
kSkipped,
kSuccess,
kFailure,
};

[[nodiscard]] RenderResult RenderEntity(const Surface& surface,
RenderPass& onscreen_pass,
const Entity& entities);

private:
std::unique_ptr<EntityRendererImpl> renderer_;
using SolidFillPipeline =
PipelineT<SolidFillVertexShader, SolidFillFragmentShader>;

std::shared_ptr<Context> context_;
std::unique_ptr<SolidFillPipeline> solid_fill_pipeline_;
std::unique_ptr<ContentRenderer> content_renderer_;
bool is_valid_ = false;

FML_DISALLOW_COPY_AND_ASSIGN(EntityRenderer);
Expand Down
43 changes: 0 additions & 43 deletions impeller/entity/entity_renderer.mm

This file was deleted.

56 changes: 0 additions & 56 deletions impeller/entity/entity_renderer_impl.h

This file was deleted.

File renamed without changes.

0 comments on commit 28af36b

Please sign in to comment.