VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
constants.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 19.09.2025.
5//
6
7#include "constants.h"
8
9#include <unordered_map>
10
11namespace visutwin::canvas
12{
14 {
15 uint32_t size;
16 uint32_t blockSize = 0;
17 bool isInt = false;
18 };
19
20 // Information about pixel formats
21 static std::unordered_map<PixelFormat, PixelFormatInfo> pixelFormatInfo {
22 // float formats
23 { PixelFormat::PIXELFORMAT_RGB8, { .size = 4 } },
24 { PixelFormat::PIXELFORMAT_RGBA8, { .size = 4 } },
25 { PixelFormat::PIXELFORMAT_RGBA16F, { .size = 8 } },
26 { PixelFormat::PIXELFORMAT_RGBA32F, { .size = 16 } },
28 { PixelFormat::PIXELFORMAT_DEPTH, { .size = 4 } },
29 { PixelFormat::PIXELFORMAT_R8, { .size = 1 } },
30 { PixelFormat::PIXELFORMAT_RG8, { .size = 2 } },
31 };
32
34 {
35 return pixelFormatInfo[format].blockSize > 0;
36 }
37
38 bool isIntegerPixelFormat(const PixelFormat format) {
39 return pixelFormatInfo[format].isInt == true;
40 };
41
42}
bool isCompressedPixelFormat(const PixelFormat format)
Definition constants.cpp:33
bool isIntegerPixelFormat(const PixelFormat format)
Definition constants.cpp:38