Browse Source

Some rafactoring for mesh v6

Panagiotis Christopoulos Charitos 3 years ago
parent
commit
76ec980c9f

+ 4 - 4
AnKi/Core/GpuMemoryPools.cpp

@@ -43,10 +43,10 @@ Error VertexGpuMemoryPool::init(HeapMemoryPool* pool, GrManager* gr, const Confi
 	return Error::kNone;
 }
 
-Error VertexGpuMemoryPool::allocate(PtrSize size, PtrSize& offset)
+Error VertexGpuMemoryPool::allocate(PtrSize size, U32 alignment, PtrSize& offset)
 {
 	U32 offset32;
-	const Bool success = m_buddyAllocator.allocate(size, 4, offset32);
+	const Bool success = m_buddyAllocator.allocate(size, alignment, offset32);
 	if(ANKI_UNLIKELY(!success))
 	{
 		BuddyAllocatorBuilderStats stats;
@@ -62,9 +62,9 @@ Error VertexGpuMemoryPool::allocate(PtrSize size, PtrSize& offset)
 	return Error::kNone;
 }
 
-void VertexGpuMemoryPool::free(PtrSize size, PtrSize offset)
+void VertexGpuMemoryPool::free(PtrSize size, U32 alignment, PtrSize offset)
 {
-	m_buddyAllocator.free(U32(offset), size, 4);
+	m_buddyAllocator.free(U32(offset), size, alignment);
 }
 
 StagingGpuMemoryPool::~StagingGpuMemoryPool()

+ 2 - 2
AnKi/Core/GpuMemoryPools.h

@@ -32,9 +32,9 @@ public:
 
 	Error init(HeapMemoryPool* pool, GrManager* gr, const ConfigSet& cfg);
 
-	Error allocate(PtrSize size, PtrSize& offset);
+	Error allocate(PtrSize size, U32 alignment, PtrSize& offset);
 
-	void free(PtrSize size, PtrSize offset);
+	void free(PtrSize size, U32 alignment, PtrSize offset);
 
 	BufferPtr getVertexBuffer() const
 	{

+ 6 - 0
AnKi/Gr/Common.h

@@ -727,6 +727,12 @@ enum class IndexType : U8
 	kCount
 };
 
+inline U32 getIndexSize(IndexType type)
+{
+	ANKI_ASSERT(type < IndexType::kCount);
+	return 2u << U32(type);
+}
+
 /// Rasterization order.
 enum class RasterizationOrder : U8
 {

+ 199 - 199
AnKi/Gr/Format.defs.h

@@ -15,203 +15,203 @@
 // 9) Aspect
 
 // clang-format off
-//              Name                                ID  CC  TS  BW  BH  BS  ST        ASPECT
-ANKI_FORMAT_DEF(R4G4UnormPack8,                      1,  2,  1,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R4G4B4A4UnormPack16,                 2,  4,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B4G4R4A4UnormPack16,                 3,  4,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R5G6B5UnormPack16,                   4,  3,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B5G6R5UnormPack16,                   5,  3,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R5G5B5A1UnormPack16,                 6,  4,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B5G5R5A1UnormPack16,                 7,  4,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A1R5G5B5UnormPack16,                 8,  4,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8Unorm,                             9,  1,  1,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8Snorm,                            10,  1,  1,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8Uscaled,                          11,  1,  1,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8Sscaled,                          12,  1,  1,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8Uint,                             13,  1,  1,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8Sint,                             14,  1,  1,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8Srgb,                             15,  1,  1,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8Unorm,                          16,  2,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8Snorm,                          17,  2,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8Uscaled,                        18,  2,  2,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8Sscaled,                        19,  2,  2,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8Uint,                           20,  2,  2,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8Sint,                           21,  2,  2,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8Srgb,                           22,  2,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8Unorm,                        23,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8Snorm,                        24,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8Uscaled,                      25,  3,  3,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8B8Sscaled,                      26,  3,  3,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8B8Uint,                         27,  3,  3,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8B8Sint,                         28,  3,  3,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8B8Srgb,                         29,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8Unorm,                        30,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8Snorm,                        31,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8Uscaled,                      32,  3,  3,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(B8G8R8Sscaled,                      33,  3,  3,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(B8G8R8Uint,                         34,  3,  3,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(B8G8R8Sint,                         35,  3,  3,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(B8G8R8Srgb,                         36,  3,  3,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Unorm,                      37,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Snorm,                      38,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Uscaled,                    39,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Sscaled,                    40,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Uint,                       41,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Sint,                       42,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R8G8B8A8Srgb,                       43,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Unorm,                      44,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Snorm,                      45,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Uscaled,                    46,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Sscaled,                    47,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Uint,                       48,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Sint,                       49,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(B8G8R8A8Srgb,                       50,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A8B8G8R8UnormPack32,                51,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A8B8G8R8SnormPack32,                52,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A8B8G8R8UscaledPack32,              53,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A8B8G8R8SscaledPack32,              54,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(A8B8G8R8UintPack32,                 55,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A8B8G8R8SintPack32,                 56,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(A8B8G8R8SrgbPack32,                 57,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A2R10G10B10UnormPack32,             58,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A2R10G10B10SnormPack32,             59,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A2R10G10B10UscaledPack32,           60,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A2R10G10B10SscaledPack32,           61,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(A2R10G10B10UintPack32,              62,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A2R10G10B10SintPack32,              63,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(A2B10G10R10UnormPack32,             64,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A2B10G10R10SnormPack32,             65,  4,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(A2B10G10R10UscaledPack32,           66,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A2B10G10R10SscaledPack32,           67,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(A2B10G10R10UintPack32,              68,  4,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(A2B10G10R10SintPack32,              69,  4,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16Unorm,                           70,  1,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16Snorm,                           71,  1,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16Uscaled,                         72,  1,  2,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16Sscaled,                         73,  1,  2,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16Uint,                            74,  1,  2,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16Sint,                            75,  1,  2,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16Sfloat,                          76,  1,  2,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16Unorm,                        77,  2,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16Snorm,                        78,  2,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16Uscaled,                      79,  2,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16Sscaled,                      80,  2,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16Uint,                         81,  2,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16Sint,                         82,  2,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16Sfloat,                       83,  2,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16Unorm,                     84,  3,  6,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16Snorm,                     85,  3,  6,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16Uscaled,                   86,  3,  6,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16B16Sscaled,                   87,  3,  6,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16B16Uint,                      88,  3,  6,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16B16Sint,                      89,  3,  6,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16B16Sfloat,                    90,  3,  6,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Unorm,                  91,  4,  8,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Snorm,                  92,  4,  8,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Uscaled,                93,  4,  8,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Sscaled,                94,  4,  8,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Uint,                   95,  4,  8,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Sint,                   96,  4,  8,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R16G16B16A16Sfloat,                 97,  4,  8,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R32Uint,                            98,  1,  4,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R32Sint,                            99,  1,  4,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R32Sfloat,                         100,  1,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R32G32Uint,                        101,  2,  8,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R32G32Sint,                        102,  2,  8,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R32G32Sfloat,                      103,  2,  8,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R32G32B32Uint,                     104,  3, 12,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R32G32B32Sint,                     105,  3, 12,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R32G32B32Sfloat,                   106,  3, 12,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R32G32B32A32Uint,                  107,  4, 16,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R32G32B32A32Sint,                  108,  4, 16,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R32G32B32A32Sfloat,                109,  4, 16,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R64Uint,                           110,  1,  8,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R64Sint,                           111,  1,  8,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R64Sfloat,                         112,  1,  8,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R64G64Uint,                        113,  2, 16,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R64G64Sint,                        114,  2, 16,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R64G64Sfloat,                      115,  2, 16,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R64G64B64Uint,                     116,  3, 24,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R64G64B64Sint,                     117,  3, 24,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R64G64B64Sfloat,                   118,  3, 24,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(R64G64B64A64Uint,                  119,  4, 32,  0,  0,  0,  1,         None)
-ANKI_FORMAT_DEF(R64G64B64A64Sint,                  120,  4, 32,  0,  0,  0,  2,         None)
-ANKI_FORMAT_DEF(R64G64B64A64Sfloat,                121,  4, 32,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(B10G11R11UfloatPack32,             122,  3,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(E5B9G9R9UfloatPack32,              123,  3,  4,  0,  0,  0,  0,         None)
-ANKI_FORMAT_DEF(D16Unorm,                          124,  0,  2,  0,  0,  0,  0,        Depth)
-ANKI_FORMAT_DEF(X8D24UnormPack32,                  125,  0,  4,  0,  0,  0,  0,        Depth)
-ANKI_FORMAT_DEF(D32Sfloat,                         126,  0,  4,  0,  0,  0,  0,        Depth)
-ANKI_FORMAT_DEF(S8Uint,                            127,  0,  1,  0,  0,  0,  1,      Stencil)
-ANKI_FORMAT_DEF(D16UnormS8Uint,                    128,  0,  3,  0,  0,  0,  0, DepthStencil)
-ANKI_FORMAT_DEF(D24UnormS8Uint,                    129,  0,  4,  0,  0,  0,  0, DepthStencil)
-ANKI_FORMAT_DEF(D32SfloatS8Uint,                   130,  0,  0,  0,  0,  0,  0, DepthStencil)
-ANKI_FORMAT_DEF(Bc1RgbUnormBlock,                  131,  3,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc1RgbSrgbBlock,                   132,  3,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc1RgbaUnormBlock,                 133,  4,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc1RgbaSrgbBlock,                  134,  4,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc2UnormBlock,                     135,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc2SrgbBlock,                      136,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc3UnormBlock,                     137,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc3SrgbBlock,                      138,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc4UnormBlock,                     139,  1,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc4SnormBlock,                     140,  1,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Bc5UnormBlock,                     141,  2,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc5SnormBlock,                     142,  2,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc6hUfloatBlock,                   143,  3,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc6hSfloatBlock,                   144,  3,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc7UnormBlock,                     145,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Bc7SrgbBlock,                      146,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8UnormBlock,              147,  3,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8SrgbBlock,               148,  3,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8A1UnormBlock,            149,  4,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8A1SrgbBlock,             150,  4,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8A8UnormBlock,            151,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Etc2R8G8B8A8SrgbBlock,             152,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(EacR11UnormBlock,                  153,  1,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(EacR11SnormBlock,                  154,  1,  0,  4,  4,  8,  0,         None)
-ANKI_FORMAT_DEF(EacR11G11UnormBlock,               155,  2,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(EacR11G11SnormBlock,               156,  2,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc4x4UnormBlock,                 157,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc4x4SrgbBlock,                  158,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x4UnormBlock,                 159,  4,  0,  5,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x4SrgbBlock,                  160,  4,  0,  5,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x5UnormBlock,                 161,  4,  0,  5,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x5SrgbBlock,                  162,  4,  0,  5,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x5UnormBlock,                 163,  4,  0,  6,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x5SrgbBlock,                  164,  4,  0,  6,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x6UnormBlock,                 165,  4,  0,  6,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x6SrgbBlock,                  166,  4,  0,  6,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x5UnormBlock,                 167,  4,  0,  8,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x5SrgbBlock,                  168,  4,  0,  8,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x6UnormBlock,                 169,  4,  0,  8,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x6SrgbBlock,                  170,  4,  0,  8,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x8UnormBlock,                 171,  4,  0,  8,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x8SrgbBlock,                  172,  4,  0,  8,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x5UnormBlock,                173,  4,  0, 10,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x5SrgbBlock,                 174,  4,  0, 10,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x6UnormBlock,                175,  4,  0, 10,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x6SrgbBlock,                 176,  4,  0, 10,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x8UnormBlock,                177,  4,  0, 10,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x8SrgbBlock,                 178,  4,  0, 10,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x10UnormBlock,               179,  4,  0, 10, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x10SrgbBlock,                180,  4,  0, 10, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x10UnormBlock,               181,  4,  0, 12, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x10SrgbBlock,                182,  4,  0, 12, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x12UnormBlock,               183,  4,  0, 12, 12, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x12SrgbBlock,                184,  4,  0, 12, 12, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc4x4SfloatBlock,         1000066000,  4,  0,  4,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x4SfloatBlock,         1000066001,  4,  0,  5,  4, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc5x5SfloatBlock,         1000066002,  4,  0,  5,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x5SfloatBlock,         1000066003,  4,  0,  6,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc6x6SfloatBlock,         1000066004,  4,  0,  6,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x5SfloatBlock,         1000066005,  4,  0,  8,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x6SfloatBlock,         1000066006,  4,  0,  8,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc8x8SfloatBlock,         1000066007,  4,  0,  8,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x5SfloatBlock,        1000066008,  4,  0, 10,  5, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x6SfloatBlock,        1000066009,  4,  0, 10,  6, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x8SfloatBlock,        1000066010,  4,  0, 10,  8, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc10x10SfloatBlock,       1000066011,  4,  0, 10, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x10SfloatBlock,       1000066012,  4,  0, 12, 10, 16,  0,         None)
-ANKI_FORMAT_DEF(Astc12x12SfloatBlock,       1000066013,  4,  0, 12, 12, 16,  0,         None)
+//              Name                                  ID  CC  TS  BW  BH  BS  ST        ASPECT
+ANKI_FORMAT_DEF(R4G4_Unorm_Pack8,                      1,  2,  1,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R4G4B4A4_Unorm_Pack16,                 2,  4,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B4G4R4A4_Unorm_Pack16,                 3,  4,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R5G6B5_Unorm_Pack16,                   4,  3,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B5G6R5_Unorm_Pack16,                   5,  3,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R5G5B5A1_Unorm_Pack16,                 6,  4,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B5G5R5A1_Unorm_Pack16,                 7,  4,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A1R5G5B5_Unorm_Pack16,                 8,  4,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8_Unorm,                              9,  1,  1,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8_Snorm,                             10,  1,  1,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8_Uscaled,                           11,  1,  1,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8_Sscaled,                           12,  1,  1,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8_Uint,                              13,  1,  1,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8_Sint,                              14,  1,  1,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8_Srgb,                              15,  1,  1,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8_Unorm,                           16,  2,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8_Snorm,                           17,  2,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8_Uscaled,                         18,  2,  2,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8_Sscaled,                         19,  2,  2,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8_Uint,                            20,  2,  2,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8_Sint,                            21,  2,  2,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8_Srgb,                            22,  2,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8_Unorm,                         23,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8_Snorm,                         24,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8_Uscaled,                       25,  3,  3,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8B8_Sscaled,                       26,  3,  3,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8B8_Uint,                          27,  3,  3,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8B8_Sint,                          28,  3,  3,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8B8_Srgb,                          29,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8_Unorm,                         30,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8_Snorm,                         31,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8_Uscaled,                       32,  3,  3,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(B8G8R8_Sscaled,                       33,  3,  3,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(B8G8R8_Uint,                          34,  3,  3,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(B8G8R8_Sint,                          35,  3,  3,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(B8G8R8_Srgb,                          36,  3,  3,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Unorm,                       37,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Snorm,                       38,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Uscaled,                     39,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Sscaled,                     40,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Uint,                        41,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Sint,                        42,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R8G8B8A8_Srgb,                        43,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Unorm,                       44,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Snorm,                       45,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Uscaled,                     46,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Sscaled,                     47,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Uint,                        48,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Sint,                        49,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(B8G8R8A8_Srgb,                        50,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Unorm_Pack32,                51,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Snorm_Pack32,                52,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Uscaled_Pack32,              53,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Sscaled_Pack32,              54,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Uint_Pack32,                 55,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Sint_Pack32,                 56,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(A8B8G8R8_Srgb_Pack32,                 57,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Unorm_Pack32,             58,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Snorm_Pack32,             59,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Uscaled_Pack32,           60,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Sscaled_Pack32,           61,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Uint_Pack32,              62,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A2R10G10B10_Sint_Pack32,              63,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Unorm_Pack32,             64,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Snorm_Pack32,             65,  4,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Uscaled_Pack32,           66,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Sscaled_Pack32,           67,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Uint_Pack32,              68,  4,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(A2B10G10R10_Sint_Pack32,              69,  4,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16_Unorm,                            70,  1,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16_Snorm,                            71,  1,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16_Uscaled,                          72,  1,  2,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16_Sscaled,                          73,  1,  2,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16_Uint,                             74,  1,  2,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16_Sint,                             75,  1,  2,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16_Sfloat,                           76,  1,  2,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16_Unorm,                         77,  2,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16_Snorm,                         78,  2,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16_Uscaled,                       79,  2,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16_Sscaled,                       80,  2,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16_Uint,                          81,  2,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16_Sint,                          82,  2,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16_Sfloat,                        83,  2,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16_Unorm,                      84,  3,  6,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16_Snorm,                      85,  3,  6,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16_Uscaled,                    86,  3,  6,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16B16_Sscaled,                    87,  3,  6,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16B16_Uint,                       88,  3,  6,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16B16_Sint,                       89,  3,  6,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16B16_Sfloat,                     90,  3,  6,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Unorm,                   91,  4,  8,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Snorm,                   92,  4,  8,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Uscaled,                 93,  4,  8,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Sscaled,                 94,  4,  8,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Uint,                    95,  4,  8,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Sint,                    96,  4,  8,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R16G16B16A16_Sfloat,                  97,  4,  8,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R32_Uint,                             98,  1,  4,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R32_Sint,                             99,  1,  4,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R32_Sfloat,                          100,  1,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R32G32_Uint,                         101,  2,  8,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R32G32_Sint,                         102,  2,  8,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R32G32_Sfloat,                       103,  2,  8,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R32G32B32_Uint,                      104,  3, 12,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R32G32B32_Sint,                      105,  3, 12,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R32G32B32_Sfloat,                    106,  3, 12,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R32G32B32A32_Uint,                   107,  4, 16,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R32G32B32A32_Sint,                   108,  4, 16,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R32G32B32A32_Sfloat,                 109,  4, 16,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R64_Uint,                            110,  1,  8,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R64_Sint,                            111,  1,  8,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R64_Sfloat,                          112,  1,  8,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R64G64_Uint,                         113,  2, 16,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R64G64_Sint,                         114,  2, 16,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R64G64_Sfloat,                       115,  2, 16,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R64G64B64_Uint,                      116,  3, 24,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R64G64B64_Sint,                      117,  3, 24,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R64G64B64_Sfloat,                    118,  3, 24,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(R64G64B64A64_Uint,                   119,  4, 32,  0,  0,  0,  1,         None)
+ANKI_FORMAT_DEF(R64G64B64A64_Sint,                   120,  4, 32,  0,  0,  0,  2,         None)
+ANKI_FORMAT_DEF(R64G64B64A64_Sfloat,                 121,  4, 32,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(B10G11R11_Ufloat_Pack32,             122,  3,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(E5B9G9R9_Ufloat_Pack32,              123,  3,  4,  0,  0,  0,  0,         None)
+ANKI_FORMAT_DEF(D16_Unorm,                           124,  0,  2,  0,  0,  0,  0,        Depth)
+ANKI_FORMAT_DEF(X8D24_Unorm_Pack32,                  125,  0,  4,  0,  0,  0,  0,        Depth)
+ANKI_FORMAT_DEF(D32_Sfloat,                          126,  0,  4,  0,  0,  0,  0,        Depth)
+ANKI_FORMAT_DEF(S8_Uint,                             127,  0,  1,  0,  0,  0,  1,      Stencil)
+ANKI_FORMAT_DEF(D16_Unorm_S8_Uint,                   128,  0,  3,  0,  0,  0,  0, DepthStencil)
+ANKI_FORMAT_DEF(D24_Unorm_S8_Uint,                   129,  0,  4,  0,  0,  0,  0, DepthStencil)
+ANKI_FORMAT_DEF(D32_Sfloat_S8_Uint,                  130,  0,  0,  0,  0,  0,  0, DepthStencil)
+ANKI_FORMAT_DEF(BC1_Rgb_Unorm_Block,                 131,  3,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC1_Rgb_Srgb_Block,                  132,  3,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC1_Rgba_Unorm_Block,                133,  4,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC1_Rgba_Srgb_Block,                 134,  4,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC2_Unorm_Block,                     135,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC2_Srgb_Block,                      136,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC3_Unorm_Block,                     137,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC3_Srgb_Block,                      138,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC4_Unorm_Block,                     139,  1,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC4_Snorm_Block,                     140,  1,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(BC5_Unorm_Block,                     141,  2,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC5_Snorm_Block,                     142,  2,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC6H_Ufloat_Block,                   143,  3,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC6H_Sfloat_Block,                   144,  3,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC7_Unorm_Block,                     145,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(BC7_Srgb_Block,                      146,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8_Unorm_Block,             147,  3,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8_Srgb_Block,              148,  3,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8A1_Unorm_Block,           149,  4,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8A1_Srgb_Block,            150,  4,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8A8_Unorm_Block,           151,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ETC2_R8G8B8A8_Srgb_Block,            152,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(EAC_R11_Unorm_Block,                 153,  1,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(EAC_R11_Snorm_Block,                 154,  1,  0,  4,  4,  8,  0,         None)
+ANKI_FORMAT_DEF(EAC_R11G11_Unorm_Block,              155,  2,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(EAC_R11G11_Snorm_Block,              156,  2,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_4x4_Unorm_Block,                157,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_4x4_Srgb_Block,                 158,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x4_Unorm_Block,                159,  4,  0,  5,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x4_Srgb_Block,                 160,  4,  0,  5,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x5_Unorm_Block,                161,  4,  0,  5,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x5_Srgb_Block,                 162,  4,  0,  5,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x5_Unorm_Block,                163,  4,  0,  6,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x5_Srgb_Block,                 164,  4,  0,  6,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x6_Unorm_Block,                165,  4,  0,  6,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x6_Srgb_Block,                 166,  4,  0,  6,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x5_Unorm_Block,                167,  4,  0,  8,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x5_Srgb_Block,                 168,  4,  0,  8,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x6_Unorm_Block,                169,  4,  0,  8,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x6_Srgb_Block,                 170,  4,  0,  8,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x8_Unorm_Block,                171,  4,  0,  8,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x8_Srgb_Block,                 172,  4,  0,  8,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x5_Unorm_Block,               173,  4,  0, 10,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x5_Srgb_Block,                174,  4,  0, 10,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x6_Unorm_Block,               175,  4,  0, 10,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x6_Srgb_Block,                176,  4,  0, 10,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x8_Unorm_Block,               177,  4,  0, 10,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x8_Srgb_Block,                178,  4,  0, 10,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x10_Unorm_Block,              179,  4,  0, 10, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x10_Srgb_Block,               180,  4,  0, 10, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x10_Unorm_Block,              181,  4,  0, 12, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x10_Srgb_Block,               182,  4,  0, 12, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x12_Unorm_Block,              183,  4,  0, 12, 12, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x12_Srgb_Block,               184,  4,  0, 12, 12, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_4x4_Sfloat_Block,        1000066000,  4,  0,  4,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x4_Sfloat_Block,        1000066001,  4,  0,  5,  4, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_5x5_Sfloat_Block,        1000066002,  4,  0,  5,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x5_Sfloat_Block,        1000066003,  4,  0,  6,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_6x6_Sfloat_Block,        1000066004,  4,  0,  6,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x5_Sfloat_Block,        1000066005,  4,  0,  8,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x6_Sfloat_Block,        1000066006,  4,  0,  8,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_8x8_Sfloat_Block,        1000066007,  4,  0,  8,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x5_Sfloat_Block,       1000066008,  4,  0, 10,  5, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x6_Sfloat_Block,       1000066009,  4,  0, 10,  6, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x8_Sfloat_Block,       1000066010,  4,  0, 10,  8, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_10x10_Sfloat_Block,      1000066011,  4,  0, 10, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x10_Sfloat_Block,      1000066012,  4,  0, 12, 10, 16,  0,         None)
+ANKI_FORMAT_DEF(ASTC_12x12_Sfloat_Block,      1000066013,  4,  0, 12, 12, 16,  0,         None)
 // clang-format on

+ 9 - 9
AnKi/Gr/Gl/Common.cpp

@@ -129,17 +129,17 @@ void convertVertexFormat(Format fmt, U& compCount, GLenum& type, Bool& normalize
 {
 	switch(fmt)
 	{
-	case Format::kR32Sfloat:
+	case Format::kR32_Sfloat:
 		compCount = 1;
 		type = GL_FLOAT;
 		normalized = false;
 		break;
-	case Format::kR32G32Sfloat:
+	case Format::kR32G32_Sfloat:
 		compCount = 2;
 		type = GL_FLOAT;
 		normalized = false;
 		break;
-	case Format::kR32G32B32Sfloat:
+	case Format::kR32G32B32_Sfloat:
 		compCount = 3;
 		type = GL_FLOAT;
 		normalized = false;
@@ -179,7 +179,7 @@ void convertVertexFormat(Format fmt, U& compCount, GLenum& type, Bool& normalize
 		type = GL_INT_2_10_10_10_REV;
 		normalized = true;
 		break;
-	case Format::kR8G8B8A8Unorm:
+	case Format::kR8G8B8A8_Unorm:
 		compCount = 4;
 		type = GL_UNSIGNED_BYTE;
 		normalized = true;
@@ -336,7 +336,7 @@ void convertTextureInformation(Format pf, Bool& compressed, GLenum& format, GLen
 		internalFormat = GL_RGB8I;
 		type = GL_RGB_INTEGER;
 		break;
-	case Format::kR8G8B8A8Unorm:
+	case Format::kR8G8B8A8_Unorm:
 		format = GL_RGBA;
 		internalFormat = GL_RGBA8;
 		type = GL_UNSIGNED_BYTE;
@@ -391,7 +391,7 @@ void convertTextureInformation(Format pf, Bool& compressed, GLenum& format, GLen
 		internalFormat = GL_RGBA16UI;
 		type = GL_UNSIGNED_SHORT;
 		break;
-	case Format::kR32Sfloat:
+	case Format::kR32_Sfloat:
 		format = GL_R;
 		internalFormat = GL_R32F;
 		type = GL_FLOAT;
@@ -401,17 +401,17 @@ void convertTextureInformation(Format pf, Bool& compressed, GLenum& format, GLen
 		internalFormat = GL_R32UI;
 		type = GL_UNSIGNED_INT;
 		break;
-	case Format::kR32G32Sfloat:
+	case Format::kR32G32_Sfloat:
 		format = GL_RG;
 		internalFormat = GL_RG32F;
 		type = GL_FLOAT;
 		break;
-	case Format::kR32G32Uint:
+	case Format::kR32G32_Uint:
 		format = GL_RG_INTEGER;
 		internalFormat = GL_RG32UI;
 		type = GL_UNSIGNED_INT;
 		break;
-	case Format::kR32G32B32Sfloat:
+	case Format::kR32G32B32_Sfloat:
 		format = GL_RGB;
 		internalFormat = GL_RGB32F;
 		type = GL_FLOAT;

+ 1 - 1
AnKi/Gr/Gl/GrManagerImpl.cpp

@@ -81,7 +81,7 @@ void GrManagerImpl::initFakeDefaultFb(GrManagerInitInfo& init)
 	TextureInitInfo texinit("FB Tex");
 	texinit.m_width = defaultFbWidth;
 	texinit.m_height = defaultFbHeight;
-	texinit.m_format = Format::kR8G8B8A8Unorm;
+	texinit.m_format = Format::kR8G8B8A8_Unorm;
 	texinit.m_usage =
 		TextureUsageBit::kFramebufferWrite | TextureUsageBit::kImageComputeWrite | TextureUsageBit::kPresent;
 	m_fakeFbTex = newTexture(texinit);

+ 179 - 166
AnKi/Importer/GltfImporterMesh.cpp

@@ -261,6 +261,175 @@ static void decimateSubmesh(F32 factor, SubMesh& submesh, BaseMemoryPool* pool)
 	submesh.m_verts = std::move(newVerts);
 }
 
+/// If normal A and normal B have the same position then try to merge them. Do that before optimizations.
+static void fixNormals(const F32 normalsMergeAngle, SubMesh& submesh)
+{
+	for(U32 v = 0; v < submesh.m_verts.getSize(); ++v)
+	{
+		const Vec3& pos = submesh.m_verts[v].m_position;
+		Vec3& normal = submesh.m_verts[v].m_normal;
+
+		for(U32 prevV = 0; prevV < v; ++prevV)
+		{
+			const Vec3& otherPos = submesh.m_verts[prevV].m_position;
+
+			// Check the positions dist
+			const F32 posDist = (otherPos - pos).getLengthSquared();
+			if(posDist > kEpsilonf * kEpsilonf)
+			{
+				continue;
+			}
+
+			// Check angle of the normals
+			Vec3& otherNormal = submesh.m_verts[prevV].m_normal;
+			const F32 ang = acos(clamp(otherNormal.dot(normal), -1.0f, 1.0f));
+			if(ang > normalsMergeAngle)
+			{
+				continue;
+			}
+
+			// Merge normals
+			const Vec3 newNormal = (otherNormal + normal).getNormalized();
+			normal = newNormal;
+			otherNormal = newNormal;
+		}
+	}
+}
+
+static void computeTangents(SubMesh& submesh)
+{
+	DynamicArrayRaii<Vec3> bitangents(&submesh.m_verts.getMemoryPool());
+	const U32 vertCount = submesh.m_verts.getSize();
+	bitangents.create(vertCount, Vec3(0.0f));
+
+	for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
+	{
+		const U32 i0 = submesh.m_indices[i + 0];
+		const U32 i1 = submesh.m_indices[i + 1];
+		const U32 i2 = submesh.m_indices[i + 2];
+
+		const Vec3& v0 = submesh.m_verts[i0].m_position;
+		const Vec3& v1 = submesh.m_verts[i1].m_position;
+		const Vec3& v2 = submesh.m_verts[i2].m_position;
+		const Vec3 edge01 = v1 - v0;
+		const Vec3 edge02 = v2 - v0;
+
+		const Vec2 uvedge01 = submesh.m_verts[i1].m_uv - submesh.m_verts[i0].m_uv;
+		const Vec2 uvedge02 = submesh.m_verts[i2].m_uv - submesh.m_verts[i0].m_uv;
+
+		F32 det = (uvedge01.y() * uvedge02.x()) - (uvedge01.x() * uvedge02.y());
+		det = (isZero(det)) ? 0.0001f : (1.0f / det);
+
+		Vec3 t = (edge02 * uvedge01.y() - edge01 * uvedge02.y()) * det;
+		Vec3 b = (edge02 * uvedge01.x() - edge01 * uvedge02.x()) * det;
+
+		if(t.getLengthSquared() < kEpsilonf)
+		{
+			t = Vec3(1.0f, 0.0f, 0.0f); // Something random
+		}
+		else
+		{
+			t.normalize();
+		}
+
+		if(b.getLengthSquared() < kEpsilonf)
+		{
+			b = Vec3(0.0f, 1.0f, 0.0f); // Something random
+		}
+		else
+		{
+			b.normalize();
+		}
+
+		submesh.m_verts[i0].m_tangent += Vec4(t, 0.0f);
+		submesh.m_verts[i1].m_tangent += Vec4(t, 0.0f);
+		submesh.m_verts[i2].m_tangent += Vec4(t, 0.0f);
+
+		bitangents[i0] += b;
+		bitangents[i1] += b;
+		bitangents[i2] += b;
+	}
+
+	for(U32 i = 0; i < vertCount; ++i)
+	{
+		Vec3 t = Vec3(submesh.m_verts[i].m_tangent.xyz());
+		const Vec3& n = submesh.m_verts[i].m_normal;
+		Vec3& b = bitangents[i];
+
+		if(t.getLengthSquared() < kEpsilonf)
+		{
+			t = Vec3(1.0f, 0.0f, 0.0f); // Something random
+		}
+		else
+		{
+			t.normalize();
+		}
+
+		if(b.getLengthSquared() < kEpsilonf)
+		{
+			b = Vec3(0.0f, 1.0f, 0.0f); // Something random
+		}
+		else
+		{
+			b.normalize();
+		}
+
+		const F32 w = ((n.cross(t)).dot(b) < 0.0f) ? 1.0f : -1.0f;
+		submesh.m_verts[i].m_tangent = Vec4(t, w);
+	}
+}
+
+static Bool isConvex(const List<SubMesh>& submeshes)
+{
+	Bool convex = true;
+	for(const SubMesh& submesh : submeshes)
+	{
+		for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
+		{
+			const U32 i0 = submesh.m_indices[i + 0];
+			const U32 i1 = submesh.m_indices[i + 1];
+			const U32 i2 = submesh.m_indices[i + 2];
+
+			const Vec3& v0 = submesh.m_verts[i0].m_position;
+			const Vec3& v1 = submesh.m_verts[i1].m_position;
+			const Vec3& v2 = submesh.m_verts[i2].m_position;
+
+			if(computeTriangleArea(v0, v1, v2) <= kEpsilonf)
+			{
+				continue;
+			}
+
+			// Check that all positions are behind the plane
+			const Plane plane(v0.xyz0(), v1.xyz0(), v2.xyz0());
+
+			for(const SubMesh& submeshB : submeshes)
+			{
+				for(const TempVertex& vertB : submeshB.m_verts)
+				{
+					const F32 test = testPlane(plane, vertB.m_position.xyz0());
+					if(test > kEpsilonf)
+					{
+						convex = false;
+						break;
+					}
+				}
+
+				if(!convex)
+				{
+					break;
+				}
+			}
+
+			if(!convex)
+			{
+				break;
+			}
+		}
+	}
+
+	return convex;
+}
+
 U32 GltfImporter::getMeshTotalVertexCount(const cgltf_mesh& mesh)
 {
 	U32 totalVertexCount = 0;
@@ -392,39 +561,8 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, U32 lod, F32 decimateFacto
 		submesh.m_aabbMax += kEpsilonf * 10.0f;
 		aabbMax = aabbMax.max(submesh.m_aabbMax);
 
-		//
-		// Fix normals. If normal A and normal B have the same position then try to merge them
-		//
-		for(U32 v = 0; v < vertCount; ++v)
-		{
-			const Vec3& pos = submesh.m_verts[v].m_position;
-			Vec3& normal = submesh.m_verts[v].m_normal;
-
-			for(U32 prevV = 0; prevV < v; ++prevV)
-			{
-				const Vec3& otherPos = submesh.m_verts[prevV].m_position;
-
-				// Check the positions dist
-				const F32 posDist = (otherPos - pos).getLengthSquared();
-				if(posDist > kEpsilonf * kEpsilonf)
-				{
-					continue;
-				}
-
-				// Check angle of the normals
-				Vec3& otherNormal = submesh.m_verts[prevV].m_normal;
-				const F32 ang = acos(clamp(otherNormal.dot(normal), -1.0f, 1.0f));
-				if(ang > m_normalsMergeAngle)
-				{
-					continue;
-				}
-
-				// Merge normals
-				const Vec3 newNormal = (otherNormal + normal).getNormalized();
-				normal = newNormal;
-				otherNormal = newNormal;
-			}
-		}
+		// Fix normals
+		fixNormals(m_normalsMergeAngle, submesh);
 
 		//
 		// Load indices
@@ -469,89 +607,8 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, U32 lod, F32 decimateFacto
 			vertCount = submesh.m_verts.getSize();
 		}
 
-		//
 		// Compute tangent
-		//
-		{
-			DynamicArrayRaii<Vec3> bitangents(m_pool);
-			bitangents.create(vertCount, Vec3(0.0f));
-
-			for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
-			{
-				const U32 i0 = submesh.m_indices[i + 0];
-				const U32 i1 = submesh.m_indices[i + 1];
-				const U32 i2 = submesh.m_indices[i + 2];
-
-				const Vec3& v0 = submesh.m_verts[i0].m_position;
-				const Vec3& v1 = submesh.m_verts[i1].m_position;
-				const Vec3& v2 = submesh.m_verts[i2].m_position;
-				const Vec3 edge01 = v1 - v0;
-				const Vec3 edge02 = v2 - v0;
-
-				const Vec2 uvedge01 = submesh.m_verts[i1].m_uv - submesh.m_verts[i0].m_uv;
-				const Vec2 uvedge02 = submesh.m_verts[i2].m_uv - submesh.m_verts[i0].m_uv;
-
-				F32 det = (uvedge01.y() * uvedge02.x()) - (uvedge01.x() * uvedge02.y());
-				det = (isZero(det)) ? 0.0001f : (1.0f / det);
-
-				Vec3 t = (edge02 * uvedge01.y() - edge01 * uvedge02.y()) * det;
-				Vec3 b = (edge02 * uvedge01.x() - edge01 * uvedge02.x()) * det;
-
-				if(t.getLengthSquared() < kEpsilonf)
-				{
-					t = Vec3(1.0f, 0.0f, 0.0f); // Something random
-				}
-				else
-				{
-					t.normalize();
-				}
-
-				if(b.getLengthSquared() < kEpsilonf)
-				{
-					b = Vec3(0.0f, 1.0f, 0.0f); // Something random
-				}
-				else
-				{
-					b.normalize();
-				}
-
-				submesh.m_verts[i0].m_tangent += Vec4(t, 0.0f);
-				submesh.m_verts[i1].m_tangent += Vec4(t, 0.0f);
-				submesh.m_verts[i2].m_tangent += Vec4(t, 0.0f);
-
-				bitangents[i0] += b;
-				bitangents[i1] += b;
-				bitangents[i2] += b;
-			}
-
-			for(U32 i = 0; i < vertCount; ++i)
-			{
-				Vec3 t = Vec3(submesh.m_verts[i].m_tangent.xyz());
-				const Vec3& n = submesh.m_verts[i].m_normal;
-				Vec3& b = bitangents[i];
-
-				if(t.getLengthSquared() < kEpsilonf)
-				{
-					t = Vec3(1.0f, 0.0f, 0.0f); // Something random
-				}
-				else
-				{
-					t.normalize();
-				}
-
-				if(b.getLengthSquared() < kEpsilonf)
-				{
-					b = Vec3(0.0f, 1.0f, 0.0f); // Something random
-				}
-				else
-				{
-					b.normalize();
-				}
-
-				const F32 w = ((n.cross(t)).dot(b) < 0.0f) ? 1.0f : -1.0f;
-				submesh.m_verts[i].m_tangent = Vec4(t, w);
-			}
-		}
+		computeTangents(submesh);
 
 		// Optimize
 		if(m_optimizeMeshes)
@@ -588,51 +645,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, U32 lod, F32 decimateFacto
 	}
 
 	// Find if it's a convex shape
-	Bool convex = true;
-	for(const SubMesh& submesh : submeshes)
-	{
-		for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
-		{
-			const U32 i0 = submesh.m_indices[i + 0];
-			const U32 i1 = submesh.m_indices[i + 1];
-			const U32 i2 = submesh.m_indices[i + 2];
-
-			const Vec3& v0 = submesh.m_verts[i0].m_position;
-			const Vec3& v1 = submesh.m_verts[i1].m_position;
-			const Vec3& v2 = submesh.m_verts[i2].m_position;
-
-			if(computeTriangleArea(v0, v1, v2) <= kEpsilonf)
-			{
-				continue;
-			}
-
-			// Check that all positions are behind the plane
-			const Plane plane(v0.xyz0(), v1.xyz0(), v2.xyz0());
-
-			for(const SubMesh& submeshB : submeshes)
-			{
-				for(const TempVertex& vertB : submeshB.m_verts)
-				{
-					const F32 test = testPlane(plane, vertB.m_position.xyz0());
-					if(test > kEpsilonf)
-					{
-						convex = false;
-						break;
-					}
-				}
-
-				if(!convex)
-				{
-					break;
-				}
-			}
-
-			if(!convex)
-			{
-				break;
-			}
-		}
-	}
+	const Bool convex = isConvex(submeshes);
 
 	// Chose the formats of the attributes
 	MeshBinaryHeader header;
@@ -641,28 +654,28 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, U32 lod, F32 decimateFacto
 		// Positions
 		MeshBinaryVertexAttribute& posa = header.m_vertexAttributes[VertexAttributeId::kPosition];
 		posa.m_bufferBinding = 0;
-		posa.m_format = Format::kR32G32B32Sfloat;
+		posa.m_format = Format::kR32G32B32_Sfloat;
 		posa.m_relativeOffset = 0;
 		posa.m_scale = 1.0f;
 
 		// Normals
 		MeshBinaryVertexAttribute& na = header.m_vertexAttributes[VertexAttributeId::kNormal];
 		na.m_bufferBinding = 1;
-		na.m_format = Format::kA2B10G10R10SnormPack32;
+		na.m_format = Format::kA2B10G10R10_Snorm_Pack32;
 		na.m_relativeOffset = 0;
 		na.m_scale = 1.0f;
 
 		// Tangents
 		MeshBinaryVertexAttribute& ta = header.m_vertexAttributes[VertexAttributeId::kTangent];
 		ta.m_bufferBinding = 1;
-		ta.m_format = Format::kA2B10G10R10SnormPack32;
+		ta.m_format = Format::kA2B10G10R10_Snorm_Pack32;
 		ta.m_relativeOffset = sizeof(U32);
 		ta.m_scale = 1.0f;
 
 		// UVs
 		MeshBinaryVertexAttribute& uva = header.m_vertexAttributes[VertexAttributeId::kUv0];
 		uva.m_bufferBinding = 1;
-		uva.m_format = Format::kR32G32Sfloat;
+		uva.m_format = Format::kR32G32_Sfloat;
 		uva.m_relativeOffset = sizeof(U32) * 2;
 		uva.m_scale = 1.0f;
 
@@ -671,13 +684,13 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, U32 lod, F32 decimateFacto
 		{
 			MeshBinaryVertexAttribute& bidxa = header.m_vertexAttributes[VertexAttributeId::kBoneIndices];
 			bidxa.m_bufferBinding = 2;
-			bidxa.m_format = Format::kR8G8B8A8Uint;
+			bidxa.m_format = Format::kR8G8B8A8_Uint;
 			bidxa.m_relativeOffset = 0;
 			bidxa.m_scale = 1.0f;
 
 			MeshBinaryVertexAttribute& wa = header.m_vertexAttributes[VertexAttributeId::kBoneWeights];
 			wa.m_bufferBinding = 2;
-			wa.m_format = Format::kR8G8B8A8Unorm;
+			wa.m_format = Format::kR8G8B8A8_Unorm;
 			wa.m_relativeOffset = sizeof(U8Vec4);
 			wa.m_scale = 1.0f;
 		}

+ 1 - 1
AnKi/Renderer/Bloom.h

@@ -41,7 +41,7 @@ public:
 	}
 
 private:
-	static constexpr Format kRtPixelFormat = Format::kA2B10G10R10UnormPack32;
+	static constexpr Format kRtPixelFormat = Format::kA2B10G10R10_Unorm_Pack32;
 
 	const Array<U32, 2> m_workgroupSize = {16, 16};
 

+ 1 - 1
AnKi/Renderer/Common.h

@@ -68,7 +68,7 @@ constexpr U32 kGBufferColorRenderTargetCount = 4;
 constexpr U32 kDownscaleBurDownTo = 32;
 
 inline constexpr Array<Format, kGBufferColorRenderTargetCount> kGBufferColorRenderTargetFormats = {
-	{Format::kR8G8B8A8Unorm, Format::kR8G8B8A8Unorm, Format::kA2B10G10R10UnormPack32, Format::kR16G16Snorm}};
+	{Format::kR8G8B8A8_Unorm, Format::kR8G8B8A8_Unorm, Format::kA2B10G10R10_Unorm_Pack32, Format::kR16G16_Snorm}};
 
 /// GPU buffers and textures that the clusterer refers to.
 class ClusteredShadingContext

+ 1 - 1
AnKi/Renderer/Dbg.cpp

@@ -32,7 +32,7 @@ Error Dbg::init()
 
 	// RT descr
 	m_rtDescr = m_r->create2DRenderTargetDescription(m_r->getInternalResolution().x(), m_r->getInternalResolution().y(),
-													 Format::kR8G8B8A8Unorm, "Dbg");
+													 Format::kR8G8B8A8_Unorm, "Dbg");
 	m_rtDescr.bake();
 
 	// Create FB descr

+ 1 - 1
AnKi/Renderer/DepthDownscale.cpp

@@ -65,7 +65,7 @@ Error DepthDownscale::initInternal()
 			usage |= TextureUsageBit::kFramebufferWrite;
 		}
 
-		TextureInitInfo texInit = m_r->create2DRenderTargetInitInfo(width, height, Format::kR32Sfloat, usage, "HiZ");
+		TextureInitInfo texInit = m_r->create2DRenderTargetInitInfo(width, height, Format::kR32_Sfloat, usage, "HiZ");
 		texInit.m_mipmapCount = U8(m_mipCount);
 		m_hizTex = m_r->createAndClearRenderTarget(texInit, TextureUsageBit::kSampledFragment);
 	}

+ 1 - 1
AnKi/Renderer/IndirectDiffuse.cpp

@@ -62,7 +62,7 @@ Error IndirectDiffuse::initInternal()
 
 		const UVec2 rez = (size + m_vrs.m_sriTexelDimension - 1) / m_vrs.m_sriTexelDimension;
 		m_vrs.m_rtHandle =
-			m_r->create2DRenderTargetDescription(rez.x(), rez.y(), Format::kR8Uint, "IndirectDiffuseVrsSri");
+			m_r->create2DRenderTargetDescription(rez.x(), rez.y(), Format::kR8_Uint, "IndirectDiffuseVrsSri");
 		m_vrs.m_rtHandle.bake();
 
 		ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/IndirectDiffuseVrsSriGeneration.ankiprogbin",

+ 2 - 2
AnKi/Renderer/MainRenderer.cpp

@@ -58,8 +58,8 @@ Error MainRenderer::init(const MainRendererInitInfo& inf)
 		alignRoundDown(2, resolution.y());
 		m_tmpRtDesc = m_r->create2DRenderTargetDescription(
 			resolution.x(), resolution.y(),
-			(m_r->getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats) ? Format::kR8G8B8Unorm
-																					   : Format::kR8G8B8A8Unorm,
+			(m_r->getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats) ? Format::kR8G8B8_Unorm
+																					   : Format::kR8G8B8A8_Unorm,
 			"Final Composite");
 		m_tmpRtDesc.bake();
 

+ 2 - 2
AnKi/Renderer/MotionVectors.cpp

@@ -43,7 +43,7 @@ Error MotionVectors::initInternal()
 
 	// RTs
 	m_motionVectorsRtDescr = m_r->create2DRenderTargetDescription(
-		m_r->getInternalResolution().x(), m_r->getInternalResolution().y(), Format::kR16G16Sfloat, "MotionVectors");
+		m_r->getInternalResolution().x(), m_r->getInternalResolution().y(), Format::kR16G16_Sfloat, "MotionVectors");
 	m_motionVectorsRtDescr.bake();
 
 	TextureUsageBit historyLengthUsage = TextureUsageBit::kAllSampled;
@@ -58,7 +58,7 @@ Error MotionVectors::initInternal()
 
 	TextureInitInfo historyLengthTexInit =
 		m_r->create2DRenderTargetInitInfo(m_r->getInternalResolution().x(), m_r->getInternalResolution().y(),
-										  Format::kR8Unorm, historyLengthUsage, "MotionVectorsHistoryLen#1");
+										  Format::kR8_Unorm, historyLengthUsage, "MotionVectorsHistoryLen#1");
 	m_historyLengthTextures[0] = m_r->createAndClearRenderTarget(historyLengthTexInit, TextureUsageBit::kAllSampled);
 	historyLengthTexInit.setName("MotionVectorsHistoryLen#2");
 	m_historyLengthTextures[1] = m_r->createAndClearRenderTarget(historyLengthTexInit, TextureUsageBit::kAllSampled);

+ 6 - 6
AnKi/Renderer/Renderer.cpp

@@ -153,7 +153,7 @@ Error Renderer::initInternal(UVec2 swapchainResolution)
 		TextureInitInfo texinit("RendererDummy");
 		texinit.m_width = texinit.m_height = 4;
 		texinit.m_usage = TextureUsageBit::kAllSampled | TextureUsageBit::kImageComputeWrite;
-		texinit.m_format = Format::kR8G8B8A8Unorm;
+		texinit.m_format = Format::kR8G8B8A8_Unorm;
 		TexturePtr tex = createAndClearRenderTarget(texinit, TextureUsageBit::kAllSampled);
 
 		TextureViewInitInfo viewinit(tex);
@@ -654,15 +654,15 @@ Format Renderer::getHdrFormat() const
 	Format out;
 	if(!m_config->getRHighQualityHdr())
 	{
-		out = Format::kB10G11R11UfloatPack32;
+		out = Format::kB10G11R11_Ufloat_Pack32;
 	}
 	else if(m_gr->getDeviceCapabilities().m_unalignedBbpTextureFormats)
 	{
-		out = Format::kR16G16B16Sfloat;
+		out = Format::kR16G16B16_Sfloat;
 	}
 	else
 	{
-		out = Format::kR16G16B16A16Sfloat;
+		out = Format::kR16G16B16A16_Sfloat;
 	}
 	return out;
 }
@@ -671,11 +671,11 @@ Format Renderer::getDepthNoStencilFormat() const
 {
 	if(ANKI_PLATFORM_MOBILE)
 	{
-		return Format::kX8D24UnormPack32;
+		return Format::kX8D24_Unorm_Pack32;
 	}
 	else
 	{
-		return Format::kD32Sfloat;
+		return Format::kD32_Sfloat;
 	}
 }
 

+ 5 - 5
AnKi/Renderer/RtShadows.cpp

@@ -133,7 +133,7 @@ Error RtShadows::initInternal()
 	// Quarter rez shadow RT
 	{
 		TextureInitInfo texinit = m_r->create2DRenderTargetInitInfo(
-			m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2, Format::kR32G32Uint,
+			m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2, Format::kR32G32_Uint,
 			TextureUsageBit::kAllSampled | TextureUsageBit::kImageTraceRaysWrite | TextureUsageBit::kImageComputeWrite,
 			"RtShadows History");
 		m_historyRt = m_r->createAndClearRenderTarget(texinit, TextureUsageBit::kSampledFragment);
@@ -143,14 +143,14 @@ Error RtShadows::initInternal()
 	{
 		m_intermediateShadowsRtDescr = m_r->create2DRenderTargetDescription(m_r->getInternalResolution().x() / 2,
 																			m_r->getInternalResolution().y() / 2,
-																			Format::kR32G32Uint, "RtShadows Tmp");
+																			Format::kR32G32_Uint, "RtShadows Tmp");
 		m_intermediateShadowsRtDescr.bake();
 	}
 
 	// Moments RT
 	{
 		TextureInitInfo texinit = m_r->create2DRenderTargetInitInfo(
-			m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2, Format::kR32G32Sfloat,
+			m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2, Format::kR32G32_Sfloat,
 			TextureUsageBit::kAllSampled | TextureUsageBit::kImageTraceRaysWrite | TextureUsageBit::kImageComputeWrite,
 			"RtShadows Moments #1");
 		m_momentsRts[0] = m_r->createAndClearRenderTarget(texinit, TextureUsageBit::kSampledFragment);
@@ -164,7 +164,7 @@ Error RtShadows::initInternal()
 	{
 		m_varianceRtDescr = m_r->create2DRenderTargetDescription(m_r->getInternalResolution().x() / 2,
 																 m_r->getInternalResolution().y() / 2,
-																 Format::kR32Sfloat, "RtShadows Variance");
+																 Format::kR32_Sfloat, "RtShadows Variance");
 		m_varianceRtDescr.bake();
 	}
 
@@ -172,7 +172,7 @@ Error RtShadows::initInternal()
 	{
 		m_upscaledRtDescr =
 			m_r->create2DRenderTargetDescription(m_r->getInternalResolution().x(), m_r->getInternalResolution().y(),
-												 Format::kR32G32Uint, "RtShadows Upscaled");
+												 Format::kR32G32_Uint, "RtShadows Upscaled");
 		m_upscaledRtDescr.bake();
 	}
 

+ 4 - 4
AnKi/Renderer/Scale.cpp

@@ -149,11 +149,11 @@ Error Scale::init()
 	}
 	else if(getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats)
 	{
-		format = Format::kR8G8B8Unorm;
+		format = Format::kR8G8B8_Unorm;
 	}
 	else
 	{
-		format = Format::kR8G8B8A8Unorm;
+		format = Format::kR8G8B8A8_Unorm;
 	}
 
 	m_upscaleAndSharpenRtDescr = m_r->create2DRenderTargetDescription(
@@ -163,8 +163,8 @@ Error Scale::init()
 	if(m_neeedsTonemapping)
 	{
 		const Format fmt = (getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats)
-							   ? Format::kR8G8B8Unorm
-							   : Format::kR8G8B8A8Unorm;
+							   ? Format::kR8G8B8_Unorm
+							   : Format::kR8G8B8A8_Unorm;
 		m_tonemapedRtDescr = m_r->create2DRenderTargetDescription(
 			m_r->getPostProcessResolution().x(), m_r->getPostProcessResolution().y(), fmt, "Tonemapped");
 		m_tonemapedRtDescr.bake();

+ 1 - 1
AnKi/Renderer/ShadowMapping.cpp

@@ -102,7 +102,7 @@ Error ShadowMapping::initAtlas()
 		m_atlas.m_tileCountBothAxis = getConfig().getRShadowMappingTileCountPerRowOrColumn();
 
 		// RT
-		const Format texFormat = (ANKI_EVSM4) ? Format::kR32G32B32A32Sfloat : Format::kR32G32Sfloat;
+		const Format texFormat = (ANKI_EVSM4) ? Format::kR32G32B32A32_Sfloat : Format::kR32G32_Sfloat;
 		TextureUsageBit usage = TextureUsageBit::kSampledFragment | TextureUsageBit::kSampledCompute;
 		usage |= (preferCompute) ? TextureUsageBit::kImageComputeWrite : TextureUsageBit::kAllFramebuffer;
 		TextureInitInfo texinit = m_r->create2DRenderTargetInitInfo(

+ 1 - 1
AnKi/Renderer/ShadowmapsResolve.cpp

@@ -35,7 +35,7 @@ Error ShadowmapsResolve::initInternal()
 
 	ANKI_R_LOGV("Initializing shadowmaps resolve. Resolution %ux%u", width, height);
 
-	m_rtDescr = m_r->create2DRenderTargetDescription(width, height, Format::kR8G8B8A8Unorm, "SM resolve");
+	m_rtDescr = m_r->create2DRenderTargetDescription(width, height, Format::kR8G8B8A8_Unorm, "SM resolve");
 	m_rtDescr.bake();
 
 	// Create FB descr

+ 2 - 2
AnKi/Renderer/TemporalAA.cpp

@@ -75,8 +75,8 @@ Error TemporalAA::initInternal()
 
 	m_tonemappedRtDescr = m_r->create2DRenderTargetDescription(
 		m_r->getInternalResolution().x(), m_r->getInternalResolution().y(),
-		(getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats) ? Format::kR8G8B8Unorm
-																			  : Format::kR8G8B8A8Unorm,
+		(getGrManager().getDeviceCapabilities().m_unalignedBbpTextureFormats) ? Format::kR8G8B8_Unorm
+																			  : Format::kR8G8B8A8_Unorm,
 		"TemporalAA Tonemapped");
 	m_tonemappedRtDescr.bake();
 

+ 1 - 1
AnKi/Renderer/Tonemapping.cpp

@@ -43,7 +43,7 @@ Error Tonemapping::initInternal()
 	// automatic image transitions
 	const TextureUsageBit usage = TextureUsageBit::kAllImage;
 	const TextureInitInfo texinit =
-		m_r->create2DRenderTargetInitInfo(1, 1, Format::kR16G16Sfloat, usage, "ExposureAndAvgLum1x1");
+		m_r->create2DRenderTargetInitInfo(1, 1, Format::kR16G16_Sfloat, usage, "ExposureAndAvgLum1x1");
 	ClearValue clearValue;
 	clearValue.m_colorf = {0.5f, 0.5f, 0.5f, 0.5f};
 	m_exposureAndAvgLuminance1x1 = m_r->createAndClearRenderTarget(texinit, TextureUsageBit::kAllImage, clearValue);

+ 1 - 1
AnKi/Renderer/VolumetricFog.cpp

@@ -43,7 +43,7 @@ Error VolumetricFog::init()
 
 	// RT descr
 	m_rtDescr =
-		m_r->create2DRenderTargetDescription(m_volumeSize[0], m_volumeSize[1], Format::kR16G16B16A16Sfloat, "Fog");
+		m_r->create2DRenderTargetDescription(m_volumeSize[0], m_volumeSize[1], Format::kR16G16B16A16_Sfloat, "Fog");
 	m_rtDescr.m_depth = m_volumeSize[2];
 	m_rtDescr.m_type = TextureType::k3D;
 	m_rtDescr.bake();

+ 1 - 1
AnKi/Renderer/VolumetricLightingAccumulation.cpp

@@ -60,7 +60,7 @@ Error VolumetricLightingAccumulation::init()
 
 	// Create RTs
 	TextureInitInfo texinit =
-		m_r->create2DRenderTargetInitInfo(m_volumeSize[0], m_volumeSize[1], Format::kR16G16B16A16Sfloat,
+		m_r->create2DRenderTargetInitInfo(m_volumeSize[0], m_volumeSize[1], Format::kR16G16B16A16_Sfloat,
 										  TextureUsageBit::kImageComputeRead | TextureUsageBit::kImageComputeWrite
 											  | TextureUsageBit::kSampledFragment | TextureUsageBit::kSampledCompute,
 										  "VolLight");

+ 2 - 2
AnKi/Renderer/VrsSriGeneration.cpp

@@ -48,11 +48,11 @@ Error VrsSriGeneration::initInternal()
 	const TextureUsageBit texUsage =
 		TextureUsageBit::kFramebufferShadingRate | TextureUsageBit::kImageComputeWrite | TextureUsageBit::kAllSampled;
 	TextureInitInfo sriInitInfo =
-		m_r->create2DRenderTargetInitInfo(rez.x(), rez.y(), Format::kR8Uint, texUsage, "VrsSri");
+		m_r->create2DRenderTargetInitInfo(rez.x(), rez.y(), Format::kR8_Uint, texUsage, "VrsSri");
 	m_sriTex = m_r->createAndClearRenderTarget(sriInitInfo, TextureUsageBit::kFramebufferShadingRate);
 
 	const UVec2 rezDownscaled = (m_r->getInternalResolution() / 2 + m_sriTexelDimension - 1) / m_sriTexelDimension;
-	sriInitInfo = m_r->create2DRenderTargetInitInfo(rezDownscaled.x(), rezDownscaled.y(), Format::kR8Uint, texUsage,
+	sriInitInfo = m_r->create2DRenderTargetInitInfo(rezDownscaled.x(), rezDownscaled.y(), Format::kR8_Uint, texUsage,
 													"VrsSriDownscaled");
 	m_downscaledSriTex = m_r->createAndClearRenderTarget(sriInitInfo, TextureUsageBit::kFramebufferShadingRate);
 

+ 12 - 12
AnKi/Resource/ImageResource.cpp

@@ -120,20 +120,20 @@ Error ImageResource::load(const ResourceFilename& filename, Bool async)
 		switch(loader.getCompression())
 		{
 		case ImageBinaryDataCompression::kRaw:
-			init.m_format = Format::kR8G8B8Unorm;
+			init.m_format = Format::kR8G8B8_Unorm;
 			break;
 		case ImageBinaryDataCompression::kS3tc:
-			init.m_format = Format::kBc1RgbUnormBlock;
+			init.m_format = Format::kBC1_Rgb_Unorm_Block;
 			break;
 		case ImageBinaryDataCompression::kAstc:
 			if(loader.getAstcBlockSize() == UVec2(4u))
 			{
-				init.m_format = Format::kAstc4x4UnormBlock;
+				init.m_format = Format::kASTC_4x4_Unorm_Block;
 			}
 			else
 			{
 				ANKI_ASSERT(loader.getAstcBlockSize() == UVec2(8u));
-				init.m_format = Format::kAstc8x8UnormBlock;
+				init.m_format = Format::kASTC_8x8_Unorm_Block;
 			}
 			break;
 		default:
@@ -145,20 +145,20 @@ Error ImageResource::load(const ResourceFilename& filename, Bool async)
 		switch(loader.getCompression())
 		{
 		case ImageBinaryDataCompression::kRaw:
-			init.m_format = Format::kR8G8B8A8Unorm;
+			init.m_format = Format::kR8G8B8A8_Unorm;
 			break;
 		case ImageBinaryDataCompression::kS3tc:
-			init.m_format = Format::kBc3UnormBlock;
+			init.m_format = Format::kBC3_Unorm_Block;
 			break;
 		case ImageBinaryDataCompression::kAstc:
 			if(loader.getAstcBlockSize() == UVec2(4u))
 			{
-				init.m_format = Format::kAstc4x4UnormBlock;
+				init.m_format = Format::kASTC_4x4_Unorm_Block;
 			}
 			else
 			{
 				ANKI_ASSERT(loader.getAstcBlockSize() == UVec2(8u));
-				init.m_format = Format::kAstc8x8UnormBlock;
+				init.m_format = Format::kASTC_8x8_Unorm_Block;
 			}
 			break;
 		default:
@@ -170,11 +170,11 @@ Error ImageResource::load(const ResourceFilename& filename, Bool async)
 		switch(loader.getCompression())
 		{
 		case ImageBinaryDataCompression::kS3tc:
-			init.m_format = Format::kBc6hUfloatBlock;
+			init.m_format = Format::kBC6H_Ufloat_Block;
 			break;
 		case ImageBinaryDataCompression::kAstc:
 			ANKI_ASSERT(loader.getAstcBlockSize() == UVec2(8u));
-			init.m_format = Format::kAstc8x8SfloatBlock;
+			init.m_format = Format::kASTC_8x8_Sfloat_Block;
 			break;
 		default:
 			ANKI_ASSERT(0);
@@ -185,11 +185,11 @@ Error ImageResource::load(const ResourceFilename& filename, Bool async)
 		switch(loader.getCompression())
 		{
 		case ImageBinaryDataCompression::kRaw:
-			init.m_format = Format::kR32G32B32A32Sfloat;
+			init.m_format = Format::kR32G32B32A32_Sfloat;
 			break;
 		case ImageBinaryDataCompression::kAstc:
 			ANKI_ASSERT(loader.getAstcBlockSize() == UVec2(8u));
-			init.m_format = Format::kAstc8x8SfloatBlock;
+			init.m_format = Format::kASTC_8x8_Sfloat_Block;
 			break;
 		default:
 			ANKI_ASSERT(0);

+ 7 - 7
AnKi/Resource/MeshBinaryLoader.cpp

@@ -137,15 +137,15 @@ Error MeshBinaryLoader::checkHeader() const
 	}
 
 	// Attributes
-	ANKI_CHECK(checkFormat(VertexAttributeId::kPosition, Array<Format, 1>{{Format::kR32G32B32Sfloat}}, 0, 0));
-	ANKI_CHECK(checkFormat(VertexAttributeId::kNormal, Array<Format, 1>{{Format::kA2B10G10R10SnormPack32}}, 1, 0));
-	ANKI_CHECK(checkFormat(VertexAttributeId::kTangent, Array<Format, 1>{{Format::kA2B10G10R10SnormPack32}}, 1, 4));
-	ANKI_CHECK(checkFormat(VertexAttributeId::kUv0, Array<Format, 1>{{Format::kR32G32Sfloat}}, 1, 8));
+	ANKI_CHECK(checkFormat(VertexAttributeId::kPosition, Array<Format, 1>{{Format::kR32G32B32_Sfloat}}, 0, 0));
+	ANKI_CHECK(checkFormat(VertexAttributeId::kNormal, Array<Format, 1>{{Format::kA2B10G10R10_Snorm_Pack32}}, 1, 0));
+	ANKI_CHECK(checkFormat(VertexAttributeId::kTangent, Array<Format, 1>{{Format::kA2B10G10R10_Snorm_Pack32}}, 1, 4));
+	ANKI_CHECK(checkFormat(VertexAttributeId::kUv0, Array<Format, 1>{{Format::kR32G32_Sfloat}}, 1, 8));
 	ANKI_CHECK(checkFormat(VertexAttributeId::kUv1, Array<Format, 1>{{Format::kNone}}, 1, 0));
 	ANKI_CHECK(
-		checkFormat(VertexAttributeId::kBoneIndices, Array<Format, 2>{{Format::kNone, Format::kR8G8B8A8Uint}}, 2, 0));
+		checkFormat(VertexAttributeId::kBoneIndices, Array<Format, 2>{{Format::kNone, Format::kR8G8B8A8_Uint}}, 2, 0));
 	ANKI_CHECK(
-		checkFormat(VertexAttributeId::kBoneWeights, Array<Format, 2>{{Format::kNone, Format::kR8G8B8A8Unorm}}, 2, 4));
+		checkFormat(VertexAttributeId::kBoneWeights, Array<Format, 2>{{Format::kNone, Format::kR8G8B8A8_Unorm}}, 2, 4));
 
 	// Vertex buffers
 	if(m_header.m_vertexBufferCount != 2 + U32(hasBoneInfo()))
@@ -277,7 +277,7 @@ Error MeshBinaryLoader::storeIndicesAndPosition(DynamicArrayRaii<U32>& indices,
 	{
 		positions.resize(m_header.m_totalVertexCount);
 		const MeshBinaryVertexAttribute& attrib = m_header.m_vertexAttributes[VertexAttributeId::kPosition];
-		ANKI_ASSERT(attrib.m_format == Format::kR32G32B32Sfloat);
+		ANKI_ASSERT(attrib.m_format == Format::kR32G32B32_Sfloat);
 		ANKI_CHECK(storeVertexBuffer(attrib.m_bufferBinding, &positions[0], positions.getSizeInBytes()));
 	}
 

+ 5 - 4
AnKi/Resource/MeshResource.cpp

@@ -61,13 +61,13 @@ MeshResource::~MeshResource()
 
 	if(m_vertexBuffersOffset != kMaxPtrSize)
 	{
-		getManager().getVertexGpuMemory().free(m_vertexBuffersSize, m_vertexBuffersOffset);
+		getManager().getVertexGpuMemory().free(m_vertexBuffersSize, 4, m_vertexBuffersOffset);
 	}
 
 	if(m_indexBufferOffset != kMaxPtrSize)
 	{
 		const PtrSize indexBufferSize = PtrSize(m_indexCount) * ((m_indexType == IndexType::kU32) ? 4 : 2);
-		getManager().getVertexGpuMemory().free(indexBufferSize, m_indexBufferOffset);
+		getManager().getVertexGpuMemory().free(indexBufferSize, getIndexSize(m_indexType), m_indexBufferOffset);
 	}
 }
 
@@ -123,7 +123,8 @@ Error MeshResource::load(const ResourceFilename& filename, Bool async)
 	m_indexType = header.m_indexType;
 
 	const PtrSize indexBufferSize = PtrSize(m_indexCount) * ((m_indexType == IndexType::kU32) ? 4 : 2);
-	ANKI_CHECK(getManager().getVertexGpuMemory().allocate(indexBufferSize, m_indexBufferOffset));
+	ANKI_CHECK(
+		getManager().getVertexGpuMemory().allocate(indexBufferSize, getIndexSize(m_indexType), m_indexBufferOffset));
 
 	//
 	// Vertex stuff
@@ -142,7 +143,7 @@ Error MeshResource::load(const ResourceFilename& filename, Bool async)
 		m_vertexBuffersSize += m_vertexCount * m_vertexBufferInfos[i].m_stride;
 	}
 
-	ANKI_CHECK(getManager().getVertexGpuMemory().allocate(m_vertexBuffersSize, m_vertexBuffersOffset));
+	ANKI_CHECK(getManager().getVertexGpuMemory().allocate(m_vertexBuffersSize, 4, m_vertexBuffersOffset));
 
 	// Readjust the individual offset now that we have a global offset
 	for(U32 i = 0; i < header.m_vertexBufferCount; ++i)

+ 3 - 3
AnKi/Scene/Components/ParticleEmitterComponent.cpp

@@ -402,9 +402,9 @@ void ParticleEmitterComponent::draw(RenderQueueDrawContext& ctx) const
 		cmdb->bindShaderProgram(prog);
 
 		// Vertex attribs
-		cmdb->setVertexAttribute(U32(VertexAttributeId::kPosition), 0, Format::kR32G32B32Sfloat, 0);
-		cmdb->setVertexAttribute(U32(VertexAttributeId::SCALE), 0, Format::kR32Sfloat, sizeof(Vec3));
-		cmdb->setVertexAttribute(U32(VertexAttributeId::ALPHA), 0, Format::kR32Sfloat, sizeof(Vec3) + sizeof(F32));
+		cmdb->setVertexAttribute(U32(VertexAttributeId::kPosition), 0, Format::kR32G32B32_Sfloat, 0);
+		cmdb->setVertexAttribute(U32(VertexAttributeId::SCALE), 0, Format::kR32_Sfloat, sizeof(Vec3));
+		cmdb->setVertexAttribute(U32(VertexAttributeId::ALPHA), 0, Format::kR32_Sfloat, sizeof(Vec3) + sizeof(F32));
 
 		// Vertex buff
 		cmdb->bindVertexBuffer(0, token.m_buffer, token.m_offset, kVertexSize, VertexStepRate::kInstance);

+ 4 - 4
AnKi/Scene/DebugDrawer.cpp

@@ -167,7 +167,7 @@ void DebugDrawer2::drawCubes(ConstWeakArray<Mat4> mvps, const Vec4& color, F32 l
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());
 
-	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32Sfloat, 0);
+	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32_Sfloat, 0);
 	cmdb->bindVertexBuffer(0, m_cubePositionsBuffer, 0, sizeof(Vec3));
 	cmdb->bindIndexBuffer(m_cubeIndicesBuffer, 0, IndexType::kU16);
 
@@ -209,7 +209,7 @@ void DebugDrawer2::drawLines(ConstWeakArray<Mat4> mvps, const Vec4& color, F32 l
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());
 
-	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32Sfloat, 0);
+	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32_Sfloat, 0);
 	cmdb->bindVertexBuffer(0, vertsToken.m_buffer, vertsToken.m_offset, sizeof(Vec3));
 
 	cmdb->bindUniformBuffer(1, 0, unisToken.m_buffer, unisToken.m_offset, unisToken.m_range);
@@ -276,8 +276,8 @@ void DebugDrawer2::drawBillboardTextures(const Mat4& projMat, const Mat3x4& view
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());
 
-	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32Sfloat, 0);
-	cmdb->setVertexAttribute(1, 1, Format::kR32G32Sfloat, 0);
+	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32_Sfloat, 0);
+	cmdb->setVertexAttribute(1, 1, Format::kR32G32_Sfloat, 0);
 	cmdb->bindVertexBuffer(0, positionsToken.m_buffer, positionsToken.m_offset, sizeof(Vec3));
 	cmdb->bindVertexBuffer(1, uvsToken.m_buffer, uvsToken.m_offset, sizeof(Vec2));
 

+ 36 - 0
AnKi/Shaders/Include/MeshTypes.h

@@ -0,0 +1,36 @@
+// Copyright (C) 2009-2022, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <AnKi/Shaders/Include/Common.h>
+
+ANKI_BEGIN_NAMESPACE
+
+// For regular geometry
+const U32 kVertexStreamPosition = 0u;
+const U32 kVertexStreamNormal = 1u;
+const U32 kVertexStreamTangent = 2u;
+const U32 kVertexStreamUv = 3u;
+const U32 kVertexStreamBoneIds = 4u;
+const U32 kVertexStreamBoneWeights = 5u;
+
+const U32 kRegularVertexStreamCount = 6u;
+
+#if __cplusplus
+inline constexpr Array<Format, kRegularVertexStreamCount> kRegularVertexStreamFormats = {
+	Format::kR32R32G32B32_Sfloat, Format::kR8G8B8A8_Snorm, Format::kR8G8B8A8_Snorm,
+	Format::R32G32_Sfloat,        Format::kR8G8B8A8_Uint,  Format::R8G8B8A8_Snorm};
+#endif
+
+// For particles
+const U32 kVertexStreamParticlePosition = 0u;
+const U32 kVertexStreamParticleScale = 1u;
+const U32 kVertexStreamParticleAlpha = 2u;
+const U32 kVertexStreamParticleLife = 3u;
+const U32 kVertexStreamParticleStartingLife = 4u;
+const U32 kVertexStreamParticlePreviousPosition = 5u;
+
+ANKI_END_NAMESPACE

+ 3 - 3
AnKi/Ui/Canvas.cpp

@@ -239,9 +239,9 @@ void Canvas::appendToCommandBufferInternal(CommandBufferPtr& cmdb)
 	cmdb->setViewport(0, 0, U32(fbWidth), U32(fbHeight));
 
 	cmdb->bindVertexBuffer(0, vertsToken.m_buffer, vertsToken.m_offset, sizeof(ImDrawVert));
-	cmdb->setVertexAttribute(0, 0, Format::kR32G32Sfloat, 0);
-	cmdb->setVertexAttribute(1, 0, Format::kR8G8B8A8Unorm, sizeof(Vec2) * 2);
-	cmdb->setVertexAttribute(2, 0, Format::kR32G32Sfloat, sizeof(Vec2));
+	cmdb->setVertexAttribute(0, 0, Format::kR32G32_Sfloat, 0);
+	cmdb->setVertexAttribute(1, 0, Format::kR8G8B8A8_Unorm, sizeof(Vec2) * 2);
+	cmdb->setVertexAttribute(2, 0, Format::kR32G32_Sfloat, sizeof(Vec2));
 
 	cmdb->bindIndexBuffer(indicesToken.m_buffer, indicesToken.m_offset, IndexType::kU16);
 

+ 1 - 1
AnKi/Ui/Font.cpp

@@ -81,7 +81,7 @@ void Font::createTexture(const void* data, U32 width, U32 height)
 	TextureInitInfo texInit("Font");
 	texInit.m_width = width;
 	texInit.m_height = height;
-	texInit.m_format = Format::kR8G8B8A8Unorm;
+	texInit.m_format = Format::kR8G8B8A8_Unorm;
 	texInit.m_usage =
 		TextureUsageBit::kTransferDestination | TextureUsageBit::kSampledFragment | TextureUsageBit::kGenerateMipmaps;
 	texInit.m_mipmapCount = 1; // No mips because it will appear blurry with trilinear filtering

+ 16 - 0
AnKi/Util/Array.h

@@ -170,6 +170,16 @@ public:
 		return kSize;
 	}
 
+	/// Fill the array.
+	void fill(Iterator begin, Iterator end, const T& val)
+	{
+		while(begin != end)
+		{
+			*begin = val;
+			++begin;
+		}
+	}
+
 	// Get size in bytes
 #define ANKI_ARRAY_SIZE_IN_BYTES_METHOD(type, condition) \
 	ANKI_ENABLE_METHOD(condition) \
@@ -184,6 +194,12 @@ public:
 #undef ANKI_ARRAY_SIZE_IN_BYTES_METHOD
 };
 
+// Some trick stolen from GCC's std::array. It allows deduction of Array's template params. For example you can write:
+// Array a{1, 2, 3};
+template<typename TFirst, typename... TRest>
+Array(TFirst, TRest...)
+	-> Array<std::enable_if_t<(std::is_same_v<TFirst, TRest> && ...), TFirst>, 1 + sizeof...(TRest)>;
+
 /// 2D Array. @code Array2d<X, 10, 2> a; @endcode is equivelent to @code X a[10][2]; @endcode
 template<typename T, PtrSize I, PtrSize J>
 using Array2d = Array<Array<T, J>, I>;

+ 1 - 1
Samples/Sponza/Assets/Scene.lua

@@ -1,4 +1,4 @@
--- Generated by: /home/godlike/src/anki/buildd/Bin/GltfImporter sponza_crytek_7_pbr_3.0.gltf /home/godlike/src/anki/Samples/Sponza/Assets/ -rpath Assets -texrpath Assets -lod-count 2 -light-scale 0.01
+-- Generated by: C:\Users\godli\src\anki\out\build\x64-Debug\Bin\GltfImporter.exe sponza_crytek_7_pbr_3.0.gltf C:/Users/godli/src/anki/Samples/Sponza/Assets/ -rpath Assets -texrpath Assets -lod-count 2 -light-scale 0.01
 local scene = getSceneGraph()
 local events = getEventManager()
 

+ 17 - 17
Tests/Gr/Gr.cpp

@@ -305,7 +305,7 @@ static void* setStorage(PtrSize size, CommandBufferPtr& cmdb, U32 set, U32 bindi
 		cmdb_->copyBufferToTextureView(handle_.getBuffer(), handle_.getOffset(), handle_.getRange(), view); \
 	} while(0)
 
-constexpr Format kDsFormat = Format::kD24UnormS8Uint;
+constexpr Format kDsFormat = Format::kD24_Unorm_S8_Uint;
 
 static ShaderProgramPtr createProgram(CString vertSrc, CString fragSrc, GrManager& gr)
 {
@@ -656,7 +656,7 @@ void main()
 	ShaderProgramPtr prog = createProgram(VERT_QUAD_STRIP_SRC, kFragSrc, *g_gr);
 	ShaderProgramPtr blitProg = createProgram(VERT_QUAD_SRC, FRAG_TEX_SRC, *g_gr);
 
-	const Format COL_FORMAT = Format::kR8G8B8A8Unorm;
+	const Format COL_FORMAT = Format::kR8G8B8A8_Unorm;
 	const U RT_WIDTH = 32;
 	const U RT_HEIGHT = 16;
 	TextureInitInfo init;
@@ -923,9 +923,9 @@ ANKI_TEST(Gr, DrawWithVertex)
 
 		cmdb->bindVertexBuffer(0, b, 0, sizeof(Vert));
 		cmdb->bindVertexBuffer(1, c, 0, sizeof(Vec3));
-		cmdb->setVertexAttribute(0, 0, Format::kR32G32B32Sfloat, 0);
-		cmdb->setVertexAttribute(1, 0, Format::kR8G8B8Unorm, sizeof(Vec3));
-		cmdb->setVertexAttribute(2, 1, Format::kR32G32B32Sfloat, 0);
+		cmdb->setVertexAttribute(0, 0, Format::kR32G32B32_Sfloat, 0);
+		cmdb->setVertexAttribute(1, 0, Format::kR8G8B8_Unorm, sizeof(Vec3));
+		cmdb->setVertexAttribute(2, 1, Format::kR32G32B32_Sfloat, 0);
 
 		cmdb->setViewport(0, 0, g_win->getWidth(), g_win->getHeight());
 		cmdb->setPolygonOffset(0.0, 0.0);
@@ -967,7 +967,7 @@ ANKI_TEST(Gr, Texture)
 
 	TextureInitInfo init;
 	init.m_depth = 1;
-	init.m_format = Format::kR8G8B8Unorm;
+	init.m_format = Format::kR8G8B8_Unorm;
 	init.m_usage = TextureUsageBit::kSampledFragment;
 	init.m_height = 4;
 	init.m_width = 4;
@@ -1003,7 +1003,7 @@ ANKI_TEST(Gr, DrawWithTexture)
 	//
 	TextureInitInfo init;
 	init.m_depth = 1;
-	init.m_format = Format::kR8G8B8Unorm;
+	init.m_format = Format::kR8G8B8_Unorm;
 	init.m_usage = TextureUsageBit::kSampledFragment | TextureUsageBit::kTransferDestination;
 	init.m_height = 2;
 	init.m_width = 2;
@@ -1199,7 +1199,7 @@ static void drawOffscreenDrawcalls([[maybe_unused]] GrManager& gr, ShaderProgram
 	*color = Vec4(0.0, 1.0, 0.0, 0.0);
 
 	cmdb->bindVertexBuffer(0, vertBuff, 0, sizeof(Vec3));
-	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32Sfloat, 0);
+	cmdb->setVertexAttribute(0, 0, Format::kR32G32B32_Sfloat, 0);
 	cmdb->bindShaderProgram(prog);
 	cmdb->bindIndexBuffer(indexBuff, 0, IndexType::kU16);
 	cmdb->setViewport(0, 0, viewPortSize, viewPortSize);
@@ -1228,7 +1228,7 @@ static void drawOffscreen(GrManager& gr, Bool useSecondLevel)
 	samplerInit.m_mipmapFilter = SamplingFilter::kLinear;
 	SamplerPtr sampler = gr.newSampler(samplerInit);
 
-	const Format COL_FORMAT = Format::kR8G8B8A8Unorm;
+	const Format COL_FORMAT = Format::kR8G8B8A8_Unorm;
 	const U TEX_SIZE = 256;
 
 	TextureInitInfo init;
@@ -1389,7 +1389,7 @@ ANKI_TEST(Gr, ImageLoadStore)
 	init.m_usage =
 		TextureUsageBit::kTransferDestination | TextureUsageBit::kAllSampled | TextureUsageBit::kImageComputeWrite;
 	init.m_type = TextureType::k2D;
-	init.m_format = Format::kR8G8B8A8Unorm;
+	init.m_format = Format::kR8G8B8A8_Unorm;
 
 	TexturePtr tex = g_gr->newTexture(init);
 
@@ -1502,7 +1502,7 @@ ANKI_TEST(Gr, 3DTextures)
 	//
 	TextureInitInfo init;
 	init.m_depth = 1;
-	init.m_format = Format::kR8G8B8A8Unorm;
+	init.m_format = Format::kR8G8B8A8_Unorm;
 	init.m_usage = TextureUsageBit::kSampledFragment | TextureUsageBit::kTransferDestination;
 	init.m_height = 2;
 	init.m_width = 2;
@@ -1608,7 +1608,7 @@ static RenderTargetDescription newRTDescr(CString name)
 	RenderTargetDescription texInf(name);
 	texInf.m_width = texInf.m_height = 16;
 	texInf.m_usage = TextureUsageBit::kFramebufferWrite | TextureUsageBit::kSampledFragment;
-	texInf.m_format = Format::kR8G8B8A8Unorm;
+	texInf.m_format = Format::kR8G8B8A8_Unorm;
 	texInf.bake();
 	return texInf;
 }
@@ -1626,7 +1626,7 @@ ANKI_TEST(Gr, RenderGraph)
 	TextureInitInfo texI("dummy");
 	texI.m_width = texI.m_height = 16;
 	texI.m_usage = TextureUsageBit::kFramebufferWrite | TextureUsageBit::kSampledFragment;
-	texI.m_format = Format::kR8G8B8A8Unorm;
+	texI.m_format = Format::kR8G8B8A8_Unorm;
 	TexturePtr dummyTex = g_gr->newTexture(texI);
 
 	// SM
@@ -1858,7 +1858,7 @@ void main()
 	// Create the texture
 	TextureInitInfo texInit;
 	texInit.m_width = texInit.m_height = 8;
-	texInit.m_format = Format::kR8G8B8Uint;
+	texInit.m_format = Format::kR8G8B8_Uint;
 	texInit.m_type = TextureType::k2D;
 	texInit.m_usage = TextureUsageBit::kTransferDestination | TextureUsageBit::kAllSampled;
 	texInit.m_mipmapCount = 2;
@@ -2505,7 +2505,7 @@ ANKI_TEST(Gr, RayQuery)
 		init.m_bottomLevel.m_indexType = IndexType::kU16;
 		init.m_bottomLevel.m_positionBuffer = vertBuffer;
 		init.m_bottomLevel.m_positionCount = 3;
-		init.m_bottomLevel.m_positionsFormat = Format::kR32G32B32Sfloat;
+		init.m_bottomLevel.m_positionsFormat = Format::kR32G32B32_Sfloat;
 		init.m_bottomLevel.m_positionStride = 4 * 4;
 
 		blas = g_gr->newAccelerationStructure(init);
@@ -2852,7 +2852,7 @@ ANKI_TEST(Gr, RayGen)
 		TextureInitInfo inf("T_offscreen#1");
 		inf.m_width = WIDTH;
 		inf.m_height = HEIGHT;
-		inf.m_format = Format::kR8G8B8A8Unorm;
+		inf.m_format = Format::kR8G8B8A8_Unorm;
 		inf.m_usage = TextureUsageBit::kImageTraceRaysRead | TextureUsageBit::kImageTraceRaysWrite
 					  | TextureUsageBit::kImageComputeRead;
 
@@ -2959,7 +2959,7 @@ void main()
 			inf.m_bottomLevel.m_indexCount = g.m_indexCount;
 			inf.m_bottomLevel.m_positionBuffer = g.m_vertexBuffer;
 			inf.m_bottomLevel.m_positionCount = 8;
-			inf.m_bottomLevel.m_positionsFormat = Format::kR32G32B32Sfloat;
+			inf.m_bottomLevel.m_positionsFormat = Format::kR32G32B32_Sfloat;
 			inf.m_bottomLevel.m_positionStride = sizeof(Vec3);
 
 			g.m_blas = g_gr->newAccelerationStructure(inf);

+ 1 - 1
Tests/Gr/GrTextureBuffer.cpp

@@ -59,7 +59,7 @@ void main()
 		cmdbInit.m_flags = CommandBufferFlag::kSmallBatch | CommandBufferFlag::kGeneralWork;
 		CommandBufferPtr cmdb = gr->newCommandBuffer(cmdbInit);
 
-		cmdb->bindReadOnlyTextureBuffer(0, 0, texBuff, 0, kMaxPtrSize, Format::kR8G8B8A8Snorm);
+		cmdb->bindReadOnlyTextureBuffer(0, 0, texBuff, 0, kMaxPtrSize, Format::kR8G8B8A8_Snorm);
 		cmdb->bindStorageBuffer(0, 1, storageBuff, 0, kMaxPtrSize);
 		cmdb->bindShaderProgram(prog);
 		cmdb->dispatchCompute(1, 1, 1);