GCC Code Coverage Report


ernie/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
3 / 3
100.0%
Branches:
3 / 4
75.0%
Functions:
-
-%

shaders/shared.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 /// @file shared.h
3 /// @brief What C++ sees of the types shaders share with it. A shader file's shared part, before
4 /// its `#ifndef __cplusplus` code, is read by both languages: Slang's scalar types are glm's here,
5 /// laid out alike as Slang lays out data reached through `BufferRef` (packed, scalar alignment).
6 #pragma once
7
8 #include <glm/glm.hpp>
9
10 #include <cstdint>
11
12 namespace ernie::shaders {
13
14 using uint = std::uint32_t;
15 using uint2 = glm::uvec2;
16 using uint3 = glm::uvec3;
17 using float2 = glm::vec2;
18 using float3 = glm::vec3;
19 using float4 = glm::vec4;
20 using std::uint64_t;
21
22 /// @brief A buffer a shader reads or writes `T`s of, as buffer_ref.slang's `BufferRef`: 8 bytes,
23 /// a device address on Vulkan (an arena index and offset on WebGPU), 0 for none.
24
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
2335 template <typename T> struct BufferRef {
25 8852 std::uint64_t handle = 0;
26
2/2
✓ Branch 0 taken 8848 times.
✓ Branch 1 taken 4 times.
8852 bool operator==(const BufferRef&) const = default;
27 };
28
29 } // namespace ernie::shaders
30