GCC Code Coverage Report


ernie/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
29 / 29
100.0%
Branches:
24 / 44
54.5%
Functions:
3 / 3
100.0%

render/device_scene.cpp
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 /// @file device_scene.cpp
3 /// @brief Building and running each frame's graph over the device scene.
4 #include "ernie/render/device_scene.h"
5
6 #include <glm/common.hpp>
7 #include <glm/geometric.hpp>
8
9 namespace ernie {
10
11 15 DeviceScene::DeviceScene(DeviceContext& context, Arenas& arenas, const Scene& scene,
12 15 const ShaderCompiler& compiler)
13
1/2
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 : context_(context), pool_(context), columns_(context, arenas, scene),
14
2/4
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
15 transforms_(context, arenas, scene, compiler), geometry_(context, arenas, scene),
15
2/4
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
15 instances_(context, arenas) {
16
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (context.Capabilities().rayQuery) {
17
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 tracer_ = std::make_unique<RayTracer>(context, arenas, compiler, geometry_);
18 }
19 15 }
20
21 16 bool DeviceScene::Follow(const glm::dvec3& viewpoint) {
22
2/2
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 14 times.
16 if (glm::length(viewpoint - transforms_.Origin()) <= kRebaseDistance) {
23 return false;
24 }
25 2 ERNIE_ZONE("Rebase the render origin");
26
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 transforms_.SetOrigin(glm::round(viewpoint / kRebaseDistance) * kRebaseDistance);
27 2 return true;
28 2 }
29
30 27 Ticket DeviceScene::Execute(const std::function<void(graph::Graph&)>& passes,
31 std::span<const Ticket> waits, BinarySemaphores binary) {
32 27 ERNIE_ZONE("Run a frame");
33
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 graph::Graph graph(context_, pool_);
34
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 columns_.AddSync(graph);
35
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 transforms_.AddUpdate(graph);
36
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 const GeometryPool::Changes changes = geometry_.Update();
37
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 instances_.Apply(changes);
38
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 geometry_.AddUploads(graph);
39
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 instances_.AddUploads(graph);
40
1/2
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
27 if (tracer_) {
41
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
27 tracer_->AddBuild(graph, changes, transforms_, instances_);
42 }
43
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 2 times.
27 if (passes) {
44
1/2
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
25 passes(graph);
45 }
46
1/2
✓ Branch 1 taken 27 times.
✗ Branch 2 not taken.
54 return graph.Execute(context_.Main(), waits, binary);
47 27 }
48
49 } // namespace ernie
50