GCC Code Coverage Report


ernie/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
25 / 25
100.0%
Branches:
5 / 15
33.3%
Functions:
3 / 3
100.0%

python/module.cpp
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 /// @file module.cpp
3 /// @brief The _ernie Python extension module.
4 #include "ernie/device/device.h"
5 #include "ernie/python/device.h"
6 #include "ernie/python/render.h"
7 #include "ernie/python/scene.h"
8 #include "ernie/util/version.h"
9
10 #include <nanobind/nanobind.h>
11 #include <nanobind/stl/string.h>
12 #include <nanobind/stl/vector.h>
13
14 namespace nb = nanobind;
15
16
3/11
PyInit__ernie:
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
nanobind__ernie_exec(_object*):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
24 NB_MODULE(_ernie, module) {
17
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 module.doc() = "Ernie's native module.";
18
1/2
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
12 module.attr("__version__") = std::string(ernie::Version());
19
20 6 nb::enum_<ernie::VulkanDeviceType>(module, "VulkanDeviceType")
21 6 .value("OTHER", ernie::VulkanDeviceType::Other)
22 6 .value("INTEGRATED_GPU", ernie::VulkanDeviceType::IntegratedGpu)
23 6 .value("DISCRETE_GPU", ernie::VulkanDeviceType::DiscreteGpu)
24 6 .value("VIRTUAL_GPU", ernie::VulkanDeviceType::VirtualGpu)
25 6 .value("CPU", ernie::VulkanDeviceType::Cpu);
26
27 6 nb::class_<ernie::VulkanDeviceInfo>(module, "VulkanDeviceInfo")
28 6 .def_ro("name", &ernie::VulkanDeviceInfo::name)
29 6 .def_ro("type", &ernie::VulkanDeviceInfo::type)
30 6 .def_ro("api_major", &ernie::VulkanDeviceInfo::apiMajor)
31 6 .def_ro("api_minor", &ernie::VulkanDeviceInfo::apiMinor)
32 6 .def_prop_ro("ray_query",
33 6 [](const ernie::VulkanDeviceInfo& info) { return info.capabilities.rayQuery; })
34 6 .def_ro("uuid", &ernie::VulkanDeviceInfo::uuid)
35 6 .def_ro("supported", &ernie::VulkanDeviceInfo::supported);
36
37 6 ernie::python::BindDevice(module);
38 6 ernie::python::BindScene(module);
39 6 ernie::python::BindRender(module);
40
41 6 module.def("vulkan_devices", &ernie::ListVulkanDevices,
42 "Lists the Vulkan devices of the installed drivers.");
43 6 }
44