Prevent BC6h decoder from using global constructor

By using a C array instead of a std::vector, the data tables for BC6h
are initialized without a constructor. This helps lower SwiftShader's
startup costs.

Tests: dEQP-VK.*bc6*
Bug: b/174782098
Change-Id: I9bcfa2753bc6255ff16543d424cf8936c2817148
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/54788
Reviewed-by: Alexis H├ętu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Sean Risser <srisser@google.com>
Commit-Queue: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Device/BC_Decoder.cpp b/src/Device/BC_Decoder.cpp
index b2a7241..d91235f 100644
--- a/src/Device/BC_Decoder.cpp
+++ b/src/Device/BC_Decoder.cpp
@@ -634,6 +634,7 @@
 	EP3 = 3,
 	Mode,
 	Partition,
+	End,
 };
 
 enum Channel
@@ -720,13 +721,43 @@
 	}
 };
 
+// Turns a legal mode into an index into the BlockDesc table.
+// Illegal or reserved modes return -1.
+int getIndex(uint8_t mode)
+{
+	if(mode <= 3)
+	{
+		return mode;
+	}
+	else if((mode & 0x2) != 0)
+	{
+		if(mode <= 18)
+		{
+			// Turns 6 into 4, 7 into 5, 10 into 6, etc.
+			return (mode / 2) + 1 + (mode & 0x1);
+		}
+		else if(mode == 22 || mode == 26 || mode == 30)
+		{
+			// Turns 22 into 11, 26 into 12, etc.
+			return mode / 4 + 6;
+		}
+	}
+
+	return -1;
+}
+
+static constexpr int NumBlocks = 14;
+// The largest number of descriptions within a block.
+static constexpr int MaxBlockDescIndex = 26;
+
 // Table describing the bitfields for each mode from the LSB to the MSB before
 // the index data starts.
 //
 // The numbers come from the BC6h block description. The basic format is a list of bitfield
 // descriptors of the form:
 //   {Type, Channel, MSB, LSB}
-//   * Type describes which endpoint this is, or if this is a mode or a partition number.
+//   * Type describes which endpoint this is, or if this is a mode, a partition number,
+//     or the end of the block description.
 //   * Channel describes one of the 3 color channels within an endpoint
 //   * MSB and LSB specificy:
 //      * The size of the bitfield being read
@@ -736,172 +767,170 @@
 //     is abs(MSB-LSB+1). And the position of the bitfield within the variable is
 //     min(LSB, MSB).
 //
