Nebula
Loading...
Searching...
No Matches
pixelformat.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14//------------------------------------------------------------------------------
15#include "core/types.h"
16#include "util/string.h"
17#include "coregraphics/config.h"
18
19namespace CoreGraphics
20{
22{
23public:
25 enum Code
26 {
46 R16F, // 16 bit float, red only
47 R16, // 16 bit integer
48 R16G16F, // 32 bit float, 16 bit red, 16 bit green
49 R16G16, // 32 bit integer, 16 bit red, 16 bit green
50 R16G16B16A16F, // 64 bit float, 16 bit rgba each
51 R16G16B16A16, // 64 bit int, 16 bit rgba each
52 R32F, // 32 bit float, red only
53 R32, // 32 bit int, red only
54 R32G32F, // 64 bit float, 32 bit red, 32 bit green
55 R32G32, // 64 bit, 32 bit red, 32 bit green
56 R32G32B32A32F, // 128 bit float, 32 bit rgba each
57 R32G32B32A32, // 128 bit integer, 32 bit rgba each
58 R32G32B32F, // 96 bit float, 32 bit rgb each
59 R32G32B32, // 96 bit integer, 32 bit rgb each
60 R11G11B10F, // 32 bit float, 11 bits red and green, 10 bit blue
67
72
78
79
81
84 InvalidPixelFormat = 0xFFFFFFFF,
85 };
86
88 static Code FromString(const Util::String& str);
90 static Util::String ToString(Code code);
92 static uint ToSize(Code code);
94 static uint ToChannels(Code code);
96 static bool ToCompressed(Code code);
98 static SizeT ToTexelSize(Code code);
100 static SizeT ToBlockSize(Code code);
102 static bool IsDepthFormat(Code code);
104 static bool IsStencilFormat(Code code);
106 static bool IsDepthStencilFormat(Code code);
107
110};
111
112} // namespace CoreGraphics
113//------------------------------------------------------------------------------
114
Pixel format enumeration.
Definition pixelformat.h:22
Code
enums
Definition pixelformat.h:26
@ DXT5
Definition pixelformat.h:36
@ R10G10B10A2
Definition pixelformat.h:64
@ BC7sRGB
Definition pixelformat.h:44
@ DXT3
Definition pixelformat.h:35
@ S8
Definition pixelformat.h:71
@ BC4
Definition pixelformat.h:41
@ D16S8
Definition pixelformat.h:69
@ R16G16
Definition pixelformat.h:49
@ BC3
Definition pixelformat.h:83
@ R16G16B16A16F
Definition pixelformat.h:50
@ R16G16F
Definition pixelformat.h:48
@ BC5
Definition pixelformat.h:42
@ InvalidPixelFormat
Definition pixelformat.h:84
@ DXT1
Definition pixelformat.h:33
@ DXT1sRGB
Definition pixelformat.h:37
@ DXT1AsRGB
Definition pixelformat.h:38
@ DXT3sRGB
Definition pixelformat.h:39
@ R9G9B9E5F
Definition pixelformat.h:61
@ R32
Definition pixelformat.h:53
@ R11G11B10F
Definition pixelformat.h:60
@ DXT5sRGB
Definition pixelformat.h:40
@ R32G32F
Definition pixelformat.h:54
@ SRGBA8
Definition pixelformat.h:62
@ BC7
Definition pixelformat.h:43
@ NumPixelFormats
Definition pixelformat.h:80
@ R32G32B32A32
Definition pixelformat.h:57
@ R8G8B8
Definition pixelformat.h:28
@ R32G32
Definition pixelformat.h:55
@ B5G6R5A1
Definition pixelformat.h:76
@ D32S8
Definition pixelformat.h:68
@ R32G32B32A32F
Definition pixelformat.h:56
@ R8G8B8X8
Definition pixelformat.h:27
@ R32F
Definition pixelformat.h:52
@ BC1
Definition pixelformat.h:82
@ D32
Definition pixelformat.h:70
@ R8
Definition pixelformat.h:45
@ B8G8R8
Definition pixelformat.h:73
@ R32G32B32F
Definition pixelformat.h:58
@ R16G16B16A16
Definition pixelformat.h:51
@ R5G6B5
Definition pixelformat.h:30
@ DXT1A
Definition pixelformat.h:34
@ R4G4B4A4
Definition pixelformat.h:32
@ B4G4R4A4
Definition pixelformat.h:77
@ R16
Definition pixelformat.h:47
@ R10G10B10X2
Definition pixelformat.h:63
@ R16F
Definition pixelformat.h:46
@ B5G6R5
Definition pixelformat.h:75
@ B8G8R8A8
Definition pixelformat.h:74
@ R8G8B8A8
Definition pixelformat.h:29
@ D24S8
Definition pixelformat.h:66
@ R5G5B5A1
Definition pixelformat.h:31
@ D24X8
Definition pixelformat.h:65
@ R32G32B32
Definition pixelformat.h:59
static bool IsDepthStencilFormat(Code code)
Return true if depth/stencil format.
Definition pixelformat.cc:405
static Code FromString(const Util::String &str)
convert from string
Definition pixelformat.cc:18
static Util::String ToString(Code code)
convert to string
Definition pixelformat.cc:74
static bool IsDepthFormat(Code code)
return true if depth format
Definition pixelformat.cc:365
static bool ToCompressed(Code code)
figure out if block compressed
Definition pixelformat.cc:257
static uint ToSize(Code code)
convert to byte size
Definition pixelformat.cc:132
static SizeT ToTexelSize(Code code)
calculate texel dimensions
Definition pixelformat.cc:283
static SizeT ToBlockSize(Code code)
Calculate texel block size.
Definition pixelformat.cc:339
static CoreGraphics::ImageBits ToImageBits(Code code)
Return Image bits from format.
Definition pixelformat.cc:427
static bool IsStencilFormat(Code code)
return true if depth format
Definition pixelformat.cc:386
static uint ToChannels(Code code)
convert to number of channesl
Definition pixelformat.cc:202
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
ImageBits
Definition config.h:82
Compile time configuration options for the CoreGraphics subsystem.
Nebula's universal string class.
Definition string.h:50
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31