Skip to content

Commit 1be0787

Browse files
chinmaygardednfield
authored andcommitted
Better names for device objects.
1 parent 1b91e46 commit 1be0787

File tree

10 files changed

+88
-2
lines changed

10 files changed

+88
-2
lines changed

impeller/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config("impeller_public_config") {
88

99
group("impeller") {
1010
deps = [
11+
"base",
1112
"compiler",
1213
"compositor",
1314
"entity",

impeller/base/BUILD.gn

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("../tools/impeller.gni")
6+
7+
impeller_component("base") {
8+
# Only the umbrella header may be imported.
9+
public = [ "base.h" ]
10+
11+
sources = [
12+
"base.h",
13+
"config.h",
14+
"strings.cc",
15+
"strings.h",
16+
]
17+
}

impeller/base/base.h

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
7+
#include "impeller/base/strings.h"

impeller/base/config.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
7+
#include "flutter/fml/build_config.h"
8+
9+
#if defined(__GNUC__) || defined(__clang__)
10+
#define IMPELLER_COMPILER_CLANG 1
11+
#else // defined(__GNUC__) || defined(__clang__)
12+
#define IMPELLER_COMPILER_CLANG 0
13+
#endif // defined(__GNUC__) || defined(__clang__)
14+
15+
#if IMPELLER_COMPILER_CLANG
16+
#define IMPELLER_PRINTF_FORMAT(format_number, args_number) \
17+
__attribute__((format(printf, format_number, args_number)))
18+
#else // IMPELLER_COMPILER_CLANG
19+
#define IMPELLER_PRINTF_FORMAT(format_number, args_number)
20+
#endif // IMPELLER_COMPILER_CLANG

impeller/base/strings.cc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "impeller/base/strings.h"
6+
7+
#include <cstdarg>
8+
9+
namespace impeller {
10+
11+
IMPELLER_PRINTF_FORMAT(1, 2)
12+
std::string SPrintF(const char* format, ...) {
13+
va_list list;
14+
va_start(list, format);
15+
char buffer[64] = {0};
16+
::vsnprintf(buffer, sizeof(buffer), format, list);
17+
va_end(list);
18+
return buffer;
19+
}
20+
21+
} // namespace impeller

impeller/base/strings.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
7+
#include <string>
8+
9+
#include "impeller/base/config.h"
10+
11+
namespace impeller {
12+
13+
IMPELLER_PRINTF_FORMAT(1, 2)
14+
std::string SPrintF(const char* format, ...);
15+
16+
} // namespace impeller

impeller/compositor/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impeller_component("compositor") {
5959
]
6060

6161
public_deps = [
62+
"../base",
6263
"../geometry",
6364
"../shader_glue",
6465
]

impeller/compositor/render_pass.mm

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "flutter/fml/closure.h"
88
#include "flutter/fml/logging.h"
9+
#include "impeller/base/base.h"
910
#include "impeller/compositor/device_buffer.h"
1011
#include "impeller/compositor/formats_metal.h"
1112
#include "impeller/shader_glue/shader_types.h"
@@ -139,6 +140,7 @@ static bool ConfigureStencilAttachment(
139140

140141
void RenderPass::SetLabel(std::string label) {
141142
label_ = std::move(label);
143+
transients_buffer_->SetLabel(SPrintF("%s Transients", label_.c_str()));
142144
}
143145

144146
bool RenderPass::FinishEncoding(Allocator& transients_allocator) const {

impeller/entity/entity_renderer.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838

3939
bool EntityRenderer::OnRender(RenderPass& pass) {
40-
pass.SetLabel("EntityRenderer");
40+
pass.SetLabel("EntityRenderer Render Pass");
4141

4242
shader::BoxVertexInfo::UniformBuffer uniforms;
4343
uniforms.mvp = Matrix::MakeOrthographic({800, 600});

impeller/primitives/box_primitive.mm

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <memory>
88

99
#include "flutter/fml/logging.h"
10+
#include "impeller/base/base.h"
1011
#include "impeller/compositor/pipeline_descriptor.h"
1112
#include "impeller/compositor/shader_library.h"
1213
#include "impeller/compositor/vertex_descriptor.h"
@@ -16,7 +17,7 @@
1617
BoxPrimitive::BoxPrimitive(std::shared_ptr<Context> context)
1718
: Primitive(context) {
1819
PipelineDescriptor desc;
19-
desc.SetLabel(shader::BoxVertexInfo::kLabel);
20+
desc.SetLabel(SPrintF("%s Pipeline", shader::BoxVertexInfo::kLabel.data()));
2021

2122
{
2223
auto fragment_function = context->GetShaderLibrary()->GetFunction(

0 commit comments

Comments
 (0)