chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
5 / 5
100.0%
Branches:
3 / 8
37.5%
Functions:
2 / 2, 2 excl
100.0%

device/texture.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstdint>
5 #include <string>
6
7 #include "chrono_batch_render/device/kernels/texture.h"
8 #include "chrono_batch_render/device/resource.h"
9 #include "chrono_batch_render/export.h"
10
11 namespace chrono::batch_render::device {
12
13
1/1
✓ Branch 2 taken 28 times.
56 struct TextureDesc {
14 uint32_t width = 0;
15 uint32_t height = 0;
16 uint32_t levels = 1;
17 TexelFormat format = TexelFormat::Rgba8;
18 TexelColorSpace colorSpace = TexelColorSpace::Linear;
19 TextureWrap wrapS = TextureWrap::Repeat;
20 TextureWrap wrapT = TextureWrap::Repeat;
21 std::string label = "texture";
22 };
23
24 class CHRONO_BATCH_RENDER_API Texture : public Resource {
25 public:
26 ~Texture() override;
27
28 const TextureDesc& Desc() const {
29
0/5
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
130 return m_desc;
30 }
31
32 uint32_t Handle() const {
33 return m_handle;
34 }
35
36 virtual uint64_t KernelHandle(TextureWrap wrapS, TextureWrap wrapT) = 0;
37
38 521 uint64_t LevelBytes(uint32_t level) const {
39 521 return TextureLevelBytes(m_desc.format, m_desc.width, m_desc.height, level);
40 }
41
42 protected:
43
2/2
✓ Branch 2 taken 28 times.
✓ Branch 5 taken 28 times.
56 Texture(Device& device, const TextureDesc& desc) : Resource(device, desc.label), m_desc(desc) {}
44
45 uint32_t m_handle = 0;
46
47 private:
48 friend class Device;
49
50 TextureDesc m_desc;
51 bool m_counted = false;
52 };
53
54 }
55