-// Invalid or reserved modes do not have any fields within them.
-static const std::vector<BlockDesc> blockDescs[32] = {
+// Invalid or reserved modes are not present in the array.
+static const BlockDesc blockDescs[NumBlocks][MaxBlockDescIndex] = {
 	// clang-format off
-	// Mode 0
-	{ { Mode, None, 1, 0, { 0, true, 2, 10, { 5, 5, 5 } } },
-	  { EP2, G, 4, 4 }, { EP2, B, 4, 4 }, { EP3, B, 4, 4 },
-	  { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	  { EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
-	  { EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
-	  { EP1, B, 4, 0 }, { EP3, B, 1, 1 }, { EP2, B, 3, 0 },
-	  { EP2, R, 4, 0 }, { EP3, B, 2, 2 }, { EP3, R, 4, 0 },
-	  { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 1
-	{ { Mode, None, 1, 0, { 1, true, 2, 7, { 6, 6, 6 } } },
-	  { EP2, G, 5, 5 }, { EP3, G, 5, 4 }, { EP0, R, 6, 0 },
-	  { EP3, B, 1, 0 }, { EP2, B, 4, 4 }, { EP0, G, 6, 0 },
-	  { EP2, B, 5, 5 }, { EP3, B, 2, 2 }, { EP2, G, 4, 4 },
-	  { EP0, B, 6, 0 }, { EP3, B, 3, 3 }, { EP3, B, 5, 5 },
-      { EP3, B, 4, 4 }, { EP1, R, 5, 0 }, { EP2, G, 3, 0 },
-      { EP1, G, 5, 0 }, { EP3, G, 3, 0 }, { EP1, B, 5, 0 },
-      { EP2, B, 3, 0 }, { EP2, R, 5, 0 }, { EP3, R, 5, 0 },
-	  { Partition, None, 4, 0 } },
-	// Mode 2
-	{ { Mode, None, 4, 0, { 2, true, 2, 11, { 5, 4, 4 } } },
-	  { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	  { EP1, R, 4, 0 }, { EP0, R, 10, 10 }, { EP2, G, 3, 0 },
-	  { EP1, G, 3, 0 }, { EP0, G, 10, 10 }, { EP3, B, 0, 0 },
-	  { EP3, G, 3, 0 }, { EP1, B, 3, 0 }, { EP0, B, 10, 10 },
-	  { EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
-	  { EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 3
+	// Mode 0, Index 0
 	{
-	    { Mode, None, 4, 0, { 3, false, 1, 10, { 0, 0, 0 } } },
-	    { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	    { EP1, R, 9, 0 }, { EP1, G, 9, 0 }, { EP1, B, 9, 0 },
+		{ Mode, None, 1, 0, { 0, true, 2, 10, { 5, 5, 5 } } },
+		{ EP2, G, 4, 4 }, { EP2, B, 4, 4 }, { EP3, B, 4, 4 },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
+		{ EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
+		{ EP1, B, 4, 0 }, { EP3, B, 1, 1 }, { EP2, B, 3, 0 },
+		{ EP2, R, 4, 0 }, { EP3, B, 2, 2 }, { EP3, R, 4, 0 },
+		{ EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
 	},
-	// Mode 4: Illegal
-	{},
-	// Mode 5: Illegal
-	{},
-	// Mode 6
-	{ { Mode, None, 4, 0, { 6, true, 2, 11, { 4, 5, 4 } } },
-	  { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	  { EP1, R, 3, 0 }, { EP0, R, 10, 10 }, { EP3, G, 4, 4 },
-	  { EP2, G, 3, 0 }, { EP1, G, 4, 0 }, { EP0, G, 10, 10 },
-	  { EP3, G, 3, 0 }, { EP1, B, 3, 0 }, { EP0, B, 10, 10 },
-	  { EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 3, 0 },
-	  { EP3, B, 0, 0 }, { EP3, B, 2, 2 }, { EP3, R, 3, 0 },
-	  { EP2, G, 4, 4 }, { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 7
+	// Mode 1, Index 1
 	{
-	    { Mode, None, 4, 0, { 7, true, 1, 11, { 9, 9, 9 } } },
-	    { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	    { EP1, R, 8, 0 }, { EP0, R, 10, 10 }, { EP1, G, 8, 0 },
-	    { EP0, G, 10, 10 }, { EP1, B, 8, 0 }, { EP0, B, 10, 10 },
+		{ Mode, None, 1, 0, { 1, true, 2, 7, { 6, 6, 6 } } },
+		{ EP2, G, 5, 5 }, { EP3, G, 5, 4 }, { EP0, R, 6, 0 },
+		{ EP3, B, 1, 0 }, { EP2, B, 4, 4 }, { EP0, G, 6, 0 },
+		{ EP2, B, 5, 5 }, { EP3, B, 2, 2 }, { EP2, G, 4, 4 },
+		{ EP0, B, 6, 0 }, { EP3, B, 3, 3 }, { EP3, B, 5, 5 },
+		{ EP3, B, 4, 4 }, { EP1, R, 5, 0 }, { EP2, G, 3, 0 },
+		{ EP1, G, 5, 0 }, { EP3, G, 3, 0 }, { EP1, B, 5, 0 },
+		{ EP2, B, 3, 0 }, { EP2, R, 5, 0 }, { EP3, R, 5, 0 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
 	},
-	// Mode 8: Illegal
-	{},
-	// Mode 9: Illegal
-	{},
-	// Mode 10
-	{ { Mode, None, 4, 0, { 10, true, 2, 11, { 4, 4, 5 } } },
-	  { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	  { EP1, R, 3, 0 }, { EP0, R, 10, 10 }, { EP2, B, 4, 4 },
-	  { EP2, G, 3, 0 }, { EP1, G, 3, 0 }, { EP0, G, 10, 10 },
-	  { EP3, B, 0, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
-	  { EP0, B, 10, 10 }, { EP2, B, 3, 0 }, { EP2, R, 3, 0 },
-	  { EP3, B, 1, 1 }, { EP3, B, 2, 2 }, { EP3, R, 3, 0 },
-      { EP3, B, 4, 4 }, { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 11
+	// Mode 2, Index 2
 	{
-	    { Mode, None, 4, 0, { 11, true, 1, 12, { 8, 8, 8 } } },
-	    { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	    { EP1, R, 7, 0 }, { EP0, R, 10, 11 }, { EP1, G, 7, 0 },
-	    { EP0, G, 10, 11 }, { EP1, B, 7, 0 }, { EP0, B, 10, 11 },
+		{ Mode, None, 4, 0, { 2, true, 2, 11, { 5, 4, 4 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 4, 0 }, { EP0, R, 10, 10 }, { EP2, G, 3, 0 },
+		{ EP1, G, 3, 0 }, { EP0, G, 10, 10 }, { EP3, B, 0, 0 },
+		{ EP3, G, 3, 0 }, { EP1, B, 3, 0 }, { EP0, B, 10, 10 },
+		{ EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
+		{ EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
 	},
-	// Mode 12: Illegal
-	{},
-	// Mode 13: Illegal
-	{},
-	// Mode 14
-	{ { Mode, None, 4, 0, { 14, true, 2, 9, { 5, 5, 5 } } },
-	  { EP0, R, 8, 0 }, { EP2, B, 4, 4 }, { EP0, G, 8, 0 },
-	  { EP2, G, 4, 4 }, { EP0, B, 8, 0 }, { EP3, B, 4, 4 },
-	  { EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
-	  { EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
-	  { EP1, B, 4, 0 }, { EP3, B, 1, 1 }, { EP2, B, 3, 0 },
-	  { EP2, R, 4, 0 }, { EP3, B, 2, 2 }, { EP3, R, 4, 0 },
-	  { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 15
+	// Mode 3, Index 3
 	{
-	    { Mode, None, 4, 0, { 15, true, 1, 16, { 4, 4, 4 } } },
-	    { EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
-	    { EP1, R, 3, 0 }, { EP0, R, 10, 15 }, { EP1, G, 3, 0 },
-	    { EP0, G, 10, 15 }, { EP1, B, 3, 0 }, { EP0, B, 10, 15 },
+		{ Mode, None, 4, 0, { 3, false, 1, 10, { 0, 0, 0 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 9, 0 }, { EP1, G, 9, 0 }, { EP1, B, 9, 0 },
+		{ End, None, 0, 0},
 	},
-	// Mode 16: Illegal
-	{},
-	// Mode 17: Illegal
-	{},
-	// Mode 18
-	{ { Mode, None, 4, 0, { 18, true, 2, 8, { 6, 5, 5 } } },
-	  { EP0, R, 7, 0 }, { EP3, G, 4, 4 }, { EP2, B, 4, 4 },
-	  { EP0, G, 7, 0 }, { EP3, B, 2, 2 }, { EP2, G, 4, 4 },
-	  { EP0, B, 7, 0 }, { EP3, B, 3, 3 }, { EP3, B, 4, 4 },
-      { EP1, R, 5, 0 }, { EP2, G, 3, 0 }, { EP1, G, 4, 0 },
-      { EP3, B, 0, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
-      { EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 5, 0 },
-      { EP3, R, 5, 0 },
-	  { Partition, None, 4, 0 } },
-	// Mode 19: Reserved
-	{},
-	// Mode 20: Illegal
-	{},
-	// Mode 21: Illegal
-	{},
-	// Mode 22:
-	{ { Mode, None, 4, 0, { 22, true, 2, 8, { 5, 6, 5 } } },
-	  { EP0, R, 7, 0 }, { EP3, B, 0, 0 }, { EP2, B, 4, 4 },
-	  { EP0, G, 7, 0 }, { EP2, G, 5, 5 }, { EP2, G, 4, 4 },
-      { EP0, B, 7, 0 }, { EP3, G, 5, 5 }, { EP3, B, 4, 4 },
-      { EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
-      { EP1, G, 5, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
-      { EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
-      { EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 23: Reserved
-	{},
-	// Mode 24: Illegal
-	{},
-	// Mode 25: Illegal
-	{},
-	// Mode 26
-	{ { Mode, None, 4, 0, { 26, true, 2, 8, { 5, 5, 6 } } },
-	  { EP0, R, 7, 0 }, { EP3, B, 1, 1 }, { EP2, B, 4, 4 },
-	  { EP0, G, 7, 0 }, { EP2, B, 5, 5 }, { EP2, G, 4, 4 },
-	  { EP0, B, 7, 0 }, { EP3, B, 5, 5 }, { EP3, B, 4, 4 },
-      { EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
-      { EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
-      { EP1, B, 5, 0 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
-      { EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
-	  { Partition, None, 4, 0 } },
-	// Mode 27: Reserved
-	{},
-	// Mode 28: Illegal
-	{},
-	// Mode 29: Illegal
-	{},
-	// Mode 30
-	{ { Mode, None, 4, 0, { 30, false, 2, 6, { 0, 0, 0 } } },
-	  { EP0, R, 5, 0 }, { EP3, G, 4, 4 }, { EP3, B, 0, 0 },
-      { EP3, B, 1, 1 }, { EP2, B, 4, 4 }, { EP0, G, 5, 0 },
-      { EP2, G, 5, 5 }, { EP2, B, 5, 5 }, { EP3, B, 2, 2 },
-      { EP2, G, 4, 4 }, { EP0, B, 5, 0 }, { EP3, G, 5, 5 },
-      { EP3, B, 3, 3 }, { EP3, B, 5, 5 }, { EP3, B, 4, 4 },
-      { EP1, R, 5, 0 }, { EP2, G, 3, 0 }, { EP1, G, 5, 0 },
-      { EP3, G, 3, 0 }, { EP1, B, 5, 0 }, { EP2, B, 3, 0 },
-      { EP2, R, 5, 0 }, { EP3, R, 5, 0 },
-	  { Partition, None, 4, 0 } },
-	// Mode 31: Reserved
-	{},
+	// Mode 6, Index 4
+	{
+		{ Mode, None, 4, 0, { 6, true, 2, 11, { 4, 5, 4 } } }, // 1 1
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 3, 0 }, { EP0, R, 10, 10 }, { EP3, G, 4, 4 },
+		{ EP2, G, 3, 0 }, { EP1, G, 4, 0 }, { EP0, G, 10, 10 },
+		{ EP3, G, 3, 0 }, { EP1, B, 3, 0 }, { EP0, B, 10, 10 },
+		{ EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 3, 0 },
+		{ EP3, B, 0, 0 }, { EP3, B, 2, 2 }, { EP3, R, 3, 0 }, // 18 19
+		{ EP2, G, 4, 4 }, { EP3, B, 3, 3 }, // 2 21
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 7, Index 5
+	{
+		{ Mode, None, 4, 0, { 7, true, 1, 11, { 9, 9, 9 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 8, 0 }, { EP0, R, 10, 10 }, { EP1, G, 8, 0 },
+		{ EP0, G, 10, 10 }, { EP1, B, 8, 0 }, { EP0, B, 10, 10 },
+		{ End, None, 0, 0},
+	},
+	// Mode 10, Index 6
+	{
+		{ Mode, None, 4, 0, { 10, true, 2, 11, { 4, 4, 5 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 3, 0 }, { EP0, R, 10, 10 }, { EP2, B, 4, 4 },
+		{ EP2, G, 3, 0 }, { EP1, G, 3, 0 }, { EP0, G, 10, 10 },
+		{ EP3, B, 0, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
+		{ EP0, B, 10, 10 }, { EP2, B, 3, 0 }, { EP2, R, 3, 0 },
+		{ EP3, B, 1, 1 }, { EP3, B, 2, 2 }, { EP3, R, 3, 0 },
+		{ EP3, B, 4, 4 }, { EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 11, Index 7
+	{
+		{ Mode, None, 4, 0, { 11, true, 1, 12, { 8, 8, 8 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 7, 0 }, { EP0, R, 10, 11 }, { EP1, G, 7, 0 },
+		{ EP0, G, 10, 11 }, { EP1, B, 7, 0 }, { EP0, B, 10, 11 },
+		{ End, None, 0, 0},
+	},
+	// Mode 14, Index 8
+	{
+		{ Mode, None, 4, 0, { 14, true, 2, 9, { 5, 5, 5 } } },
+		{ EP0, R, 8, 0 }, { EP2, B, 4, 4 }, { EP0, G, 8, 0 },
+		{ EP2, G, 4, 4 }, { EP0, B, 8, 0 }, { EP3, B, 4, 4 },
+		{ EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
+		{ EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
+		{ EP1, B, 4, 0 }, { EP3, B, 1, 1 }, { EP2, B, 3, 0 },
+		{ EP2, R, 4, 0 }, { EP3, B, 2, 2 }, { EP3, R, 4, 0 },
+		{ EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 15, Index 9
+	{
+		{ Mode, None, 4, 0, { 15, true, 1, 16, { 4, 4, 4 } } },
+		{ EP0, R, 9, 0 }, { EP0, G, 9, 0 }, { EP0, B, 9, 0 },
+		{ EP1, R, 3, 0 }, { EP0, R, 10, 15 }, { EP1, G, 3, 0 },
+		{ EP0, G, 10, 15 }, { EP1, B, 3, 0 }, { EP0, B, 10, 15 },
+		{ End, None, 0, 0},
+	},
+	// Mode 18, Index 10
+	{
+		{ Mode, None, 4, 0, { 18, true, 2, 8, { 6, 5, 5 } } },
+		{ EP0, R, 7, 0 }, { EP3, G, 4, 4 }, { EP2, B, 4, 4 },
+		{ EP0, G, 7, 0 }, { EP3, B, 2, 2 }, { EP2, G, 4, 4 },
+		{ EP0, B, 7, 0 }, { EP3, B, 3, 3 }, { EP3, B, 4, 4 },
+		{ EP1, R, 5, 0 }, { EP2, G, 3, 0 }, { EP1, G, 4, 0 },
+		{ EP3, B, 0, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
+		{ EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 5, 0 },
+		{ EP3, R, 5, 0 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 22, Index 11
+	{
+		{ Mode, None, 4, 0, { 22, true, 2, 8, { 5, 6, 5 } } },
+		{ EP0, R, 7, 0 }, { EP3, B, 0, 0 }, { EP2, B, 4, 4 },
+		{ EP0, G, 7, 0 }, { EP2, G, 5, 5 }, { EP2, G, 4, 4 },
+		{ EP0, B, 7, 0 }, { EP3, G, 5, 5 }, { EP3, B, 4, 4 },
+		{ EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
+		{ EP1, G, 5, 0 }, { EP3, G, 3, 0 }, { EP1, B, 4, 0 },
+		{ EP3, B, 1, 1 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
+		{ EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 26, Index 12
+	{
+		{ Mode, None, 4, 0, { 26, true, 2, 8, { 5, 5, 6 } } },
+		{ EP0, R, 7, 0 }, { EP3, B, 1, 1 }, { EP2, B, 4, 4 },
+		{ EP0, G, 7, 0 }, { EP2, B, 5, 5 }, { EP2, G, 4, 4 },
+		{ EP0, B, 7, 0 }, { EP3, B, 5, 5 }, { EP3, B, 4, 4 },
+		{ EP1, R, 4, 0 }, { EP3, G, 4, 4 }, { EP2, G, 3, 0 },
+		{ EP1, G, 4, 0 }, { EP3, B, 0, 0 }, { EP3, G, 3, 0 },
+		{ EP1, B, 5, 0 }, { EP2, B, 3, 0 }, { EP2, R, 4, 0 },
+		{ EP3, B, 2, 2 }, { EP3, R, 4, 0 }, { EP3, B, 3, 3 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	},
+	// Mode 30, Index 13
+	{
+		{ Mode, None, 4, 0, { 30, false, 2, 6, { 0, 0, 0 } } },
+		{ EP0, R, 5, 0 }, { EP3, G, 4, 4 }, { EP3, B, 0, 0 },
+		{ EP3, B, 1, 1 }, { EP2, B, 4, 4 }, { EP0, G, 5, 0 },
+		{ EP2, G, 5, 5 }, { EP2, B, 5, 5 }, { EP3, B, 2, 2 },
+		{ EP2, G, 4, 4 }, { EP0, B, 5, 0 }, { EP3, G, 5, 5 },
+		{ EP3, B, 3, 3 }, { EP3, B, 5, 5 }, { EP3, B, 4, 4 },
+		{ EP1, R, 5, 0 }, { EP2, G, 3, 0 }, { EP1, G, 5, 0 },
+		{ EP3, G, 3, 0 }, { EP1, B, 5, 0 }, { EP2, B, 3, 0 },
+		{ EP2, R, 5, 0 }, { EP3, R, 5, 0 },
+		{ Partition, None, 4, 0 },
+		{ End, None, 0, 0},
+	}
 	// clang-format on
 };
 
@@ -925,8 +954,9 @@
 			mode = data.consumeBits(4, 0);
 		}
 
-		// Illegal or reserved mode
-		if(blockDescs[mode].size() == 0)
+		int index = getIndex(mode);
+		// Handle illegal or reserved mode
+		if(index < 0)
 		{
 			for(int y = 0; y < 4 && y + dstY < dstHeight; y++)
 			{
@@ -944,10 +974,13 @@
 
 		int partition = 0;
 		ModeDesc modeDesc;
-		// For assertion checks
-		modeDesc.number = -1;
-		for(auto desc : blockDescs[mode])
+		for(auto desc : blockDescs[index])
 		{
+			if(desc.type == End)
+			{
+				break;
+			}
+
 			switch(desc.type)
 			{
 			case Mode:
@@ -982,8 +1015,6 @@
 			}
 		}
 
-		ASSERT_MSG(modeDesc.number != -1, "Failed to decode mode %d", mode);
-
 		// Sign extension
 		if(isSigned)
 		{