Format switch statements consistently

Each non-fallthrough case should end with a break (or return). If a
scope is needed because local variables are defined, it should end
before this break.

This avoids bugs such as:

switch(i)
{
case 0:
    if(c)
    {
        // lots
        // of
        // code

        // Easy to misread as always breaking instead of conditionally
        // falling through due to not spotting the if(c).
        break;
    }

case 1:
    // ...
}

The new scope should also be indented. It makes it easier to spot where
each case ends and where the switch ends. This is achieved by setting
IndentCaseBlocks to true.

Lastly, the case labels themselves should not be indented. Like goto
labels they mark where in the code to jump to, and the code itself is
already indented within the switch block.

Bug: b/144825072
Change-Id: I9a130d1d234795f53b5872e411f1315f56a0e908
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39551
Commit-Queue: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis H├ętu <sugoi@google.com>
diff --git a/.clang-format b/.clang-format
index d5c422b..5a7a390 100644
--- a/.clang-format
+++ b/.clang-format
@@ -71,8 +71,8 @@
   - Regex:           '.*'
     Priority:        5
 IncludeIsMainRegex: '([-_](test|unittest))?$'
-IndentCaseBlocks: false
-IndentCaseLabels: true
+IndentCaseBlocks: true
+IndentCaseLabels: false
 IndentPPDirectives: AfterHash
 IndentWidth:     4
 IndentWrappedFunctionNames: false
diff --git a/src/Device/BC_Decoder.cpp b/src/Device/BC_Decoder.cpp
index 3a0c220..b2a7241 100644
--- a/src/Device/BC_Decoder.cpp
+++ b/src/Device/BC_Decoder.cpp
@@ -950,35 +950,35 @@
 		{
 			switch(desc.type)
 			{
-				case Mode:
-					modeDesc = desc.modeDesc;
-					ASSERT(modeDesc.number == mode);
+			case Mode:
+				modeDesc = desc.modeDesc;
+				ASSERT(modeDesc.number == mode);
 
-					e[0].size[0] = e[0].size[1] = e[0].size[2] = modeDesc.endpointBits;
-					for(int i = 0; i < RGBfChannels; i++)
+				e[0].size[0] = e[0].size[1] = e[0].size[2] = modeDesc.endpointBits;
+				for(int i = 0; i < RGBfChannels; i++)
+				{
+					if(modeDesc.hasDelta)
 					{
-						if(modeDesc.hasDelta)
-						{
-							e[1].size[i] = e[2].size[i] = e[3].size[i] = modeDesc.deltaBits.channel[i];
-						}
-						else
-						{
-							e[1].size[i] = e[2].size[i] = e[3].size[i] = modeDesc.endpointBits;
-						}
+						e[1].size[i] = e[2].size[i] = e[3].size[i] = modeDesc.deltaBits.channel[i];
 					}
-					break;
-				case Partition:
-					partition |= data.consumeBits(desc.MSB, desc.LSB);
-					break;
-				case EP0:
-				case EP1:
-				case EP2:
-				case EP3:
-					e[desc.type].channel[desc.channel] |= data.consumeBits(desc.MSB, desc.LSB);
-					break;
-				default:
-					ASSERT_MSG(false, "Unexpected enum value: %d", (int)desc.type);
-					return;
+					else
+					{
+						e[1].size[i] = e[2].size[i] = e[3].size[i] = modeDesc.endpointBits;
+					}
+				}
+				break;
+			case Partition:
+				partition |= data.consumeBits(desc.MSB, desc.LSB);
+				break;
+			case EP0:
+			case EP1:
+			case EP2:
+			case EP3:
+				e[desc.type].channel[desc.channel] |= data.consumeBits(desc.MSB, desc.LSB);
+				break;
+			default:
+				ASSERT_MSG(false, "Unexpected enum value: %d", (int)desc.type);
+				return;
 			}
 		}
 
@@ -1532,17 +1532,17 @@
 
 				switch(Get(mode.Rotation()))
 				{
-					default:
-						break;
-					case 1:
-						std::swap(output.a, output.rgb.r);
-						break;
-					case 2:
-						std::swap(output.a, output.rgb.g);
-						break;
-					case 3:
-						std::swap(output.a, output.rgb.b);
-						break;
+				default:
+					break;
+				case 1:
+					std::swap(output.a, output.rgb.r);
+					break;
+				case 2:
+					std::swap(output.a, output.rgb.g);
+					break;
+				case 3:
+					std::swap(output.a, output.rgb.b);
+					break;
 				}
 
 				auto out = reinterpret_cast<Color *>(dst + sizeof(Color) * x + dstPitch * y);
@@ -1555,12 +1555,12 @@
 	{
 		switch(mode.NS)
 		{
-			default:
-				return 0;
-			case 2:
-				return PartitionTable2[partitionIdx][texelIndex];
-			case 3:
-				return PartitionTable3[partitionIdx][texelIndex];
+		default:
+			return 0;
+		case 2:
+			return PartitionTable2[partitionIdx][texelIndex];
+		case 3:
+			return PartitionTable3[partitionIdx][texelIndex];
 		}
 	}
 
@@ -1574,12 +1574,12 @@
 		// of partition here.
 		switch(subsetIdx)
 		{
-			default:
-				return 0;
-			case 1:
-				return mode.NS == 2 ? AnchorTable2[partitionIdx] : AnchorTable3a[partitionIdx];
-			case 2:
-				return AnchorTable3b[partitionIdx];
+		default:
+			return 0;
+		case 1:
+			return mode.NS == 2 ? AnchorTable2[partitionIdx] : AnchorTable3a[partitionIdx];
+		case 2:
+			return AnchorTable3b[partitionIdx];
 		}
 	}
 
@@ -1643,7 +1643,7 @@
 
 	switch(n)
 	{
-		case 1:  // BC1
+	case 1:  // BC1
 		{
 			const BC_color *color = reinterpret_cast<const BC_color *>(src);
 			for(int y = 0; y < h; y += BlockHeight, dst += dy)
@@ -1656,7 +1656,7 @@
 			}
 		}
 		break;
-		case 2:  // BC2
+	case 2:  // BC2
 		{
 			const BC_alpha *alpha = reinterpret_cast<const BC_alpha *>(src);
 			const BC_color *color = reinterpret_cast<const BC_color *>(src + 8);
@@ -1671,7 +1671,7 @@
 			}
 		}
 		break;
-		case 3:  // BC3
+	case 3:  // BC3
 		{
 			const BC_channel *alpha = reinterpret_cast<const BC_channel *>(src);
 			const BC_color *color = reinterpret_cast<const BC_color *>(src + 8);
@@ -1686,7 +1686,7 @@
 			}
 		}
 		break;
-		case 4:  // BC4
+	case 4:  // BC4
 		{
 			const BC_channel *red = reinterpret_cast<const BC_channel *>(src);
 			for(int y = 0; y < h; y += BlockHeight, dst += dy)
@@ -1699,7 +1699,7 @@
 			}
 		}
 		break;
-		case 5:  // BC5
+	case 5:  // BC5
 		{
 			const BC_channel *red = reinterpret_cast<const BC_channel *>(src);
 			const BC_channel *green = reinterpret_cast<const BC_channel *>(src + 8);
@@ -1714,7 +1714,7 @@
 			}
 		}
 		break;
-		case 6:  // BC6H
+	case 6:  // BC6H
 		{
 			const BC6H::Block *block = reinterpret_cast<const BC6H::Block *>(src);
 			for(int y = 0; y < h; y += BlockHeight, dst += dy)
@@ -1727,7 +1727,7 @@
 			}
 		}
 		break;
-		case 7:  // BC7
+	case 7:  // BC7
 		{
 			const BC7::Block *block = reinterpret_cast<const BC7::Block *>(src);
 			for(int y = 0; y < h; y += BlockHeight, dst += dy)
@@ -1740,8 +1740,8 @@
 			}
 		}
 		break;
-		default:
-			return false;
+	default:
+		return false;
 	}
 
 	return true;
diff --git a/src/Device/Blitter.cpp b/src/Device/Blitter.cpp
index abd5a91..1a70606 100644
--- a/src/Device/Blitter.cpp
+++ b/src/Device/Blitter.cpp
@@ -196,46 +196,46 @@
 	VkImageAspectFlagBits aspect = static_cast<VkImageAspectFlagBits>(subresourceRange.aspectMask);
 	switch(viewFormat)
 	{
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			packed = ((uint16_t)(31 * c.b + 0.5f) << 0) |
-			         ((uint16_t)(63 * c.g + 0.5f) << 5) |
-			         ((uint16_t)(31 * c.r + 0.5f) << 11);
-			break;
-		case VK_FORMAT_B5G6R5_UNORM_PACK16:
-			packed = ((uint16_t)(31 * c.r + 0.5f) << 0) |
-			         ((uint16_t)(63 * c.g + 0.5f) << 5) |
-			         ((uint16_t)(31 * c.b + 0.5f) << 11);
-			break;
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_R8G8B8A8_UNORM:
-			packed = ((uint32_t)(255 * c.a + 0.5f) << 24) |
-			         ((uint32_t)(255 * c.b + 0.5f) << 16) |
-			         ((uint32_t)(255 * c.g + 0.5f) << 8) |
-			         ((uint32_t)(255 * c.r + 0.5f) << 0);
-			break;
-		case VK_FORMAT_B8G8R8A8_UNORM:
-			packed = ((uint32_t)(255 * c.a + 0.5f) << 24) |
-			         ((uint32_t)(255 * c.r + 0.5f) << 16) |
-			         ((uint32_t)(255 * c.g + 0.5f) << 8) |
-			         ((uint32_t)(255 * c.b + 0.5f) << 0);
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			packed = R11G11B10F(c.rgb);
-			break;
-		case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
-			packed = RGB9E5(c.rgb);
-			break;
-		case VK_FORMAT_D32_SFLOAT:
-			ASSERT(clearFormat == VK_FORMAT_D32_SFLOAT);
-			packed = c.d_as_u32;  // float reinterpreted as uint32
-			break;
-		case VK_FORMAT_S8_UINT:
-			ASSERT(clearFormat == VK_FORMAT_S8_UINT);
-			packed = static_cast<uint8_t>(c.s);
-			break;
-		default:
-			return false;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		packed = ((uint16_t)(31 * c.b + 0.5f) << 0) |
+		         ((uint16_t)(63 * c.g + 0.5f) << 5) |
+		         ((uint16_t)(31 * c.r + 0.5f) << 11);
+		break;
+	case VK_FORMAT_B5G6R5_UNORM_PACK16:
+		packed = ((uint16_t)(31 * c.r + 0.5f) << 0) |
+		         ((uint16_t)(63 * c.g + 0.5f) << 5) |
+		         ((uint16_t)(31 * c.b + 0.5f) << 11);
+		break;
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_R8G8B8A8_UNORM:
+		packed = ((uint32_t)(255 * c.a + 0.5f) << 24) |
+		         ((uint32_t)(255 * c.b + 0.5f) << 16) |
+		         ((uint32_t)(255 * c.g + 0.5f) << 8) |
+		         ((uint32_t)(255 * c.r + 0.5f) << 0);
+		break;
+	case VK_FORMAT_B8G8R8A8_UNORM:
+		packed = ((uint32_t)(255 * c.a + 0.5f) << 24) |
+		         ((uint32_t)(255 * c.r + 0.5f) << 16) |
+		         ((uint32_t)(255 * c.g + 0.5f) << 8) |
+		         ((uint32_t)(255 * c.b + 0.5f) << 0);
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		packed = R11G11B10F(c.rgb);
+		break;
+	case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
+		packed = RGB9E5(c.rgb);
+		break;
+	case VK_FORMAT_D32_SFLOAT:
+		ASSERT(clearFormat == VK_FORMAT_D32_SFLOAT);
+		packed = c.d_as_u32;  // float reinterpreted as uint32
+		break;
+	case VK_FORMAT_S8_UINT:
+		ASSERT(clearFormat == VK_FORMAT_S8_UINT);
+		packed = static_cast<uint8_t>(c.s);
+		break;
+	default:
+		return false;
 	}
 
 	VkImageSubresource subres = {
@@ -281,32 +281,32 @@
 
 					switch(viewFormat.bytes())
 					{
-						case 4:
-							for(uint32_t i = 0; i < area.extent.height; i++)
-							{
-								ASSERT(d < dest->end());
-								sw::clear((uint32_t *)d, packed, area.extent.width);
-								d += rowPitchBytes;
-							}
-							break;
-						case 2:
-							for(uint32_t i = 0; i < area.extent.height; i++)
-							{
-								ASSERT(d < dest->end());
-								sw::clear((uint16_t *)d, static_cast<uint16_t>(packed), area.extent.width);
-								d += rowPitchBytes;
-							}
-							break;
-						case 1:
-							for(uint32_t i = 0; i < area.extent.height; i++)
-							{
-								ASSERT(d < dest->end());
-								memset(d, packed, area.extent.width);
-								d += rowPitchBytes;
-							}
-							break;
-						default:
-							assert(false);
+					case 4:
+						for(uint32_t i = 0; i < area.extent.height; i++)
+						{
+							ASSERT(d < dest->end());
+							sw::clear((uint32_t *)d, packed, area.extent.width);
+							d += rowPitchBytes;
+						}
+						break;
+					case 2:
+						for(uint32_t i = 0; i < area.extent.height; i++)
+						{
+							ASSERT(d < dest->end());
+							sw::clear((uint16_t *)d, static_cast<uint16_t>(packed), area.extent.width);
+							d += rowPitchBytes;
+						}
+						break;
+					case 1:
+						for(uint32_t i = 0; i < area.extent.height; i++)
+						{
+							ASSERT(d < dest->end());
+							memset(d, packed, area.extent.width);
+							d += rowPitchBytes;
+						}
+						break;
+					default:
+						assert(false);
 					}
 
 					slice += slicePitchBytes;
@@ -325,186 +325,186 @@
 
 	switch(state.sourceFormat)
 	{
-		case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
-			c.w = Float(Int(*Pointer<Byte>(element)) & Int(0xF));
-			c.x = Float((Int(*Pointer<Byte>(element)) >> 4) & Int(0xF));
-			c.y = Float(Int(*Pointer<Byte>(element + 1)) & Int(0xF));
-			c.z = Float((Int(*Pointer<Byte>(element + 1)) >> 4) & Int(0xF));
-			break;
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8_SNORM:
-			c.x = Float(Int(*Pointer<SByte>(element)));
-			c.w = float(0x7F);
-			break;
-		case VK_FORMAT_R8_UNORM:
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_R8_SRGB:
-			c.x = Float(Int(*Pointer<Byte>(element)));
-			c.w = float(0xFF);
-			break;
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16_SNORM:
-			c.x = Float(Int(*Pointer<Short>(element)));
-			c.w = float(0x7FFF);
-			break;
-		case VK_FORMAT_R16_UNORM:
-		case VK_FORMAT_R16_UINT:
-			c.x = Float(Int(*Pointer<UShort>(element)));
-			c.w = float(0xFFFF);
-			break;
-		case VK_FORMAT_R32_SINT:
-			c.x = Float(*Pointer<Int>(element));
-			c.w = float(0x7FFFFFFF);
-			break;
-		case VK_FORMAT_R32_UINT:
-			c.x = Float(*Pointer<UInt>(element));
-			c.w = float(0xFFFFFFFF);
-			break;
-		case VK_FORMAT_B8G8R8A8_SRGB:
-		case VK_FORMAT_B8G8R8A8_UNORM:
-			c = Float4(*Pointer<Byte4>(element)).zyxw;
-			break;
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-		case VK_FORMAT_R8G8B8A8_SNORM:
-			c = Float4(*Pointer<SByte4>(element));
-			break;
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-			c = Float4(*Pointer<Byte4>(element));
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16A16_SNORM:
-			c = Float4(*Pointer<Short4>(element));
-			break;
-		case VK_FORMAT_R16G16B16A16_UNORM:
-		case VK_FORMAT_R16G16B16A16_UINT:
-			c = Float4(*Pointer<UShort4>(element));
-			break;
-		case VK_FORMAT_R32G32B32A32_SINT:
-			c = Float4(*Pointer<Int4>(element));
-			break;
-		case VK_FORMAT_R32G32B32A32_UINT:
-			c = Float4(*Pointer<UInt4>(element));
-			break;
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8G8_SNORM:
-			c.x = Float(Int(*Pointer<SByte>(element + 0)));
-			c.y = Float(Int(*Pointer<SByte>(element + 1)));
-			c.w = float(0x7F);
-			break;
-		case VK_FORMAT_R8G8_UNORM:
-		case VK_FORMAT_R8G8_UINT:
-		case VK_FORMAT_R8G8_SRGB:
-			c.x = Float(Int(*Pointer<Byte>(element + 0)));
-			c.y = Float(Int(*Pointer<Byte>(element + 1)));
-			c.w = float(0xFF);
-			break;
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16G16_SNORM:
-			c.x = Float(Int(*Pointer<Short>(element + 0)));
-			c.y = Float(Int(*Pointer<Short>(element + 2)));
-			c.w = float(0x7FFF);
-			break;
-		case VK_FORMAT_R16G16_UNORM:
-		case VK_FORMAT_R16G16_UINT:
-			c.x = Float(Int(*Pointer<UShort>(element + 0)));
-			c.y = Float(Int(*Pointer<UShort>(element + 2)));
-			c.w = float(0xFFFF);
-			break;
-		case VK_FORMAT_R32G32_SINT:
-			c.x = Float(*Pointer<Int>(element + 0));
-			c.y = Float(*Pointer<Int>(element + 4));
-			c.w = float(0x7FFFFFFF);
-			break;
-		case VK_FORMAT_R32G32_UINT:
-			c.x = Float(*Pointer<UInt>(element + 0));
-			c.y = Float(*Pointer<UInt>(element + 4));
-			c.w = float(0xFFFFFFFF);
-			break;
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-			c = *Pointer<Float4>(element);
-			break;
-		case VK_FORMAT_R32G32_SFLOAT:
-			c.x = *Pointer<Float>(element + 0);
-			c.y = *Pointer<Float>(element + 4);
-			break;
-		case VK_FORMAT_R32_SFLOAT:
-			c.x = *Pointer<Float>(element);
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-			c.w = Float(*Pointer<Half>(element + 6));
-		case VK_FORMAT_R16G16B16_SFLOAT:
-			c.z = Float(*Pointer<Half>(element + 4));
-		case VK_FORMAT_R16G16_SFLOAT:
-			c.y = Float(*Pointer<Half>(element + 2));
-		case VK_FORMAT_R16_SFLOAT:
-			c.x = Float(*Pointer<Half>(element));
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			c = r11g11b10Unpack(*Pointer<UInt>(element));
-			break;
-		case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
-			// This type contains a common 5 bit exponent (E) and a 9 bit the mantissa for R, G and B.
-			c.x = Float(*Pointer<UInt>(element) & UInt(0x000001FF));          // R's mantissa (bits 0-8)
-			c.y = Float((*Pointer<UInt>(element) & UInt(0x0003FE00)) >> 9);   // G's mantissa (bits 9-17)
-			c.z = Float((*Pointer<UInt>(element) & UInt(0x07FC0000)) >> 18);  // B's mantissa (bits 18-26)
-			c *= Float4(
-			    // 2^E, using the exponent (bits 27-31) and treating it as an unsigned integer value
-			    Float(UInt(1) << ((*Pointer<UInt>(element) & UInt(0xF8000000)) >> 27)) *
-			    // Since the 9 bit mantissa values currently stored in RGB were converted straight
-			    // from int to float (in the [0, 1<<9] range instead of the [0, 1] range), they
-			    // are (1 << 9) times too high.
-			    // Also, the exponent has 5 bits and we compute the exponent bias of floating point
-			    // formats using "2^(k-1) - 1", so, in this case, the exponent bias is 2^(5-1)-1 = 15
-			    // Exponent bias (15) + number of mantissa bits per component (9) = 24
-			    Float(1.0f / (1 << 24)));
-			c.w = 1.0f;
-			break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			c.x = Float(Int((*Pointer<UShort>(element) & UShort(0xF800)) >> UShort(11)));
-			c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x07E0)) >> UShort(5)));
-			c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
-			break;
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			c.w = Float(Int((*Pointer<UShort>(element) & UShort(0x8000)) >> UShort(15)));
-			c.x = Float(Int((*Pointer<UShort>(element) & UShort(0x7C00)) >> UShort(10)));
-			c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x03E0)) >> UShort(5)));
-			c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
-			c.y = Float(Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10));
-			c.z = Float(Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20));
-			c.w = Float(Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30));
-			break;
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			c.z = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
-			c.y = Float(Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10));
-			c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20));
-			c.w = Float(Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30));
-			break;
-		case VK_FORMAT_D16_UNORM:
-			c.x = Float(Int((*Pointer<UShort>(element))));
-			break;
-		case VK_FORMAT_X8_D24_UNORM_PACK32:
-			c.x = Float(Int((*Pointer<UInt>(element) & UInt(0xFFFFFF00)) >> 8));
-			break;
-		case VK_FORMAT_D32_SFLOAT:
-			c.x = *Pointer<Float>(element);
-			break;
-		case VK_FORMAT_S8_UINT:
-			c.x = Float(Int(*Pointer<Byte>(element)));
-			break;
-		default:
-			UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
+	case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+		c.w = Float(Int(*Pointer<Byte>(element)) & Int(0xF));
+		c.x = Float((Int(*Pointer<Byte>(element)) >> 4) & Int(0xF));
+		c.y = Float(Int(*Pointer<Byte>(element + 1)) & Int(0xF));
+		c.z = Float((Int(*Pointer<Byte>(element + 1)) >> 4) & Int(0xF));
+		break;
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8_SNORM:
+		c.x = Float(Int(*Pointer<SByte>(element)));
+		c.w = float(0x7F);
+		break;
+	case VK_FORMAT_R8_UNORM:
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_R8_SRGB:
+		c.x = Float(Int(*Pointer<Byte>(element)));
+		c.w = float(0xFF);
+		break;
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16_SNORM:
+		c.x = Float(Int(*Pointer<Short>(element)));
+		c.w = float(0x7FFF);
+		break;
+	case VK_FORMAT_R16_UNORM:
+	case VK_FORMAT_R16_UINT:
+		c.x = Float(Int(*Pointer<UShort>(element)));
+		c.w = float(0xFFFF);
+		break;
+	case VK_FORMAT_R32_SINT:
+		c.x = Float(*Pointer<Int>(element));
+		c.w = float(0x7FFFFFFF);
+		break;
+	case VK_FORMAT_R32_UINT:
+		c.x = Float(*Pointer<UInt>(element));
+		c.w = float(0xFFFFFFFF);
+		break;
+	case VK_FORMAT_B8G8R8A8_SRGB:
+	case VK_FORMAT_B8G8R8A8_UNORM:
+		c = Float4(*Pointer<Byte4>(element)).zyxw;
+		break;
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+	case VK_FORMAT_R8G8B8A8_SNORM:
+		c = Float4(*Pointer<SByte4>(element));
+		break;
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+		c = Float4(*Pointer<Byte4>(element));
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16A16_SNORM:
+		c = Float4(*Pointer<Short4>(element));
+		break;
+	case VK_FORMAT_R16G16B16A16_UNORM:
+	case VK_FORMAT_R16G16B16A16_UINT:
+		c = Float4(*Pointer<UShort4>(element));
+		break;
+	case VK_FORMAT_R32G32B32A32_SINT:
+		c = Float4(*Pointer<Int4>(element));
+		break;
+	case VK_FORMAT_R32G32B32A32_UINT:
+		c = Float4(*Pointer<UInt4>(element));
+		break;
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8G8_SNORM:
+		c.x = Float(Int(*Pointer<SByte>(element + 0)));
+		c.y = Float(Int(*Pointer<SByte>(element + 1)));
+		c.w = float(0x7F);
+		break;
+	case VK_FORMAT_R8G8_UNORM:
+	case VK_FORMAT_R8G8_UINT:
+	case VK_FORMAT_R8G8_SRGB:
+		c.x = Float(Int(*Pointer<Byte>(element + 0)));
+		c.y = Float(Int(*Pointer<Byte>(element + 1)));
+		c.w = float(0xFF);
+		break;
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16G16_SNORM:
+		c.x = Float(Int(*Pointer<Short>(element + 0)));
+		c.y = Float(Int(*Pointer<Short>(element + 2)));
+		c.w = float(0x7FFF);
+		break;
+	case VK_FORMAT_R16G16_UNORM:
+	case VK_FORMAT_R16G16_UINT:
+		c.x = Float(Int(*Pointer<UShort>(element + 0)));
+		c.y = Float(Int(*Pointer<UShort>(element + 2)));
+		c.w = float(0xFFFF);
+		break;
+	case VK_FORMAT_R32G32_SINT:
+		c.x = Float(*Pointer<Int>(element + 0));
+		c.y = Float(*Pointer<Int>(element + 4));
+		c.w = float(0x7FFFFFFF);
+		break;
+	case VK_FORMAT_R32G32_UINT:
+		c.x = Float(*Pointer<UInt>(element + 0));
+		c.y = Float(*Pointer<UInt>(element + 4));
+		c.w = float(0xFFFFFFFF);
+		break;
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+		c = *Pointer<Float4>(element);
+		break;
+	case VK_FORMAT_R32G32_SFLOAT:
+		c.x = *Pointer<Float>(element + 0);
+		c.y = *Pointer<Float>(element + 4);
+		break;
+	case VK_FORMAT_R32_SFLOAT:
+		c.x = *Pointer<Float>(element);
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+		c.w = Float(*Pointer<Half>(element + 6));
+	case VK_FORMAT_R16G16B16_SFLOAT:
+		c.z = Float(*Pointer<Half>(element + 4));
+	case VK_FORMAT_R16G16_SFLOAT:
+		c.y = Float(*Pointer<Half>(element + 2));
+	case VK_FORMAT_R16_SFLOAT:
+		c.x = Float(*Pointer<Half>(element));
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		c = r11g11b10Unpack(*Pointer<UInt>(element));
+		break;
+	case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
+		// This type contains a common 5 bit exponent (E) and a 9 bit the mantissa for R, G and B.
+		c.x = Float(*Pointer<UInt>(element) & UInt(0x000001FF));          // R's mantissa (bits 0-8)
+		c.y = Float((*Pointer<UInt>(element) & UInt(0x0003FE00)) >> 9);   // G's mantissa (bits 9-17)
+		c.z = Float((*Pointer<UInt>(element) & UInt(0x07FC0000)) >> 18);  // B's mantissa (bits 18-26)
+		c *= Float4(
+		    // 2^E, using the exponent (bits 27-31) and treating it as an unsigned integer value
+		    Float(UInt(1) << ((*Pointer<UInt>(element) & UInt(0xF8000000)) >> 27)) *
+		    // Since the 9 bit mantissa values currently stored in RGB were converted straight
+		    // from int to float (in the [0, 1<<9] range instead of the [0, 1] range), they
+		    // are (1 << 9) times too high.
+		    // Also, the exponent has 5 bits and we compute the exponent bias of floating point
+		    // formats using "2^(k-1) - 1", so, in this case, the exponent bias is 2^(5-1)-1 = 15
+		    // Exponent bias (15) + number of mantissa bits per component (9) = 24
+		    Float(1.0f / (1 << 24)));
+		c.w = 1.0f;
+		break;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		c.x = Float(Int((*Pointer<UShort>(element) & UShort(0xF800)) >> UShort(11)));
+		c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x07E0)) >> UShort(5)));
+		c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
+		break;
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		c.w = Float(Int((*Pointer<UShort>(element) & UShort(0x8000)) >> UShort(15)));
+		c.x = Float(Int((*Pointer<UShort>(element) & UShort(0x7C00)) >> UShort(10)));
+		c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x03E0)) >> UShort(5)));
+		c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
+		c.y = Float(Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10));
+		c.z = Float(Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20));
+		c.w = Float(Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30));
+		break;
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		c.z = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
+		c.y = Float(Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10));
+		c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20));
+		c.w = Float(Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30));
+		break;
+	case VK_FORMAT_D16_UNORM:
+		c.x = Float(Int((*Pointer<UShort>(element))));
+		break;
+	case VK_FORMAT_X8_D24_UNORM_PACK32:
+		c.x = Float(Int((*Pointer<UInt>(element) & UInt(0xFFFFFF00)) >> 8));
+		break;
+	case VK_FORMAT_D32_SFLOAT:
+		c.x = *Pointer<Float>(element);
+		break;
+	case VK_FORMAT_S8_UINT:
+		c.x = Float(Int(*Pointer<Byte>(element)));
+		break;
+	default:
+		UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
 	}
 
 	return c;
@@ -520,150 +520,150 @@
 
 	switch(state.destFormat)
 	{
-		case VK_FORMAT_R4G4_UNORM_PACK8:
-			if(writeR | writeG)
+	case VK_FORMAT_R4G4_UNORM_PACK8:
+		if(writeR | writeG)
+		{
+			if(!writeR)
 			{
-				if(!writeR)
-				{
-					*Pointer<Byte>(element) = (Byte(RoundInt(Float(c.y))) & Byte(0xF)) |
-					                          (*Pointer<Byte>(element) & Byte(0xF0));
-				}
-				else if(!writeG)
-				{
-					*Pointer<Byte>(element) = (*Pointer<Byte>(element) & Byte(0xF)) |
-					                          (Byte(RoundInt(Float(c.x))) << Byte(4));
-				}
-				else
-				{
-					*Pointer<Byte>(element) = (Byte(RoundInt(Float(c.y))) & Byte(0xF)) |
-					                          (Byte(RoundInt(Float(c.x))) << Byte(4));
-				}
+				*Pointer<Byte>(element) = (Byte(RoundInt(Float(c.y))) & Byte(0xF)) |
+				                          (*Pointer<Byte>(element) & Byte(0xF0));
 			}
-			break;
-		case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
-			if(writeR || writeG || writeB || writeA)
+			else if(!writeG)
 			{
-				*Pointer<UShort>(element) = (writeR ? ((UShort(RoundInt(Float(c.x))) & UShort(0xF)) << UShort(12)) : (*Pointer<UShort>(element) & UShort(0x000F))) |
-				                            (writeG ? ((UShort(RoundInt(Float(c.y))) & UShort(0xF)) << UShort(8)) : (*Pointer<UShort>(element) & UShort(0x00F0))) |
-				                            (writeB ? ((UShort(RoundInt(Float(c.z))) & UShort(0xF)) << UShort(4)) : (*Pointer<UShort>(element) & UShort(0x0F00))) |
-				                            (writeA ? (UShort(RoundInt(Float(c.w))) & UShort(0xF)) : (*Pointer<UShort>(element) & UShort(0xF000)));
-			}
-			break;
-		case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
-			if(writeRGBA)
-			{
-				*Pointer<UShort>(element) = UShort(RoundInt(Float(c.w)) & Int(0xF)) |
-				                            UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
-				                            UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
-				                            UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12);
+				*Pointer<Byte>(element) = (*Pointer<Byte>(element) & Byte(0xF)) |
+				                          (Byte(RoundInt(Float(c.x))) << Byte(4));
 			}
 			else
 			{
-				unsigned short mask = (writeA ? 0x000F : 0x0000) |
-				                      (writeR ? 0x00F0 : 0x0000) |
-				                      (writeG ? 0x0F00 : 0x0000) |
-				                      (writeB ? 0xF000 : 0x0000);
-				unsigned short unmask = ~mask;
-				*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
-				                            ((UShort(RoundInt(Float(c.w)) & Int(0xF)) |
-				                              UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
-				                              UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
-				                              UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12)) &
-				                             UShort(mask));
+				*Pointer<Byte>(element) = (Byte(RoundInt(Float(c.y))) & Byte(0xF)) |
+				                          (Byte(RoundInt(Float(c.x))) << Byte(4));
 			}
-			break;
-		case VK_FORMAT_B8G8R8A8_SRGB:
-		case VK_FORMAT_B8G8R8A8_UNORM:
-			if(writeRGBA)
-			{
-				Short4 c0 = RoundShort4(c.zyxw);
-				*Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
-			}
-			else
-			{
-				if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
-				if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
-				if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
-				if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
-			}
-			break;
-		case VK_FORMAT_B8G8R8_SNORM:
-			if(writeB) { *Pointer<SByte>(element + 0) = SByte(RoundInt(Float(c.z))); }
-			if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
-			if(writeR) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_B8G8R8_UNORM:
-		case VK_FORMAT_B8G8R8_SRGB:
+		}
+		break;
+	case VK_FORMAT_R4G4B4A4_UNORM_PACK16:
+		if(writeR || writeG || writeB || writeA)
+		{
+			*Pointer<UShort>(element) = (writeR ? ((UShort(RoundInt(Float(c.x))) & UShort(0xF)) << UShort(12)) : (*Pointer<UShort>(element) & UShort(0x000F))) |
+			                            (writeG ? ((UShort(RoundInt(Float(c.y))) & UShort(0xF)) << UShort(8)) : (*Pointer<UShort>(element) & UShort(0x00F0))) |
+			                            (writeB ? ((UShort(RoundInt(Float(c.z))) & UShort(0xF)) << UShort(4)) : (*Pointer<UShort>(element) & UShort(0x0F00))) |
+			                            (writeA ? (UShort(RoundInt(Float(c.w))) & UShort(0xF)) : (*Pointer<UShort>(element) & UShort(0xF000)));
+		}
+		break;
+	case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+		if(writeRGBA)
+		{
+			*Pointer<UShort>(element) = UShort(RoundInt(Float(c.w)) & Int(0xF)) |
+			                            UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
+			                            UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
+			                            UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12);
+		}
+		else
+		{
+			unsigned short mask = (writeA ? 0x000F : 0x0000) |
+			                      (writeR ? 0x00F0 : 0x0000) |
+			                      (writeG ? 0x0F00 : 0x0000) |
+			                      (writeB ? 0xF000 : 0x0000);
+			unsigned short unmask = ~mask;
+			*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
+			                            ((UShort(RoundInt(Float(c.w)) & Int(0xF)) |
+			                              UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
+			                              UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
+			                              UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12)) &
+			                             UShort(mask));
+		}
+		break;
+	case VK_FORMAT_B8G8R8A8_SRGB:
+	case VK_FORMAT_B8G8R8A8_UNORM:
+		if(writeRGBA)
+		{
+			Short4 c0 = RoundShort4(c.zyxw);
+			*Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
+		}
+		else
+		{
 			if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
 			if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
 			if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_R8G8B8A8_USCALED:
-		case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
-			if(writeRGBA)
-			{
-				Short4 c0 = RoundShort4(c);
-				*Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
-			}
-			else
-			{
-				if(writeR) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
-				if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
-				if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
-			}
-			break;
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-			if(writeRGBA)
-			{
-				*Pointer<Float4>(element) = c;
-			}
-			else
-			{
-				if(writeR) { *Pointer<Float>(element) = c.x; }
-				if(writeG) { *Pointer<Float>(element + 4) = c.y; }
-				if(writeB) { *Pointer<Float>(element + 8) = c.z; }
-				if(writeA) { *Pointer<Float>(element + 12) = c.w; }
-			}
-			break;
-		case VK_FORMAT_R32G32B32_SFLOAT:
+			if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
+		}
+		break;
+	case VK_FORMAT_B8G8R8_SNORM:
+		if(writeB) { *Pointer<SByte>(element + 0) = SByte(RoundInt(Float(c.z))); }
+		if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
+		if(writeR) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_B8G8R8_UNORM:
+	case VK_FORMAT_B8G8R8_SRGB:
+		if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
+		if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
+		if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_R8G8B8A8_USCALED:
+	case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
+		if(writeRGBA)
+		{
+			Short4 c0 = RoundShort4(c);
+			*Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
+		}
+		else
+		{
+			if(writeR) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.x))); }
+			if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
+			if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
+			if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
+		}
+		break;
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+		if(writeRGBA)
+		{
+			*Pointer<Float4>(element) = c;
+		}
+		else
+		{
 			if(writeR) { *Pointer<Float>(element) = c.x; }
 			if(writeG) { *Pointer<Float>(element + 4) = c.y; }
 			if(writeB) { *Pointer<Float>(element + 8) = c.z; }
-			break;
-		case VK_FORMAT_R32G32_SFLOAT:
-			if(writeR && writeG)
-			{
-				*Pointer<Float2>(element) = Float2(c);
-			}
-			else
-			{
-				if(writeR) { *Pointer<Float>(element) = c.x; }
-				if(writeG) { *Pointer<Float>(element + 4) = c.y; }
-			}
-			break;
-		case VK_FORMAT_R32_SFLOAT:
+			if(writeA) { *Pointer<Float>(element + 12) = c.w; }
+		}
+		break;
+	case VK_FORMAT_R32G32B32_SFLOAT:
+		if(writeR) { *Pointer<Float>(element) = c.x; }
+		if(writeG) { *Pointer<Float>(element + 4) = c.y; }
+		if(writeB) { *Pointer<Float>(element + 8) = c.z; }
+		break;
+	case VK_FORMAT_R32G32_SFLOAT:
+		if(writeR && writeG)
+		{
+			*Pointer<Float2>(element) = Float2(c);
+		}
+		else
+		{
 			if(writeR) { *Pointer<Float>(element) = c.x; }
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-			if(writeA) { *Pointer<Half>(element + 6) = Half(c.w); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16B16_SFLOAT:
-			if(writeB) { *Pointer<Half>(element + 4) = Half(c.z); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16_SFLOAT:
-			if(writeG) { *Pointer<Half>(element + 2) = Half(c.y); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16_SFLOAT:
-			if(writeR) { *Pointer<Half>(element) = Half(c.x); }
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+			if(writeG) { *Pointer<Float>(element + 4) = c.y; }
+		}
+		break;
+	case VK_FORMAT_R32_SFLOAT:
+		if(writeR) { *Pointer<Float>(element) = c.x; }
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+		if(writeA) { *Pointer<Half>(element + 6) = Half(c.w); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16B16_SFLOAT:
+		if(writeB) { *Pointer<Half>(element + 4) = Half(c.z); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16_SFLOAT:
+		if(writeG) { *Pointer<Half>(element + 2) = Half(c.y); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16_SFLOAT:
+		if(writeR) { *Pointer<Half>(element) = Half(c.x); }
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
 		{
 			UInt rgb = r11g11b10Pack(c);
 
@@ -676,7 +676,7 @@
 			*Pointer<UInt>(element) = (rgb & mask) | (old & ~mask);
 		}
 		break;
-		case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
+	case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
 		{
 			ASSERT(writeRGBA);  // Can't sensibly write just part of this format.
 
@@ -722,295 +722,295 @@
 			*Pointer<UInt>(element) = E5B9G9R9;
 		}
 		break;
-		case VK_FORMAT_B8G8R8A8_SNORM:
-			if(writeB) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.z))); }
-			if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
-			if(writeR) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.x))); }
-			if(writeA) { *Pointer<SByte>(element + 3) = SByte(RoundInt(Float(c.w))); }
-			break;
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-		case VK_FORMAT_R8G8B8A8_SNORM:
-		case VK_FORMAT_R8G8B8A8_SSCALED:
-		case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
-			if(writeA) { *Pointer<SByte>(element + 3) = SByte(RoundInt(Float(c.w))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8B8_SINT:
-		case VK_FORMAT_R8G8B8_SNORM:
-		case VK_FORMAT_R8G8B8_SSCALED:
-			if(writeB) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.z))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8G8_SNORM:
-		case VK_FORMAT_R8G8_SSCALED:
-			if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8_SNORM:
-		case VK_FORMAT_R8_SSCALED:
-			if(writeR) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_R8G8B8_UINT:
-		case VK_FORMAT_R8G8B8_UNORM:
-		case VK_FORMAT_R8G8B8_USCALED:
-		case VK_FORMAT_R8G8B8_SRGB:
-			if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_UINT:
-		case VK_FORMAT_R8G8_UNORM:
-		case VK_FORMAT_R8G8_USCALED:
-		case VK_FORMAT_R8G8_SRGB:
-			if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_R8_UNORM:
-		case VK_FORMAT_R8_USCALED:
-		case VK_FORMAT_R8_SRGB:
-			if(writeR) { *Pointer<Byte>(element) = Byte(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16A16_SNORM:
-		case VK_FORMAT_R16G16B16A16_SSCALED:
-			if(writeRGBA)
-			{
-				*Pointer<Short4>(element) = Short4(RoundInt(c));
-			}
-			else
-			{
-				if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
-				if(writeB) { *Pointer<Short>(element + 4) = Short(RoundInt(Float(c.z))); }
-				if(writeA) { *Pointer<Short>(element + 6) = Short(RoundInt(Float(c.w))); }
-			}
-			break;
-		case VK_FORMAT_R16G16B16_SINT:
-		case VK_FORMAT_R16G16B16_SNORM:
-		case VK_FORMAT_R16G16B16_SSCALED:
+	case VK_FORMAT_B8G8R8A8_SNORM:
+		if(writeB) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.z))); }
+		if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
+		if(writeR) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.x))); }
+		if(writeA) { *Pointer<SByte>(element + 3) = SByte(RoundInt(Float(c.w))); }
+		break;
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+	case VK_FORMAT_R8G8B8A8_SNORM:
+	case VK_FORMAT_R8G8B8A8_SSCALED:
+	case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
+		if(writeA) { *Pointer<SByte>(element + 3) = SByte(RoundInt(Float(c.w))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8B8_SINT:
+	case VK_FORMAT_R8G8B8_SNORM:
+	case VK_FORMAT_R8G8B8_SSCALED:
+		if(writeB) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.z))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8G8_SNORM:
+	case VK_FORMAT_R8G8_SSCALED:
+		if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8_SNORM:
+	case VK_FORMAT_R8_SSCALED:
+		if(writeR) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_R8G8B8_UINT:
+	case VK_FORMAT_R8G8B8_UNORM:
+	case VK_FORMAT_R8G8B8_USCALED:
+	case VK_FORMAT_R8G8B8_SRGB:
+		if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_UINT:
+	case VK_FORMAT_R8G8_UNORM:
+	case VK_FORMAT_R8G8_USCALED:
+	case VK_FORMAT_R8G8_SRGB:
+		if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_R8_UNORM:
+	case VK_FORMAT_R8_USCALED:
+	case VK_FORMAT_R8_SRGB:
+		if(writeR) { *Pointer<Byte>(element) = Byte(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16A16_SNORM:
+	case VK_FORMAT_R16G16B16A16_SSCALED:
+		if(writeRGBA)
+		{
+			*Pointer<Short4>(element) = Short4(RoundInt(c));
+		}
+		else
+		{
 			if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
 			if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
 			if(writeB) { *Pointer<Short>(element + 4) = Short(RoundInt(Float(c.z))); }
-			break;
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16G16_SNORM:
-		case VK_FORMAT_R16G16_SSCALED:
-			if(writeR && writeG)
-			{
-				*Pointer<Short2>(element) = Short2(Short4(RoundInt(c)));
-			}
-			else
-			{
-				if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
-			}
-			break;
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16_SNORM:
-		case VK_FORMAT_R16_SSCALED:
+			if(writeA) { *Pointer<Short>(element + 6) = Short(RoundInt(Float(c.w))); }
+		}
+		break;
+	case VK_FORMAT_R16G16B16_SINT:
+	case VK_FORMAT_R16G16B16_SNORM:
+	case VK_FORMAT_R16G16B16_SSCALED:
+		if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
+		if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
+		if(writeB) { *Pointer<Short>(element + 4) = Short(RoundInt(Float(c.z))); }
+		break;
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16G16_SNORM:
+	case VK_FORMAT_R16G16_SSCALED:
+		if(writeR && writeG)
+		{
+			*Pointer<Short2>(element) = Short2(Short4(RoundInt(c)));
+		}
+		else
+		{
 			if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_R16G16B16A16_UINT:
-		case VK_FORMAT_R16G16B16A16_UNORM:
-		case VK_FORMAT_R16G16B16A16_USCALED:
-			if(writeRGBA)
-			{
-				*Pointer<UShort4>(element) = UShort4(RoundInt(c));
-			}
-			else
-			{
-				if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
-				if(writeB) { *Pointer<UShort>(element + 4) = UShort(RoundInt(Float(c.z))); }
-				if(writeA) { *Pointer<UShort>(element + 6) = UShort(RoundInt(Float(c.w))); }
-			}
-			break;
-		case VK_FORMAT_R16G16B16_UINT:
-		case VK_FORMAT_R16G16B16_UNORM:
-		case VK_FORMAT_R16G16B16_USCALED:
+			if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
+		}
+		break;
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16_SNORM:
+	case VK_FORMAT_R16_SSCALED:
+		if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_R16G16B16A16_UINT:
+	case VK_FORMAT_R16G16B16A16_UNORM:
+	case VK_FORMAT_R16G16B16A16_USCALED:
+		if(writeRGBA)
+		{
+			*Pointer<UShort4>(element) = UShort4(RoundInt(c));
+		}
+		else
+		{
 			if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
 			if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
 			if(writeB) { *Pointer<UShort>(element + 4) = UShort(RoundInt(Float(c.z))); }
-			break;
-		case VK_FORMAT_R16G16_UINT:
-		case VK_FORMAT_R16G16_UNORM:
-		case VK_FORMAT_R16G16_USCALED:
-			if(writeR && writeG)
-			{
-				*Pointer<UShort2>(element) = UShort2(UShort4(RoundInt(c)));
-			}
-			else
-			{
-				if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
-			}
-			break;
-		case VK_FORMAT_R16_UINT:
-		case VK_FORMAT_R16_UNORM:
-		case VK_FORMAT_R16_USCALED:
+			if(writeA) { *Pointer<UShort>(element + 6) = UShort(RoundInt(Float(c.w))); }
+		}
+		break;
+	case VK_FORMAT_R16G16B16_UINT:
+	case VK_FORMAT_R16G16B16_UNORM:
+	case VK_FORMAT_R16G16B16_USCALED:
+		if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
+		if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
+		if(writeB) { *Pointer<UShort>(element + 4) = UShort(RoundInt(Float(c.z))); }
+		break;
+	case VK_FORMAT_R16G16_UINT:
+	case VK_FORMAT_R16G16_UNORM:
+	case VK_FORMAT_R16G16_USCALED:
+		if(writeR && writeG)
+		{
+			*Pointer<UShort2>(element) = UShort2(UShort4(RoundInt(c)));
+		}
+		else
+		{
 			if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_R32G32B32A32_SINT:
-			if(writeRGBA)
-			{
-				*Pointer<Int4>(element) = RoundInt(c);
-			}
-			else
-			{
-				if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
-				if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
-				if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
-				if(writeA) { *Pointer<Int>(element + 12) = RoundInt(Float(c.w)); }
-			}
-			break;
-		case VK_FORMAT_R32G32B32_SINT:
-			if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32G32_SINT:
-			if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32_SINT:
+			if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
+		}
+		break;
+	case VK_FORMAT_R16_UINT:
+	case VK_FORMAT_R16_UNORM:
+	case VK_FORMAT_R16_USCALED:
+		if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_R32G32B32A32_SINT:
+		if(writeRGBA)
+		{
+			*Pointer<Int4>(element) = RoundInt(c);
+		}
+		else
+		{
 			if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
-			break;
-		case VK_FORMAT_R32G32B32A32_UINT:
-			if(writeRGBA)
-			{
-				*Pointer<UInt4>(element) = UInt4(RoundInt(c));
-			}
-			else
-			{
-				if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
-				if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
-				if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
-				if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(RoundInt(Float(c.w))); }
-			}
-			break;
-		case VK_FORMAT_R32G32B32_UINT:
-			if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32G32_UINT:
-			if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32_UINT:
+			if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
+			if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
+			if(writeA) { *Pointer<Int>(element + 12) = RoundInt(Float(c.w)); }
+		}
+		break;
+	case VK_FORMAT_R32G32B32_SINT:
+		if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32G32_SINT:
+		if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32_SINT:
+		if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
+		break;
+	case VK_FORMAT_R32G32B32A32_UINT:
+		if(writeRGBA)
+		{
+			*Pointer<UInt4>(element) = UInt4(RoundInt(c));
+		}
+		else
+		{
 			if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
-			break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			if(writeR && writeG && writeB)
-			{
-				*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c.xyzz), { 11, 5, 0, 0 }));
-			}
-			else
-			{
-				unsigned short mask = (writeB ? 0x001F : 0x0000) | (writeG ? 0x07E0 : 0x0000) | (writeR ? 0xF800 : 0x0000);
-				unsigned short unmask = ~mask;
-				*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
-				                            (UShort(PackFields(RoundInt(c.xyzz), { 11, 5, 0, 0 })) &
-				                             UShort(mask));
-			}
-			break;
-		case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
-			if(writeRGBA)
-			{
-				*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 11, 6, 1, 0 }));
-			}
-			else
-			{
-				unsigned short mask = (writeA ? 0x8000 : 0x0000) |
-				                      (writeR ? 0x7C00 : 0x0000) |
-				                      (writeG ? 0x03E0 : 0x0000) |
-				                      (writeB ? 0x001F : 0x0000);
-				unsigned short unmask = ~mask;
-				*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
-				                            (UShort(PackFields(RoundInt(c), { 11, 6, 1, 0 })) &
-				                             UShort(mask));
-			}
-			break;
-		case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
-			if(writeRGBA)
-			{
-				*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 1, 6, 11, 0 }));
-			}
-			else
-			{
-				unsigned short mask = (writeA ? 0x8000 : 0x0000) |
-				                      (writeR ? 0x7C00 : 0x0000) |
-				                      (writeG ? 0x03E0 : 0x0000) |
-				                      (writeB ? 0x001F : 0x0000);
-				unsigned short unmask = ~mask;
-				*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
-				                            (UShort(PackFields(RoundInt(c), { 1, 6, 11, 0 })) &
-				                             UShort(mask));
-			}
-			break;
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			if(writeRGBA)
-			{
-				*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 10, 5, 0, 15 }));
-			}
-			else
-			{
-				unsigned short mask = (writeA ? 0x8000 : 0x0000) |
-				                      (writeR ? 0x7C00 : 0x0000) |
-				                      (writeG ? 0x03E0 : 0x0000) |
-				                      (writeB ? 0x001F : 0x0000);
-				unsigned short unmask = ~mask;
-				*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
-				                            (UShort(PackFields(RoundInt(c), { 10, 5, 0, 15 })) &
-				                             UShort(mask));
-			}
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-		case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
-			if(writeRGBA)
-			{
-				*Pointer<UInt>(element) = As<UInt>(PackFields(RoundInt(c), { 0, 10, 20, 30 }));
-			}
-			else
-			{
-				unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
-				                    (writeB ? 0x3FF00000 : 0x0000) |
-				                    (writeG ? 0x000FFC00 : 0x0000) |
-				                    (writeR ? 0x000003FF : 0x0000);
-				unsigned int unmask = ~mask;
-				*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
-				                          (As<UInt>(PackFields(RoundInt(c), { 0, 10, 20, 30 })) &
-				                           UInt(mask));
-			}
-			break;
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-		case VK_FORMAT_A2R10G10B10_SNORM_PACK32:
-			if(writeRGBA)
-			{
-				*Pointer<UInt>(element) = As<UInt>(PackFields(RoundInt(c), { 20, 10, 0, 30 }));
-			}
-			else
-			{
-				unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
-				                    (writeR ? 0x3FF00000 : 0x0000) |
-				                    (writeG ? 0x000FFC00 : 0x0000) |
-				                    (writeB ? 0x000003FF : 0x0000);
-				unsigned int unmask = ~mask;
-				*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
-				                          (As<UInt>(PackFields(RoundInt(c), { 20, 10, 0, 30 })) &
-				                           UInt(mask));
-			}
-			break;
-		case VK_FORMAT_D16_UNORM:
-			*Pointer<UShort>(element) = UShort(RoundInt(Float(c.x)));
-			break;
-		case VK_FORMAT_X8_D24_UNORM_PACK32:
-			*Pointer<UInt>(element) = UInt(RoundInt(Float(c.x)) << 8);
-			break;
-		case VK_FORMAT_D32_SFLOAT:
-			*Pointer<Float>(element) = c.x;
-			break;
-		case VK_FORMAT_S8_UINT:
-			*Pointer<Byte>(element) = Byte(RoundInt(Float(c.x)));
-			break;
-		default:
-			UNSUPPORTED("Blitter destination format %d", (int)state.destFormat);
-			break;
+			if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
+			if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
+			if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(RoundInt(Float(c.w))); }
+		}
+		break;
+	case VK_FORMAT_R32G32B32_UINT:
+		if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32G32_UINT:
+		if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32_UINT:
+		if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
+		break;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		if(writeR && writeG && writeB)
+		{
+			*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c.xyzz), { 11, 5, 0, 0 }));
+		}
+		else
+		{
+			unsigned short mask = (writeB ? 0x001F : 0x0000) | (writeG ? 0x07E0 : 0x0000) | (writeR ? 0xF800 : 0x0000);
+			unsigned short unmask = ~mask;
+			*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
+			                            (UShort(PackFields(RoundInt(c.xyzz), { 11, 5, 0, 0 })) &
+			                             UShort(mask));
+		}
+		break;
+	case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
+		if(writeRGBA)
+		{
+			*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 11, 6, 1, 0 }));
+		}
+		else
+		{
+			unsigned short mask = (writeA ? 0x8000 : 0x0000) |
+			                      (writeR ? 0x7C00 : 0x0000) |
+			                      (writeG ? 0x03E0 : 0x0000) |
+			                      (writeB ? 0x001F : 0x0000);
+			unsigned short unmask = ~mask;
+			*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
+			                            (UShort(PackFields(RoundInt(c), { 11, 6, 1, 0 })) &
+			                             UShort(mask));
+		}
+		break;
+	case VK_FORMAT_B5G5R5A1_UNORM_PACK16:
+		if(writeRGBA)
+		{
+			*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 1, 6, 11, 0 }));
+		}
+		else
+		{
+			unsigned short mask = (writeA ? 0x8000 : 0x0000) |
+			                      (writeR ? 0x7C00 : 0x0000) |
+			                      (writeG ? 0x03E0 : 0x0000) |
+			                      (writeB ? 0x001F : 0x0000);
+			unsigned short unmask = ~mask;
+			*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
+			                            (UShort(PackFields(RoundInt(c), { 1, 6, 11, 0 })) &
+			                             UShort(mask));
+		}
+		break;
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		if(writeRGBA)
+		{
+			*Pointer<UShort>(element) = UShort(PackFields(RoundInt(c), { 10, 5, 0, 15 }));
+		}
+		else
+		{
+			unsigned short mask = (writeA ? 0x8000 : 0x0000) |
+			                      (writeR ? 0x7C00 : 0x0000) |
+			                      (writeG ? 0x03E0 : 0x0000) |
+			                      (writeB ? 0x001F : 0x0000);
+			unsigned short unmask = ~mask;
+			*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
+			                            (UShort(PackFields(RoundInt(c), { 10, 5, 0, 15 })) &
+			                             UShort(mask));
+		}
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+	case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
+		if(writeRGBA)
+		{
+			*Pointer<UInt>(element) = As<UInt>(PackFields(RoundInt(c), { 0, 10, 20, 30 }));
+		}
+		else
+		{
+			unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
+			                    (writeB ? 0x3FF00000 : 0x0000) |
+			                    (writeG ? 0x000FFC00 : 0x0000) |
+			                    (writeR ? 0x000003FF : 0x0000);
+			unsigned int unmask = ~mask;
+			*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
+			                          (As<UInt>(PackFields(RoundInt(c), { 0, 10, 20, 30 })) &
+			                           UInt(mask));
+		}
+		break;
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+	case VK_FORMAT_A2R10G10B10_SNORM_PACK32:
+		if(writeRGBA)
+		{
+			*Pointer<UInt>(element) = As<UInt>(PackFields(RoundInt(c), { 20, 10, 0, 30 }));
+		}
+		else
+		{
+			unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
+			                    (writeR ? 0x3FF00000 : 0x0000) |
+			                    (writeG ? 0x000FFC00 : 0x0000) |
+			                    (writeB ? 0x000003FF : 0x0000);
+			unsigned int unmask = ~mask;
+			*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
+			                          (As<UInt>(PackFields(RoundInt(c), { 20, 10, 0, 30 })) &
+			                           UInt(mask));
+		}
+		break;
+	case VK_FORMAT_D16_UNORM:
+		*Pointer<UShort>(element) = UShort(RoundInt(Float(c.x)));
+		break;
+	case VK_FORMAT_X8_D24_UNORM_PACK32:
+		*Pointer<UInt>(element) = UInt(RoundInt(Float(c.x)) << 8);
+		break;
+	case VK_FORMAT_D32_SFLOAT:
+		*Pointer<Float>(element) = c.x;
+		break;
+	case VK_FORMAT_S8_UINT:
+		*Pointer<Byte>(element) = Byte(RoundInt(Float(c.x)));
+		break;
+	default:
+		UNSUPPORTED("Blitter destination format %d", (int)state.destFormat);
+		break;
 	}
 }
 
@@ -1020,75 +1020,75 @@
 
 	switch(state.sourceFormat)
 	{
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_SINT:
-			c = Insert(c, Int(*Pointer<SByte>(element + 3)), 3);
-			c = Insert(c, Int(*Pointer<SByte>(element + 2)), 2);
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_SINT:
-			c = Insert(c, Int(*Pointer<SByte>(element + 1)), 1);
-			// [[fallthrough]]
-		case VK_FORMAT_R8_SINT:
-			c = Insert(c, Int(*Pointer<SByte>(element)), 0);
-			break;
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000003FF))), 0);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10), 1);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20), 2);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30), 3);
-			break;
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000003FF))), 2);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10), 1);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20), 0);
-			c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30), 3);
-			break;
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_UINT:
-			c = Insert(c, Int(*Pointer<Byte>(element + 3)), 3);
-			c = Insert(c, Int(*Pointer<Byte>(element + 2)), 2);
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_UINT:
-			c = Insert(c, Int(*Pointer<Byte>(element + 1)), 1);
-			// [[fallthrough]]
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_S8_UINT:
-			c = Insert(c, Int(*Pointer<Byte>(element)), 0);
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-			c = Insert(c, Int(*Pointer<Short>(element + 6)), 3);
-			c = Insert(c, Int(*Pointer<Short>(element + 4)), 2);
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16_SINT:
-			c = Insert(c, Int(*Pointer<Short>(element + 2)), 1);
-			// [[fallthrough]]
-		case VK_FORMAT_R16_SINT:
-			c = Insert(c, Int(*Pointer<Short>(element)), 0);
-			break;
-		case VK_FORMAT_R16G16B16A16_UINT:
-			c = Insert(c, Int(*Pointer<UShort>(element + 6)), 3);
-			c = Insert(c, Int(*Pointer<UShort>(element + 4)), 2);
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16_UINT:
-			c = Insert(c, Int(*Pointer<UShort>(element + 2)), 1);
-			// [[fallthrough]]
-		case VK_FORMAT_R16_UINT:
-			c = Insert(c, Int(*Pointer<UShort>(element)), 0);
-			break;
-		case VK_FORMAT_R32G32B32A32_SINT:
-		case VK_FORMAT_R32G32B32A32_UINT:
-			c = *Pointer<Int4>(element);
-			break;
-		case VK_FORMAT_R32G32_SINT:
-		case VK_FORMAT_R32G32_UINT:
-			c = Insert(c, *Pointer<Int>(element + 4), 1);
-			// [[fallthrough]]
-		case VK_FORMAT_R32_SINT:
-		case VK_FORMAT_R32_UINT:
-			c = Insert(c, *Pointer<Int>(element), 0);
-			break;
-		default:
-			UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_SINT:
+		c = Insert(c, Int(*Pointer<SByte>(element + 3)), 3);
+		c = Insert(c, Int(*Pointer<SByte>(element + 2)), 2);
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_SINT:
+		c = Insert(c, Int(*Pointer<SByte>(element + 1)), 1);
+		// [[fallthrough]]
+	case VK_FORMAT_R8_SINT:
+		c = Insert(c, Int(*Pointer<SByte>(element)), 0);
+		break;
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000003FF))), 0);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10), 1);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20), 2);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30), 3);
+		break;
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000003FF))), 2);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10), 1);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20), 0);
+		c = Insert(c, Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30), 3);
+		break;
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_UINT:
+		c = Insert(c, Int(*Pointer<Byte>(element + 3)), 3);
+		c = Insert(c, Int(*Pointer<Byte>(element + 2)), 2);
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_UINT:
+		c = Insert(c, Int(*Pointer<Byte>(element + 1)), 1);
+		// [[fallthrough]]
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_S8_UINT:
+		c = Insert(c, Int(*Pointer<Byte>(element)), 0);
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+		c = Insert(c, Int(*Pointer<Short>(element + 6)), 3);
+		c = Insert(c, Int(*Pointer<Short>(element + 4)), 2);
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16_SINT:
+		c = Insert(c, Int(*Pointer<Short>(element + 2)), 1);
+		// [[fallthrough]]
+	case VK_FORMAT_R16_SINT:
+		c = Insert(c, Int(*Pointer<Short>(element)), 0);
+		break;
+	case VK_FORMAT_R16G16B16A16_UINT:
+		c = Insert(c, Int(*Pointer<UShort>(element + 6)), 3);
+		c = Insert(c, Int(*Pointer<UShort>(element + 4)), 2);
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16_UINT:
+		c = Insert(c, Int(*Pointer<UShort>(element + 2)), 1);
+		// [[fallthrough]]
+	case VK_FORMAT_R16_UINT:
+		c = Insert(c, Int(*Pointer<UShort>(element)), 0);
+		break;
+	case VK_FORMAT_R32G32B32A32_SINT:
+	case VK_FORMAT_R32G32B32A32_UINT:
+		c = *Pointer<Int4>(element);
+		break;
+	case VK_FORMAT_R32G32_SINT:
+	case VK_FORMAT_R32G32_UINT:
+		c = Insert(c, *Pointer<Int>(element + 4), 1);
+		// [[fallthrough]]
+	case VK_FORMAT_R32_SINT:
+	case VK_FORMAT_R32_UINT:
+		c = Insert(c, *Pointer<Int>(element), 0);
+		break;
+	default:
+		UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
 	}
 
 	return c;
@@ -1104,235 +1104,235 @@
 
 	switch(state.destFormat)
 	{
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			c = Min(As<UInt4>(c), UInt4(0x03FF, 0x03FF, 0x03FF, 0x0003));
-			break;
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_R8G8B8_UINT:
-		case VK_FORMAT_R8G8_UINT:
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_R8G8B8A8_USCALED:
-		case VK_FORMAT_R8G8B8_USCALED:
-		case VK_FORMAT_R8G8_USCALED:
-		case VK_FORMAT_R8_USCALED:
-		case VK_FORMAT_S8_UINT:
-			c = Min(As<UInt4>(c), UInt4(0xFF));
-			break;
-		case VK_FORMAT_R16G16B16A16_UINT:
-		case VK_FORMAT_R16G16B16_UINT:
-		case VK_FORMAT_R16G16_UINT:
-		case VK_FORMAT_R16_UINT:
-		case VK_FORMAT_R16G16B16A16_USCALED:
-		case VK_FORMAT_R16G16B16_USCALED:
-		case VK_FORMAT_R16G16_USCALED:
-		case VK_FORMAT_R16_USCALED:
-			c = Min(As<UInt4>(c), UInt4(0xFFFF));
-			break;
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8G8B8A8_SSCALED:
-		case VK_FORMAT_R8G8B8_SSCALED:
-		case VK_FORMAT_R8G8_SSCALED:
-		case VK_FORMAT_R8_SSCALED:
-			c = Min(Max(c, Int4(-0x80)), Int4(0x7F));
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16_SINT:
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16G16B16A16_SSCALED:
-		case VK_FORMAT_R16G16B16_SSCALED:
-		case VK_FORMAT_R16G16_SSCALED:
-		case VK_FORMAT_R16_SSCALED:
-			c = Min(Max(c, Int4(-0x8000)), Int4(0x7FFF));
-			break;
-		default:
-			break;
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		c = Min(As<UInt4>(c), UInt4(0x03FF, 0x03FF, 0x03FF, 0x0003));
+		break;
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_R8G8B8_UINT:
+	case VK_FORMAT_R8G8_UINT:
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_R8G8B8A8_USCALED:
+	case VK_FORMAT_R8G8B8_USCALED:
+	case VK_FORMAT_R8G8_USCALED:
+	case VK_FORMAT_R8_USCALED:
+	case VK_FORMAT_S8_UINT:
+		c = Min(As<UInt4>(c), UInt4(0xFF));
+		break;
+	case VK_FORMAT_R16G16B16A16_UINT:
+	case VK_FORMAT_R16G16B16_UINT:
+	case VK_FORMAT_R16G16_UINT:
+	case VK_FORMAT_R16_UINT:
+	case VK_FORMAT_R16G16B16A16_USCALED:
+	case VK_FORMAT_R16G16B16_USCALED:
+	case VK_FORMAT_R16G16_USCALED:
+	case VK_FORMAT_R16_USCALED:
+		c = Min(As<UInt4>(c), UInt4(0xFFFF));
+		break;
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8G8B8A8_SSCALED:
+	case VK_FORMAT_R8G8B8_SSCALED:
+	case VK_FORMAT_R8G8_SSCALED:
+	case VK_FORMAT_R8_SSCALED:
+		c = Min(Max(c, Int4(-0x80)), Int4(0x7F));
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16_SINT:
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16G16B16A16_SSCALED:
+	case VK_FORMAT_R16G16B16_SSCALED:
+	case VK_FORMAT_R16G16_SSCALED:
+	case VK_FORMAT_R16_SSCALED:
+		c = Min(Max(c, Int4(-0x8000)), Int4(0x7FFF));
+		break;
+	default:
+		break;
 	}
 
 	switch(state.destFormat)
 	{
-		case VK_FORMAT_B8G8R8A8_SINT:
-		case VK_FORMAT_B8G8R8A8_SSCALED:
-			if(writeA) { *Pointer<SByte>(element + 3) = SByte(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_B8G8R8_SINT:
-		case VK_FORMAT_B8G8R8_SSCALED:
-			if(writeB) { *Pointer<SByte>(element) = SByte(Extract(c, 2)); }
-			if(writeG) { *Pointer<SByte>(element + 1) = SByte(Extract(c, 1)); }
-			if(writeR) { *Pointer<SByte>(element + 2) = SByte(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_R8G8B8A8_SSCALED:
-		case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
-			if(writeA) { *Pointer<SByte>(element + 3) = SByte(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8B8_SINT:
-		case VK_FORMAT_R8G8B8_SSCALED:
-			if(writeB) { *Pointer<SByte>(element + 2) = SByte(Extract(c, 2)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8G8_SSCALED:
-			if(writeG) { *Pointer<SByte>(element + 1) = SByte(Extract(c, 1)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8_SSCALED:
-			if(writeR) { *Pointer<SByte>(element) = SByte(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-		case VK_FORMAT_A2B10G10R10_SINT_PACK32:
-		case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
-		case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
-			if(writeRGBA)
-			{
-				*Pointer<UInt>(element) = As<UInt>(PackFields(c, { 0, 10, 20, 30 }));
-			}
-			else
-			{
-				unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
-				                    (writeB ? 0x3FF00000 : 0x0000) |
-				                    (writeG ? 0x000FFC00 : 0x0000) |
-				                    (writeR ? 0x000003FF : 0x0000);
-				unsigned int unmask = ~mask;
-				*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
-				                          (As<UInt>(PackFields(c, { 0, 10, 20, 30 })) & UInt(mask));
-			}
-			break;
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-		case VK_FORMAT_A2R10G10B10_SINT_PACK32:
-		case VK_FORMAT_A2R10G10B10_USCALED_PACK32:
-		case VK_FORMAT_A2R10G10B10_SSCALED_PACK32:
-			if(writeRGBA)
-			{
-				*Pointer<UInt>(element) = As<UInt>(PackFields(c, { 20, 10, 0, 30 }));
-			}
-			else
-			{
-				unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
-				                    (writeR ? 0x3FF00000 : 0x0000) |
-				                    (writeG ? 0x000FFC00 : 0x0000) |
-				                    (writeB ? 0x000003FF : 0x0000);
-				unsigned int unmask = ~mask;
-				*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
-				                          (As<UInt>(PackFields(c, { 20, 10, 0, 30 })) & UInt(mask));
-			}
-			break;
-		case VK_FORMAT_B8G8R8A8_UINT:
-		case VK_FORMAT_B8G8R8A8_USCALED:
-			if(writeA) { *Pointer<Byte>(element + 3) = Byte(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_B8G8R8_UINT:
-		case VK_FORMAT_B8G8R8_USCALED:
-		case VK_FORMAT_B8G8R8_SRGB:
-			if(writeB) { *Pointer<Byte>(element) = Byte(Extract(c, 2)); }
-			if(writeG) { *Pointer<Byte>(element + 1) = Byte(Extract(c, 1)); }
-			if(writeR) { *Pointer<Byte>(element + 2) = Byte(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_R8G8B8A8_USCALED:
-		case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
-			if(writeA) { *Pointer<Byte>(element + 3) = Byte(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8B8_UINT:
-		case VK_FORMAT_R8G8B8_USCALED:
-			if(writeB) { *Pointer<Byte>(element + 2) = Byte(Extract(c, 2)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8G8_UINT:
-		case VK_FORMAT_R8G8_USCALED:
-			if(writeG) { *Pointer<Byte>(element + 1) = Byte(Extract(c, 1)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_R8_USCALED:
-		case VK_FORMAT_S8_UINT:
-			if(writeR) { *Pointer<Byte>(element) = Byte(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16A16_SSCALED:
-			if(writeA) { *Pointer<Short>(element + 6) = Short(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16B16_SINT:
-		case VK_FORMAT_R16G16B16_SSCALED:
-			if(writeB) { *Pointer<Short>(element + 4) = Short(Extract(c, 2)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16G16_SSCALED:
-			if(writeG) { *Pointer<Short>(element + 2) = Short(Extract(c, 1)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16_SSCALED:
-			if(writeR) { *Pointer<Short>(element) = Short(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_R16G16B16A16_UINT:
-		case VK_FORMAT_R16G16B16A16_USCALED:
-			if(writeA) { *Pointer<UShort>(element + 6) = UShort(Extract(c, 3)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16B16_UINT:
-		case VK_FORMAT_R16G16B16_USCALED:
-			if(writeB) { *Pointer<UShort>(element + 4) = UShort(Extract(c, 2)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16G16_UINT:
-		case VK_FORMAT_R16G16_USCALED:
-			if(writeG) { *Pointer<UShort>(element + 2) = UShort(Extract(c, 1)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R16_UINT:
-		case VK_FORMAT_R16_USCALED:
-			if(writeR) { *Pointer<UShort>(element) = UShort(Extract(c, 0)); }
-			break;
-		case VK_FORMAT_R32G32B32A32_SINT:
-			if(writeRGBA)
-			{
-				*Pointer<Int4>(element) = c;
-			}
-			else
-			{
-				if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
-				if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
-				if(writeB) { *Pointer<Int>(element + 8) = Extract(c, 2); }
-				if(writeA) { *Pointer<Int>(element + 12) = Extract(c, 3); }
-			}
-			break;
-		case VK_FORMAT_R32G32B32_SINT:
+	case VK_FORMAT_B8G8R8A8_SINT:
+	case VK_FORMAT_B8G8R8A8_SSCALED:
+		if(writeA) { *Pointer<SByte>(element + 3) = SByte(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_B8G8R8_SINT:
+	case VK_FORMAT_B8G8R8_SSCALED:
+		if(writeB) { *Pointer<SByte>(element) = SByte(Extract(c, 2)); }
+		if(writeG) { *Pointer<SByte>(element + 1) = SByte(Extract(c, 1)); }
+		if(writeR) { *Pointer<SByte>(element + 2) = SByte(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_R8G8B8A8_SSCALED:
+	case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
+		if(writeA) { *Pointer<SByte>(element + 3) = SByte(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8B8_SINT:
+	case VK_FORMAT_R8G8B8_SSCALED:
+		if(writeB) { *Pointer<SByte>(element + 2) = SByte(Extract(c, 2)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8G8_SSCALED:
+		if(writeG) { *Pointer<SByte>(element + 1) = SByte(Extract(c, 1)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8_SSCALED:
+		if(writeR) { *Pointer<SByte>(element) = SByte(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+	case VK_FORMAT_A2B10G10R10_SINT_PACK32:
+	case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
+	case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
+		if(writeRGBA)
+		{
+			*Pointer<UInt>(element) = As<UInt>(PackFields(c, { 0, 10, 20, 30 }));
+		}
+		else
+		{
+			unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
+			                    (writeB ? 0x3FF00000 : 0x0000) |
+			                    (writeG ? 0x000FFC00 : 0x0000) |
+			                    (writeR ? 0x000003FF : 0x0000);
+			unsigned int unmask = ~mask;
+			*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
+			                          (As<UInt>(PackFields(c, { 0, 10, 20, 30 })) & UInt(mask));
+		}
+		break;
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+	case VK_FORMAT_A2R10G10B10_SINT_PACK32:
+	case VK_FORMAT_A2R10G10B10_USCALED_PACK32:
+	case VK_FORMAT_A2R10G10B10_SSCALED_PACK32:
+		if(writeRGBA)
+		{
+			*Pointer<UInt>(element) = As<UInt>(PackFields(c, { 20, 10, 0, 30 }));
+		}
+		else
+		{
+			unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
+			                    (writeR ? 0x3FF00000 : 0x0000) |
+			                    (writeG ? 0x000FFC00 : 0x0000) |
+			                    (writeB ? 0x000003FF : 0x0000);
+			unsigned int unmask = ~mask;
+			*Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
+			                          (As<UInt>(PackFields(c, { 20, 10, 0, 30 })) & UInt(mask));
+		}
+		break;
+	case VK_FORMAT_B8G8R8A8_UINT:
+	case VK_FORMAT_B8G8R8A8_USCALED:
+		if(writeA) { *Pointer<Byte>(element + 3) = Byte(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_B8G8R8_UINT:
+	case VK_FORMAT_B8G8R8_USCALED:
+	case VK_FORMAT_B8G8R8_SRGB:
+		if(writeB) { *Pointer<Byte>(element) = Byte(Extract(c, 2)); }
+		if(writeG) { *Pointer<Byte>(element + 1) = Byte(Extract(c, 1)); }
+		if(writeR) { *Pointer<Byte>(element + 2) = Byte(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_R8G8B8A8_USCALED:
+	case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
+		if(writeA) { *Pointer<Byte>(element + 3) = Byte(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8B8_UINT:
+	case VK_FORMAT_R8G8B8_USCALED:
+		if(writeB) { *Pointer<Byte>(element + 2) = Byte(Extract(c, 2)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8G8_UINT:
+	case VK_FORMAT_R8G8_USCALED:
+		if(writeG) { *Pointer<Byte>(element + 1) = Byte(Extract(c, 1)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_R8_USCALED:
+	case VK_FORMAT_S8_UINT:
+		if(writeR) { *Pointer<Byte>(element) = Byte(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16A16_SSCALED:
+		if(writeA) { *Pointer<Short>(element + 6) = Short(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16B16_SINT:
+	case VK_FORMAT_R16G16B16_SSCALED:
+		if(writeB) { *Pointer<Short>(element + 4) = Short(Extract(c, 2)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16G16_SSCALED:
+		if(writeG) { *Pointer<Short>(element + 2) = Short(Extract(c, 1)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16_SSCALED:
+		if(writeR) { *Pointer<Short>(element) = Short(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_R16G16B16A16_UINT:
+	case VK_FORMAT_R16G16B16A16_USCALED:
+		if(writeA) { *Pointer<UShort>(element + 6) = UShort(Extract(c, 3)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16B16_UINT:
+	case VK_FORMAT_R16G16B16_USCALED:
+		if(writeB) { *Pointer<UShort>(element + 4) = UShort(Extract(c, 2)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16G16_UINT:
+	case VK_FORMAT_R16G16_USCALED:
+		if(writeG) { *Pointer<UShort>(element + 2) = UShort(Extract(c, 1)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R16_UINT:
+	case VK_FORMAT_R16_USCALED:
+		if(writeR) { *Pointer<UShort>(element) = UShort(Extract(c, 0)); }
+		break;
+	case VK_FORMAT_R32G32B32A32_SINT:
+		if(writeRGBA)
+		{
+			*Pointer<Int4>(element) = c;
+		}
+		else
+		{
 			if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
 			if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
 			if(writeB) { *Pointer<Int>(element + 8) = Extract(c, 2); }
-			break;
-		case VK_FORMAT_R32G32_SINT:
-			if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
-			if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
-			break;
-		case VK_FORMAT_R32_SINT:
-			if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
-			break;
-		case VK_FORMAT_R32G32B32A32_UINT:
-			if(writeRGBA)
-			{
-				*Pointer<UInt4>(element) = As<UInt4>(c);
-			}
-			else
-			{
-				if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
-				if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
-				if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
-				if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(Extract(c, 3)); }
-			}
-			break;
-		case VK_FORMAT_R32G32B32_UINT:
-			if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32G32_UINT:
-			if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
-			// [[fallthrough]]
-		case VK_FORMAT_R32_UINT:
+			if(writeA) { *Pointer<Int>(element + 12) = Extract(c, 3); }
+		}
+		break;
+	case VK_FORMAT_R32G32B32_SINT:
+		if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
+		if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
+		if(writeB) { *Pointer<Int>(element + 8) = Extract(c, 2); }
+		break;
+	case VK_FORMAT_R32G32_SINT:
+		if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
+		if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
+		break;
+	case VK_FORMAT_R32_SINT:
+		if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
+		break;
+	case VK_FORMAT_R32G32B32A32_UINT:
+		if(writeRGBA)
+		{
+			*Pointer<UInt4>(element) = As<UInt4>(c);
+		}
+		else
+		{
 			if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
-			break;
-		default:
-			UNSUPPORTED("Blitter destination format %d", (int)state.destFormat);
+			if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
+			if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
+			if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(Extract(c, 3)); }
+		}
+		break;
+	case VK_FORMAT_R32G32B32_UINT:
+		if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32G32_UINT:
+		if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
+		// [[fallthrough]]
+	case VK_FORMAT_R32_UINT:
+		if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
+		break;
+	default:
+		UNSUPPORTED("Blitter destination format %d", (int)state.destFormat);
 	}
 }
 
@@ -1348,14 +1348,14 @@
 		// then the whole range of the int or uint color must be scaled between 0 and 1.
 		switch(state.sourceFormat)
 		{
-			case VK_FORMAT_R32G32B32A32_SINT:
-				unscale = float4(static_cast<float>(0x7FFFFFFF));
-				break;
-			case VK_FORMAT_R32G32B32A32_UINT:
-				unscale = float4(static_cast<float>(0xFFFFFFFF));
-				break;
-			default:
-				UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
+		case VK_FORMAT_R32G32B32A32_SINT:
+			unscale = float4(static_cast<float>(0x7FFFFFFF));
+			break;
+		case VK_FORMAT_R32G32B32A32_UINT:
+			unscale = float4(static_cast<float>(0xFFFFFFFF));
+			break;
+		default:
+			UNSUPPORTED("Blitter source format %d", (int)state.sourceFormat);
 		}
 	}
 	else
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index cfb8567..2cf2d19 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -25,20 +25,20 @@
 {
 	switch(topology)
 	{
-		case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
-			return vertexCount;
-		case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
-			return vertexCount / 2;
-		case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
-			return std::max<uint32_t>(vertexCount, 1) - 1;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
-			return vertexCount / 3;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
-			return std::max<uint32_t>(vertexCount, 2) - 2;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
-			return std::max<uint32_t>(vertexCount, 2) - 2;
-		default:
-			UNSUPPORTED("VkPrimitiveTopology %d", int(topology));
+	case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+		return vertexCount;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+		return vertexCount / 2;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+		return std::max<uint32_t>(vertexCount, 1) - 1;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+		return vertexCount / 3;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+		return std::max<uint32_t>(vertexCount, 2) - 2;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+		return std::max<uint32_t>(vertexCount, 2) - 2;
+	default:
+		UNSUPPORTED("VkPrimitiveTopology %d", int(topology));
 	}
 
 	return 0;
@@ -114,14 +114,14 @@
 		{
 			switch(indexType)
 			{
-				case VK_INDEX_TYPE_UINT16:
-					ProcessPrimitiveRestart(static_cast<uint16_t *>(indexBuffer), topology, count, indexBuffers);
-					break;
-				case VK_INDEX_TYPE_UINT32:
-					ProcessPrimitiveRestart(static_cast<uint32_t *>(indexBuffer), topology, count, indexBuffers);
-					break;
-				default:
-					UNSUPPORTED("VkIndexType %d", int(indexType));
+			case VK_INDEX_TYPE_UINT16:
+				ProcessPrimitiveRestart(static_cast<uint16_t *>(indexBuffer), topology, count, indexBuffers);
+				break;
+			case VK_INDEX_TYPE_UINT32:
+				ProcessPrimitiveRestart(static_cast<uint32_t *>(indexBuffer), topology, count, indexBuffers);
+				break;
+			default:
+				UNSUPPORTED("VkIndexType %d", int(indexType));
 			}
 		}
 		else
@@ -266,20 +266,20 @@
 			VkDynamicState dynamicState = pCreateInfo->pDynamicState->pDynamicStates[i];
 			switch(dynamicState)
 			{
-				case VK_DYNAMIC_STATE_VIEWPORT:
-				case VK_DYNAMIC_STATE_SCISSOR:
-				case VK_DYNAMIC_STATE_LINE_WIDTH:
-				case VK_DYNAMIC_STATE_DEPTH_BIAS:
-				case VK_DYNAMIC_STATE_BLEND_CONSTANTS:
-				case VK_DYNAMIC_STATE_DEPTH_BOUNDS:
-				case VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK:
-				case VK_DYNAMIC_STATE_STENCIL_WRITE_MASK:
-				case VK_DYNAMIC_STATE_STENCIL_REFERENCE:
-					ASSERT(dynamicState < (sizeof(dynamicStateFlags) * 8));
-					dynamicStateFlags |= (1 << dynamicState);
-					break;
-				default:
-					UNSUPPORTED("VkDynamicState %d", int(dynamicState));
+			case VK_DYNAMIC_STATE_VIEWPORT:
+			case VK_DYNAMIC_STATE_SCISSOR:
+			case VK_DYNAMIC_STATE_LINE_WIDTH:
+			case VK_DYNAMIC_STATE_DEPTH_BIAS:
+			case VK_DYNAMIC_STATE_BLEND_CONSTANTS:
+			case VK_DYNAMIC_STATE_DEPTH_BOUNDS:
+			case VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK:
+			case VK_DYNAMIC_STATE_STENCIL_WRITE_MASK:
+			case VK_DYNAMIC_STATE_STENCIL_REFERENCE:
+				ASSERT(dynamicState < (sizeof(dynamicStateFlags) * 8));
+				dynamicStateFlags |= (1 << dynamicState);
+				break;
+			default:
+				UNSUPPORTED("VkDynamicState %d", int(dynamicState));
 			}
 		}
 	}
@@ -348,22 +348,22 @@
 		// are not enumerated in the official Vulkan header
 		switch((long)(extensionCreateInfo->sType))
 		{
-			case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT:
+		case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT:
 			{
 				const VkPipelineRasterizationLineStateCreateInfoEXT *lineStateCreateInfo = reinterpret_cast<const VkPipelineRasterizationLineStateCreateInfoEXT *>(extensionCreateInfo);
 				lineRasterizationMode = lineStateCreateInfo->lineRasterizationMode;
 			}
 			break;
-			case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
+		case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
 			{
 				const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *provokingVertexModeCreateInfo =
 				    reinterpret_cast<const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *>(extensionCreateInfo);
 				provokingVertexMode = provokingVertexModeCreateInfo->provokingVertexMode;
 			}
 			break;
-			default:
-				WARN("pCreateInfo->pRasterizationState->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str());
-				break;
+		default:
+			WARN("pCreateInfo->pRasterizationState->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str());
+			break;
 		}
 
 		extensionCreateInfo = extensionCreateInfo->pNext;
@@ -422,14 +422,14 @@
 
 		switch(multisampleState->rasterizationSamples)
 		{
-			case VK_SAMPLE_COUNT_1_BIT:
-				sampleCount = 1;
-				break;
-			case VK_SAMPLE_COUNT_4_BIT:
-				sampleCount = 4;
-				break;
-			default:
-				UNSUPPORTED("Unsupported sample count");
+		case VK_SAMPLE_COUNT_1_BIT:
+			sampleCount = 1;
+			break;
+		case VK_SAMPLE_COUNT_4_BIT:
+			sampleCount = 4;
+			break;
+		default:
+			UNSUPPORTED("Unsupported sample count");
 		}
 
 		VkSampleMask sampleMask;
@@ -522,17 +522,17 @@
 {
 	switch(topology)
 	{
-		case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
-			return true;
-		case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
-			return false;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
-			return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_POINT) : false;
-		default:
-			UNSUPPORTED("topology %d", int(topology));
+	case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+		return true;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+		return false;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+		return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_POINT) : false;
+	default:
+		UNSUPPORTED("topology %d", int(topology));
 	}
 	return false;
 }
@@ -541,17 +541,17 @@
 {
 	switch(topology)
 	{
-		case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
-			return false;
-		case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
-			return true;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
-			return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_LINE) : false;
-		default:
-			UNSUPPORTED("topology %d", int(topology));
+	case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+		return false;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+		return true;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+		return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_LINE) : false;
+	default:
+		UNSUPPORTED("topology %d", int(topology));
 	}
 	return false;
 }
@@ -560,16 +560,16 @@
 {
 	switch(topology)
 	{
-		case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
-			return false;
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
-			return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_FILL) : true;
-		default:
-			UNSUPPORTED("topology %d", int(topology));
+	case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+		return false;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+		return polygonModeAware ? (polygonMode == VK_POLYGON_MODE_FILL) : true;
+	default:
+		UNSUPPORTED("topology %d", int(topology));
 	}
 	return false;
 }
@@ -700,16 +700,16 @@
 
 	switch(blendState[index].blendOperation)
 	{
-		case VK_BLEND_OP_ADD:
-		case VK_BLEND_OP_SUBTRACT:
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			return blendState[index].sourceBlendFactor;
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_FACTOR_ONE;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_FACTOR_ONE;
-		default:
-			ASSERT(false);
+	case VK_BLEND_OP_ADD:
+	case VK_BLEND_OP_SUBTRACT:
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		return blendState[index].sourceBlendFactor;
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_FACTOR_ONE;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_FACTOR_ONE;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].sourceBlendFactor;
@@ -723,16 +723,16 @@
 
 	switch(blendState[index].blendOperation)
 	{
-		case VK_BLEND_OP_ADD:
-		case VK_BLEND_OP_SUBTRACT:
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			return blendState[index].destBlendFactor;
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_FACTOR_ONE;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_FACTOR_ONE;
-		default:
-			ASSERT(false);
+	case VK_BLEND_OP_ADD:
+	case VK_BLEND_OP_SUBTRACT:
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		return blendState[index].destBlendFactor;
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_FACTOR_ONE;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_FACTOR_ONE;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].destBlendFactor;
@@ -746,107 +746,107 @@
 
 	switch(blendState[index].blendOperation)
 	{
-		case VK_BLEND_OP_ADD:
-			if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+	case VK_BLEND_OP_ADD:
+		if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
 			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_ZERO_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_DST_EXT;
-				}
-			}
-			else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
-			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_ADD;
-				}
+				return VK_BLEND_OP_ZERO_EXT;
 			}
 			else
 			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_ADD;
-				}
+				return VK_BLEND_OP_DST_EXT;
 			}
-		case VK_BLEND_OP_SUBTRACT:
-			if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+		}
+		else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_ADD;
+			}
+		}
+		else
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_ADD;
+			}
+		}
+	case VK_BLEND_OP_SUBTRACT:
+		if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+		{
+			return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
+		}
+		else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_SUBTRACT;
+			}
+		}
+		else
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_SUBTRACT;
+			}
+		}
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_ZERO_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_DST_EXT;
+			}
+		}
+		else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
 			{
 				return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
 			}
-			else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
+			else
 			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_SUBTRACT;
-				}
+				return VK_BLEND_OP_REVERSE_SUBTRACT;
+			}
+		}
+		else
+		{
+			if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+			{
+				return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
 			}
 			else
 			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_SUBTRACT;
-				}
+				return VK_BLEND_OP_REVERSE_SUBTRACT;
 			}
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_ZERO_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_DST_EXT;
-				}
-			}
-			else if(sourceBlendFactor(index) == VK_BLEND_FACTOR_ONE)
-			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
-				{
-					return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
-				}
-				else
-				{
-					return VK_BLEND_OP_REVERSE_SUBTRACT;
-				}
-			}
-			else
-			{
-				if(destBlendFactor(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
-				{
-					return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
-				}
-				else
-				{
-					return VK_BLEND_OP_REVERSE_SUBTRACT;
-				}
-			}
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_OP_MIN;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_OP_MAX;
-		default:
-			ASSERT(false);
+		}
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_OP_MIN;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_OP_MAX;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].blendOperation;
@@ -858,16 +858,16 @@
 
 	switch(blendState[index].blendOperationAlpha)
 	{
-		case VK_BLEND_OP_ADD:
-		case VK_BLEND_OP_SUBTRACT:
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			return blendState[index].sourceBlendFactorAlpha;
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_FACTOR_ONE;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_FACTOR_ONE;
-		default:
-			ASSERT(false);
+	case VK_BLEND_OP_ADD:
+	case VK_BLEND_OP_SUBTRACT:
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		return blendState[index].sourceBlendFactorAlpha;
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_FACTOR_ONE;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_FACTOR_ONE;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].sourceBlendFactorAlpha;
@@ -879,16 +879,16 @@
 
 	switch(blendState[index].blendOperationAlpha)
 	{
-		case VK_BLEND_OP_ADD:
-		case VK_BLEND_OP_SUBTRACT:
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			return blendState[index].destBlendFactorAlpha;
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_FACTOR_ONE;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_FACTOR_ONE;
-		default:
-			ASSERT(false);
+	case VK_BLEND_OP_ADD:
+	case VK_BLEND_OP_SUBTRACT:
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		return blendState[index].destBlendFactorAlpha;
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_FACTOR_ONE;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_FACTOR_ONE;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].destBlendFactorAlpha;
@@ -900,107 +900,107 @@
 
 	switch(blendState[index].blendOperationAlpha)
 	{
-		case VK_BLEND_OP_ADD:
-			if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+	case VK_BLEND_OP_ADD:
+		if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
 			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_ZERO_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_DST_EXT;
-				}
-			}
-			else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
-			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_ADD;
-				}
+				return VK_BLEND_OP_ZERO_EXT;
 			}
 			else
 			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_ADD;
-				}
+				return VK_BLEND_OP_DST_EXT;
 			}
-		case VK_BLEND_OP_SUBTRACT:
-			if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+		}
+		else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_ADD;
+			}
+		}
+		else
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_ADD;
+			}
+		}
+	case VK_BLEND_OP_SUBTRACT:
+		if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+		{
+			return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
+		}
+		else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_SUBTRACT;
+			}
+		}
+		else
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_SRC_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_SUBTRACT;
+			}
+		}
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
+			{
+				return VK_BLEND_OP_ZERO_EXT;
+			}
+			else
+			{
+				return VK_BLEND_OP_DST_EXT;
+			}
+		}
+		else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
 			{
 				return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
 			}
-			else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
+			else
 			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_SUBTRACT;
-				}
+				return VK_BLEND_OP_REVERSE_SUBTRACT;
+			}
+		}
+		else
+		{
+			if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
+			{
+				return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
 			}
 			else
 			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_SRC_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_SUBTRACT;
-				}
+				return VK_BLEND_OP_REVERSE_SUBTRACT;
 			}
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO)
-				{
-					return VK_BLEND_OP_ZERO_EXT;
-				}
-				else
-				{
-					return VK_BLEND_OP_DST_EXT;
-				}
-			}
-			else if(sourceBlendFactorAlpha(index) == VK_BLEND_FACTOR_ONE)
-			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
-				{
-					return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
-				}
-				else
-				{
-					return VK_BLEND_OP_REVERSE_SUBTRACT;
-				}
-			}
-			else
-			{
-				if(destBlendFactorAlpha(index) == VK_BLEND_FACTOR_ZERO && attachments.isColorClamped(index))
-				{
-					return VK_BLEND_OP_ZERO_EXT;  // Negative, clamped to zero
-				}
-				else
-				{
-					return VK_BLEND_OP_REVERSE_SUBTRACT;
-				}
-			}
-		case VK_BLEND_OP_MIN:
-			return VK_BLEND_OP_MIN;
-		case VK_BLEND_OP_MAX:
-			return VK_BLEND_OP_MAX;
-		default:
-			ASSERT(false);
+		}
+	case VK_BLEND_OP_MIN:
+		return VK_BLEND_OP_MIN;
+	case VK_BLEND_OP_MAX:
+		return VK_BLEND_OP_MAX;
+	default:
+		ASSERT(false);
 	}
 
 	return blendState[index].blendOperationAlpha;
diff --git a/src/Device/ETC_Decoder.cpp b/src/Device/ETC_Decoder.cpp
index a5c8549..4fea526 100644
--- a/src/Device/ETC_Decoder.cpp
+++ b/src/Device/ETC_Decoder.cpp
@@ -623,22 +623,22 @@
 	{
 		switch(x * 4 + y)
 		{
-			case 0: return ma;
-			case 1: return mb;
-			case 2: return mc1 << 1 | mc2;
-			case 3: return md;
-			case 4: return me;
-			case 5: return mf1 << 2 | mf2;
-			case 6: return mg;
-			case 7: return mh;
-			case 8: return mi;
-			case 9: return mj;
-			case 10: return mk1 << 1 | mk2;
-			case 11: return ml;
-			case 12: return mm;
-			case 13: return mn1 << 2 | mn2;
-			case 14: return mo;
-			default: return mp;  // 15
+		case 0: return ma;
+		case 1: return mb;
+		case 2: return mc1 << 1 | mc2;
+		case 3: return md;
+		case 4: return me;
+		case 5: return mf1 << 2 | mf2;
+		case 6: return mg;
+		case 7: return mh;
+		case 8: return mi;
+		case 9: return mj;
+		case 10: return mk1 << 1 | mk2;
+		case 11: return ml;
+		case 12: return mm;
+		case 13: return mn1 << 2 | mn2;
+		case 14: return mo;
+		default: return mp;  // 15
 		}
 	}
 
@@ -676,58 +676,58 @@
 
 	switch(inputType)
 	{
-		case ETC_R_SIGNED:
-		case ETC_R_UNSIGNED:
-			for(int y = 0; y < h; y += 4)
+	case ETC_R_SIGNED:
+	case ETC_R_UNSIGNED:
+		for(int y = 0; y < h; y += 4)
+		{
+			unsigned char *dstRow = dst + (y * dstPitch);
+			for(int x = 0; x < w; x += 4, sources[0]++)
 			{
-				unsigned char *dstRow = dst + (y * dstPitch);
-				for(int x = 0; x < w; x += 4, sources[0]++)
-				{
-					ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 1, x, y, w, h, dstPitch, inputType == ETC_R_SIGNED, true);
-				}
+				ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 1, x, y, w, h, dstPitch, inputType == ETC_R_SIGNED, true);
 			}
-			break;
-		case ETC_RG_SIGNED:
-		case ETC_RG_UNSIGNED:
-			sources[1] = sources[0] + 1;
-			for(int y = 0; y < h; y += 4)
+		}
+		break;
+	case ETC_RG_SIGNED:
+	case ETC_RG_UNSIGNED:
+		sources[1] = sources[0] + 1;
+		for(int y = 0; y < h; y += 4)
+		{
+			unsigned char *dstRow = dst + (y * dstPitch);
+			for(int x = 0; x < w; x += 4, sources[0] += 2, sources[1] += 2)
 			{
-				unsigned char *dstRow = dst + (y * dstPitch);
-				for(int x = 0; x < w; x += 4, sources[0] += 2, sources[1] += 2)
-				{
-					ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 2, x, y, w, h, dstPitch, inputType == ETC_RG_SIGNED, true);
-				}
+				ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 2, x, y, w, h, dstPitch, inputType == ETC_RG_SIGNED, true);
 			}
-			break;
-		case ETC_RGB:
-		case ETC_RGB_PUNCHTHROUGH_ALPHA:
-			for(int y = 0; y < h; y += 4)
+		}
+		break;
+	case ETC_RGB:
+	case ETC_RGB_PUNCHTHROUGH_ALPHA:
+		for(int y = 0; y < h; y += 4)
+		{
+			unsigned char *dstRow = dst + (y * dstPitch);
+			for(int x = 0; x < w; x += 4, sources[0]++)
 			{
-				unsigned char *dstRow = dst + (y * dstPitch);
-				for(int x = 0; x < w; x += 4, sources[0]++)
-				{
-					sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, w, h, dstPitch, alphaValues, inputType == ETC_RGB_PUNCHTHROUGH_ALPHA);
-				}
+				sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, w, h, dstPitch, alphaValues, inputType == ETC_RGB_PUNCHTHROUGH_ALPHA);
 			}
-			break;
-		case ETC_RGBA:
-			for(int y = 0; y < h; y += 4)
+		}
+		break;
+	case ETC_RGBA:
+		for(int y = 0; y < h; y += 4)
+		{
+			unsigned char *dstRow = dst + (y * dstPitch);
+			for(int x = 0; x < w; x += 4)
 			{
-				unsigned char *dstRow = dst + (y * dstPitch);
-				for(int x = 0; x < w; x += 4)
-				{
-					// Decode Alpha
-					ETC2::DecodeBlock(&sources[0], &(alphaValues[0][0]), 1, x, y, w, h, 4, false, false);
-					sources[0]++;  // RGBA packets are 128 bits, so move on to the next 64 bit packet to decode the RGB color
+				// Decode Alpha
+				ETC2::DecodeBlock(&sources[0], &(alphaValues[0][0]), 1, x, y, w, h, 4, false, false);
+				sources[0]++;  // RGBA packets are 128 bits, so move on to the next 64 bit packet to decode the RGB color
 
-					// Decode RGB
-					sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, w, h, dstPitch, alphaValues, false);
-					sources[0]++;
-				}
+				// Decode RGB
+				sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, w, h, dstPitch, alphaValues, false);
+				sources[0]++;
 			}
-			break;
-		default:
-			return false;
+		}
+		break;
+	default:
+		return false;
 	}
 
 	return true;
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index 064df1f..554fb22 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -54,7 +54,7 @@
 
 	switch(topology)
 	{
-		case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+	case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
 		{
 			auto index = start;
 			auto pointBatch = &(batch[0][0]);
@@ -69,9 +69,9 @@
 			{
 				*pointBatch++ = indices[index];
 			}
-			break;
 		}
-		case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+		break;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
 		{
 			auto index = 2 * start;
 			for(unsigned int i = 0; i < triangleCount; i++)
@@ -82,9 +82,9 @@
 
 				index += 2;
 			}
-			break;
 		}
-		case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+		break;
+	case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
 		{
 			auto index = start;
 			for(unsigned int i = 0; i < triangleCount; i++)
@@ -95,9 +95,9 @@
 
 				index += 1;
 			}
-			break;
 		}
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+		break;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
 		{
 			auto index = 3 * start;
 			for(unsigned int i = 0; i < triangleCount; i++)
@@ -108,9 +108,9 @@
 
 				index += 3;
 			}
-			break;
 		}
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+		break;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
 		{
 			auto index = start;
 			for(unsigned int i = 0; i < triangleCount; i++)
@@ -121,9 +121,9 @@
 
 				index += 1;
 			}
-			break;
 		}
-		case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+		break;
+	case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
 		{
 			auto index = start + 1;
 			for(unsigned int i = 0; i < triangleCount; i++)
@@ -134,11 +134,11 @@
 
 				index += 1;
 			}
-			break;
 		}
-		default:
-			ASSERT(false);
-			return false;
+		break;
+	default:
+		ASSERT(false);
+		return false;
 	}
 
 	return true;
@@ -229,20 +229,20 @@
 	{
 		switch(pipelineState.getPolygonMode())
 		{
-			case VK_POLYGON_MODE_FILL:
-				setupPrimitives = &DrawCall::setupSolidTriangles;
-				break;
-			case VK_POLYGON_MODE_LINE:
-				setupPrimitives = &DrawCall::setupWireframeTriangles;
-				numPrimitivesPerBatch /= 3;
-				break;
-			case VK_POLYGON_MODE_POINT:
-				setupPrimitives = &DrawCall::setupPointTriangles;
-				numPrimitivesPerBatch /= 3;
-				break;
-			default:
-				UNSUPPORTED("polygon mode: %d", int(pipelineState.getPolygonMode()));
-				return;
+		case VK_POLYGON_MODE_FILL:
+			setupPrimitives = &DrawCall::setupSolidTriangles;
+			break;
+		case VK_POLYGON_MODE_LINE:
+			setupPrimitives = &DrawCall::setupWireframeTriangles;
+			numPrimitivesPerBatch /= 3;
+			break;
+		case VK_POLYGON_MODE_POINT:
+			setupPrimitives = &DrawCall::setupPointTriangles;
+			numPrimitivesPerBatch /= 3;
+			break;
+		default:
+			UNSUPPORTED("polygon mode: %d", int(pipelineState.getPolygonMode()));
+			return;
 		}
 	}
 	else if(pipelineState.isDrawLine(false))
@@ -361,15 +361,15 @@
 		{
 			switch(attachments.depthBuffer->getFormat(VK_IMAGE_ASPECT_DEPTH_BIT))
 			{
-				case VK_FORMAT_D16_UNORM:
-					data->minimumResolvableDepthDifference = 1.0f / 0xFFFF;
-					break;
-				case VK_FORMAT_D32_SFLOAT:
-					// The minimum resolvable depth difference is determined per-polygon for floating-point depth
-					// buffers. DrawData::minimumResolvableDepthDifference is unused.
-					break;
-				default:
-					UNSUPPORTED("Depth format: %d", int(attachments.depthBuffer->getFormat(VK_IMAGE_ASPECT_DEPTH_BIT)));
+			case VK_FORMAT_D16_UNORM:
+				data->minimumResolvableDepthDifference = 1.0f / 0xFFFF;
+				break;
+			case VK_FORMAT_D32_SFLOAT:
+				// The minimum resolvable depth difference is determined per-polygon for floating-point depth
+				// buffers. DrawData::minimumResolvableDepthDifference is unused.
+				break;
+			default:
+				UNSUPPORTED("Depth format: %d", int(attachments.depthBuffer->getFormat(VK_IMAGE_ASPECT_DEPTH_BIT)));
 			}
 		}
 	}
@@ -625,22 +625,22 @@
 	{
 		switch(indexType)
 		{
-			case VK_INDEX_TYPE_UINT16:
-				if(!setBatchIndices(triangleIndicesOut, topology, provokingVertexMode, static_cast<const uint16_t *>(primitiveIndices), start, triangleCount))
-				{
-					return;
-				}
-				break;
-			case VK_INDEX_TYPE_UINT32:
-				if(!setBatchIndices(triangleIndicesOut, topology, provokingVertexMode, static_cast<const uint32_t *>(primitiveIndices), start, triangleCount))
-				{
-					return;
-				}
-				break;
-				break;
-			default:
-				ASSERT(false);
+		case VK_INDEX_TYPE_UINT16:
+			if(!setBatchIndices(triangleIndicesOut, topology, provokingVertexMode, static_cast<const uint16_t *>(primitiveIndices), start, triangleCount))
+			{
 				return;
+			}
+			break;
+		case VK_INDEX_TYPE_UINT32:
+			if(!setBatchIndices(triangleIndicesOut, topology, provokingVertexMode, static_cast<const uint32_t *>(primitiveIndices), start, triangleCount))
+			{
+				return;
+			}
+			break;
+			break;
+		default:
+			ASSERT(false);
+			return;
 		}
 	}
 
diff --git a/src/Device/Sampler.hpp b/src/Device/Sampler.hpp
index 87111d7..712977d 100644
--- a/src/Device/Sampler.hpp
+++ b/src/Device/Sampler.hpp
@@ -118,17 +118,17 @@
 	{
 		switch(textureType)
 		{
-			case VK_IMAGE_VIEW_TYPE_1D:
-			case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
-				return true;
-			case VK_IMAGE_VIEW_TYPE_2D:
-			case VK_IMAGE_VIEW_TYPE_3D:
-			case VK_IMAGE_VIEW_TYPE_CUBE:
-			case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
-				return false;
-			default:
-				UNSUPPORTED("VkImageViewType %d", (int)textureType);
+		case VK_IMAGE_VIEW_TYPE_1D:
+		case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+			return true;
+		case VK_IMAGE_VIEW_TYPE_2D:
+		case VK_IMAGE_VIEW_TYPE_3D:
+		case VK_IMAGE_VIEW_TYPE_CUBE:
+		case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+			return false;
+		default:
+			UNSUPPORTED("VkImageViewType %d", (int)textureType);
 		}
 
 		return false;
@@ -138,17 +138,17 @@
 	{
 		switch(textureType)
 		{
-			case VK_IMAGE_VIEW_TYPE_2D:
-			case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
-				return true;
-			case VK_IMAGE_VIEW_TYPE_1D:
-			case VK_IMAGE_VIEW_TYPE_3D:
-			case VK_IMAGE_VIEW_TYPE_CUBE:
-			case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
-				return false;
-			default:
-				UNSUPPORTED("VkImageViewType %d", (int)textureType);
+		case VK_IMAGE_VIEW_TYPE_2D:
+		case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+			return true;
+		case VK_IMAGE_VIEW_TYPE_1D:
+		case VK_IMAGE_VIEW_TYPE_3D:
+		case VK_IMAGE_VIEW_TYPE_CUBE:
+		case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+			return false;
+		default:
+			UNSUPPORTED("VkImageViewType %d", (int)textureType);
 		}
 
 		return false;
@@ -158,17 +158,17 @@
 	{
 		switch(textureType)
 		{
-			case VK_IMAGE_VIEW_TYPE_3D:
-				return true;
-			case VK_IMAGE_VIEW_TYPE_1D:
-			case VK_IMAGE_VIEW_TYPE_2D:
-			case VK_IMAGE_VIEW_TYPE_CUBE:
-			case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
-				return false;
-			default:
-				UNSUPPORTED("VkImageViewType %d", (int)textureType);
+		case VK_IMAGE_VIEW_TYPE_3D:
+			return true;
+		case VK_IMAGE_VIEW_TYPE_1D:
+		case VK_IMAGE_VIEW_TYPE_2D:
+		case VK_IMAGE_VIEW_TYPE_CUBE:
+		case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+			return false;
+		default:
+			UNSUPPORTED("VkImageViewType %d", (int)textureType);
 		}
 
 		return false;
@@ -178,17 +178,17 @@
 	{
 		switch(textureType)
 		{
-			case VK_IMAGE_VIEW_TYPE_CUBE:
-			case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
-				return true;
-			case VK_IMAGE_VIEW_TYPE_1D:
-			case VK_IMAGE_VIEW_TYPE_2D:
-			case VK_IMAGE_VIEW_TYPE_3D:
-			case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
-				return false;
-			default:
-				UNSUPPORTED("VkImageViewType %d", (int)textureType);
+		case VK_IMAGE_VIEW_TYPE_CUBE:
+		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+			return true;
+		case VK_IMAGE_VIEW_TYPE_1D:
+		case VK_IMAGE_VIEW_TYPE_2D:
+		case VK_IMAGE_VIEW_TYPE_3D:
+		case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+			return false;
+		default:
+			UNSUPPORTED("VkImageViewType %d", (int)textureType);
 		}
 
 		return false;
@@ -198,17 +198,17 @@
 	{
 		switch(textureType)
 		{
-			case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
-			case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
-				return true;
-			case VK_IMAGE_VIEW_TYPE_1D:
-			case VK_IMAGE_VIEW_TYPE_2D:
-			case VK_IMAGE_VIEW_TYPE_3D:
-			case VK_IMAGE_VIEW_TYPE_CUBE:
-				return false;
-			default:
-				UNSUPPORTED("VkImageViewType %d", (int)textureType);
+		case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+			return true;
+		case VK_IMAGE_VIEW_TYPE_1D:
+		case VK_IMAGE_VIEW_TYPE_2D:
+		case VK_IMAGE_VIEW_TYPE_3D:
+		case VK_IMAGE_VIEW_TYPE_CUBE:
+			return false;
+		default:
+			UNSUPPORTED("VkImageViewType %d", (int)textureType);
 		}
 
 		return false;
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index c42af5f..58f6e5a 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -278,80 +278,80 @@
 		auto format = state.targetFormat[index];
 		switch(format)
 		{
-			case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			case VK_FORMAT_B8G8R8A8_UNORM:
-			case VK_FORMAT_B8G8R8A8_SRGB:
-			case VK_FORMAT_R8G8B8A8_UNORM:
-			case VK_FORMAT_R8G8B8A8_SRGB:
-			case VK_FORMAT_R8G8_UNORM:
-			case VK_FORMAT_R8_UNORM:
-			case VK_FORMAT_R16G16_UNORM:
-			case VK_FORMAT_R16G16B16A16_UNORM:
-			case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-			case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-			case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-			case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-				for(unsigned int q = sampleLoopInit; q < sampleLoopEnd; q++)
+		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		case VK_FORMAT_B8G8R8A8_UNORM:
+		case VK_FORMAT_B8G8R8A8_SRGB:
+		case VK_FORMAT_R8G8B8A8_UNORM:
+		case VK_FORMAT_R8G8B8A8_SRGB:
+		case VK_FORMAT_R8G8_UNORM:
+		case VK_FORMAT_R8_UNORM:
+		case VK_FORMAT_R16G16_UNORM:
+		case VK_FORMAT_R16G16B16A16_UNORM:
+		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+			for(unsigned int q = sampleLoopInit; q < sampleLoopEnd; q++)
+			{
+				if(state.multiSampleMask & (1 << q))
 				{
-					if(state.multiSampleMask & (1 << q))
-					{
-						Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
-						Vector4s color;
+					Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
+					Vector4s color;
 
-						color.x = convertFixed16(c[index].x, false);
-						color.y = convertFixed16(c[index].y, false);
-						color.z = convertFixed16(c[index].z, false);
-						color.w = convertFixed16(c[index].w, false);
+					color.x = convertFixed16(c[index].x, false);
+					color.y = convertFixed16(c[index].y, false);
+					color.z = convertFixed16(c[index].z, false);
+					color.w = convertFixed16(c[index].w, false);
 
-						alphaBlend(index, buffer, color, x);
-						writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
-					}
+					alphaBlend(index, buffer, color, x);
+					writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
 				}
-				break;
-			case VK_FORMAT_R16_SFLOAT:
-			case VK_FORMAT_R16G16_SFLOAT:
-			case VK_FORMAT_R16G16B16A16_SFLOAT:
-			case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			case VK_FORMAT_R32_SFLOAT:
-			case VK_FORMAT_R32G32_SFLOAT:
-			case VK_FORMAT_R32G32B32A32_SFLOAT:
-			case VK_FORMAT_R32_SINT:
-			case VK_FORMAT_R32G32_SINT:
-			case VK_FORMAT_R32G32B32A32_SINT:
-			case VK_FORMAT_R32_UINT:
-			case VK_FORMAT_R32G32_UINT:
-			case VK_FORMAT_R32G32B32A32_UINT:
-			case VK_FORMAT_R16_SINT:
-			case VK_FORMAT_R16G16_SINT:
-			case VK_FORMAT_R16G16B16A16_SINT:
-			case VK_FORMAT_R16_UINT:
-			case VK_FORMAT_R16G16_UINT:
-			case VK_FORMAT_R16G16B16A16_UINT:
-			case VK_FORMAT_R8_SINT:
-			case VK_FORMAT_R8G8_SINT:
-			case VK_FORMAT_R8G8B8A8_SINT:
-			case VK_FORMAT_R8_UINT:
-			case VK_FORMAT_R8G8_UINT:
-			case VK_FORMAT_R8G8B8A8_UINT:
-			case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-			case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-			case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-				for(unsigned int q = sampleLoopInit; q < sampleLoopEnd; q++)
+			}
+			break;
+		case VK_FORMAT_R16_SFLOAT:
+		case VK_FORMAT_R16G16_SFLOAT:
+		case VK_FORMAT_R16G16B16A16_SFLOAT:
+		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		case VK_FORMAT_R32_SFLOAT:
+		case VK_FORMAT_R32G32_SFLOAT:
+		case VK_FORMAT_R32G32B32A32_SFLOAT:
+		case VK_FORMAT_R32_SINT:
+		case VK_FORMAT_R32G32_SINT:
+		case VK_FORMAT_R32G32B32A32_SINT:
+		case VK_FORMAT_R32_UINT:
+		case VK_FORMAT_R32G32_UINT:
+		case VK_FORMAT_R32G32B32A32_UINT:
+		case VK_FORMAT_R16_SINT:
+		case VK_FORMAT_R16G16_SINT:
+		case VK_FORMAT_R16G16B16A16_SINT:
+		case VK_FORMAT_R16_UINT:
+		case VK_FORMAT_R16G16_UINT:
+		case VK_FORMAT_R16G16B16A16_UINT:
+		case VK_FORMAT_R8_SINT:
+		case VK_FORMAT_R8G8_SINT:
+		case VK_FORMAT_R8G8B8A8_SINT:
+		case VK_FORMAT_R8_UINT:
+		case VK_FORMAT_R8G8_UINT:
+		case VK_FORMAT_R8G8B8A8_UINT:
+		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+			for(unsigned int q = sampleLoopInit; q < sampleLoopEnd; q++)
+			{
+				if(state.multiSampleMask & (1 << q))
 				{
-					if(state.multiSampleMask & (1 << q))
-					{
-						Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
-						Vector4f color = c[index];
+					Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
+					Vector4f color = c[index];
 
-						alphaBlend(index, buffer, color, x);
-						writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
-					}
+					alphaBlend(index, buffer, color, x);
+					writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
 				}
-				break;
-			default:
-				UNSUPPORTED("VkFormat: %d", int(format));
+			}
+			break;
+		default:
+			UNSUPPORTED("VkFormat: %d", int(format));
 		}
 	}
 }
@@ -367,63 +367,63 @@
 
 		switch(state.targetFormat[index])
 		{
-			case VK_FORMAT_UNDEFINED:
-				break;
-			case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			case VK_FORMAT_B8G8R8A8_UNORM:
-			case VK_FORMAT_B8G8R8A8_SRGB:
-			case VK_FORMAT_R8G8B8A8_UNORM:
-			case VK_FORMAT_R8G8B8A8_SRGB:
-			case VK_FORMAT_R8G8_UNORM:
-			case VK_FORMAT_R8_UNORM:
-			case VK_FORMAT_R16G16_UNORM:
-			case VK_FORMAT_R16G16B16A16_UNORM:
-			case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-			case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-			case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-			case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-				oC[index].x = Max(oC[index].x, Float4(0.0f));
-				oC[index].x = Min(oC[index].x, Float4(1.0f));
-				oC[index].y = Max(oC[index].y, Float4(0.0f));
-				oC[index].y = Min(oC[index].y, Float4(1.0f));
-				oC[index].z = Max(oC[index].z, Float4(0.0f));
-				oC[index].z = Min(oC[index].z, Float4(1.0f));
-				oC[index].w = Max(oC[index].w, Float4(0.0f));
-				oC[index].w = Min(oC[index].w, Float4(1.0f));
-				break;
-			case VK_FORMAT_R32_SFLOAT:
-			case VK_FORMAT_R32G32_SFLOAT:
-			case VK_FORMAT_R32G32B32A32_SFLOAT:
-			case VK_FORMAT_R32_SINT:
-			case VK_FORMAT_R32G32_SINT:
-			case VK_FORMAT_R32G32B32A32_SINT:
-			case VK_FORMAT_R32_UINT:
-			case VK_FORMAT_R32G32_UINT:
-			case VK_FORMAT_R32G32B32A32_UINT:
-			case VK_FORMAT_R16_SFLOAT:
-			case VK_FORMAT_R16G16_SFLOAT:
-			case VK_FORMAT_R16G16B16A16_SFLOAT:
-			case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			case VK_FORMAT_R16_SINT:
-			case VK_FORMAT_R16G16_SINT:
-			case VK_FORMAT_R16G16B16A16_SINT:
-			case VK_FORMAT_R16_UINT:
-			case VK_FORMAT_R16G16_UINT:
-			case VK_FORMAT_R16G16B16A16_UINT:
-			case VK_FORMAT_R8_SINT:
-			case VK_FORMAT_R8G8_SINT:
-			case VK_FORMAT_R8G8B8A8_SINT:
-			case VK_FORMAT_R8_UINT:
-			case VK_FORMAT_R8G8_UINT:
-			case VK_FORMAT_R8G8B8A8_UINT:
-			case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-			case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-			case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-				break;
-			default:
-				UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
+		case VK_FORMAT_UNDEFINED:
+			break;
+		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		case VK_FORMAT_B8G8R8A8_UNORM:
+		case VK_FORMAT_B8G8R8A8_SRGB:
+		case VK_FORMAT_R8G8B8A8_UNORM:
+		case VK_FORMAT_R8G8B8A8_SRGB:
+		case VK_FORMAT_R8G8_UNORM:
+		case VK_FORMAT_R8_UNORM:
+		case VK_FORMAT_R16G16_UNORM:
+		case VK_FORMAT_R16G16B16A16_UNORM:
+		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+			oC[index].x = Max(oC[index].x, Float4(0.0f));
+			oC[index].x = Min(oC[index].x, Float4(1.0f));
+			oC[index].y = Max(oC[index].y, Float4(0.0f));
+			oC[index].y = Min(oC[index].y, Float4(1.0f));
+			oC[index].z = Max(oC[index].z, Float4(0.0f));
+			oC[index].z = Min(oC[index].z, Float4(1.0f));
+			oC[index].w = Max(oC[index].w, Float4(0.0f));
+			oC[index].w = Min(oC[index].w, Float4(1.0f));
+			break;
+		case VK_FORMAT_R32_SFLOAT:
+		case VK_FORMAT_R32G32_SFLOAT:
+		case VK_FORMAT_R32G32B32A32_SFLOAT:
+		case VK_FORMAT_R32_SINT:
+		case VK_FORMAT_R32G32_SINT:
+		case VK_FORMAT_R32G32B32A32_SINT:
+		case VK_FORMAT_R32_UINT:
+		case VK_FORMAT_R32G32_UINT:
+		case VK_FORMAT_R32G32B32A32_UINT:
+		case VK_FORMAT_R16_SFLOAT:
+		case VK_FORMAT_R16G16_SFLOAT:
+		case VK_FORMAT_R16G16B16A16_SFLOAT:
+		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		case VK_FORMAT_R16_SINT:
+		case VK_FORMAT_R16G16_SINT:
+		case VK_FORMAT_R16G16B16A16_SINT:
+		case VK_FORMAT_R16_UINT:
+		case VK_FORMAT_R16G16_UINT:
+		case VK_FORMAT_R16G16B16A16_UINT:
+		case VK_FORMAT_R8_SINT:
+		case VK_FORMAT_R8G8_SINT:
+		case VK_FORMAT_R8G8B8A8_SINT:
+		case VK_FORMAT_R8_UINT:
+		case VK_FORMAT_R8G8_UINT:
+		case VK_FORMAT_R8G8B8A8_UINT:
+		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+			break;
+		default:
+			UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
 		}
 	}
 }
diff --git a/src/Pipeline/PixelRoutine.cpp b/src/Pipeline/PixelRoutine.cpp
index f94155e..f1c55be 100644
--- a/src/Pipeline/PixelRoutine.cpp
+++ b/src/Pipeline/PixelRoutine.cpp
@@ -390,43 +390,43 @@
 
 	switch(stencilCompareMode)
 	{
-		case VK_COMPARE_OP_ALWAYS:
-			value = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
-			break;
-		case VK_COMPARE_OP_NEVER:
-			value = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-			break;
-		case VK_COMPARE_OP_LESS:  // a < b ~ b > a
-			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
-			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
-			break;
-		case VK_COMPARE_OP_EQUAL:
-			value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
-			break;
-		case VK_COMPARE_OP_NOT_EQUAL:  // a != b ~ !(a == b)
-			value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
-			value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
-			break;
-		case VK_COMPARE_OP_LESS_OR_EQUAL:  // a <= b ~ (b > a) || (a == b)
-			equal = value;
-			equal = CmpEQ(equal, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
-			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
-			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
-			value |= equal;
-			break;
-		case VK_COMPARE_OP_GREATER:  // a > b
-			equal = *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ));
-			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
-			equal = CmpGT(As<SByte8>(equal), As<SByte8>(value));
-			value = equal;
-			break;
-		case VK_COMPARE_OP_GREATER_OR_EQUAL:  // a >= b ~ !(a < b) ~ !(b > a)
-			value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
-			value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
-			value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
-			break;
-		default:
-			UNSUPPORTED("VkCompareOp: %d", int(stencilCompareMode));
+	case VK_COMPARE_OP_ALWAYS:
+		value = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+		break;
+	case VK_COMPARE_OP_NEVER:
+		value = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+		break;
+	case VK_COMPARE_OP_LESS:  // a < b ~ b > a
+		value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+		value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
+		break;
+	case VK_COMPARE_OP_EQUAL:
+		value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
+		break;
+	case VK_COMPARE_OP_NOT_EQUAL:  // a != b ~ !(a == b)
+		value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
+		value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+		break;
+	case VK_COMPARE_OP_LESS_OR_EQUAL:  // a <= b ~ (b > a) || (a == b)
+		equal = value;
+		equal = CmpEQ(equal, *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedQ)));
+		value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+		value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
+		value |= equal;
+		break;
+	case VK_COMPARE_OP_GREATER:  // a > b
+		equal = *Pointer<Byte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ));
+		value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+		equal = CmpGT(As<SByte8>(equal), As<SByte8>(value));
+		value = equal;
+		break;
+	case VK_COMPARE_OP_GREATER_OR_EQUAL:  // a >= b ~ !(a < b) ~ !(b > a)
+		value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+		value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData, stencil[isBack].referenceMaskedSignedQ)));
+		value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+		break;
+	default:
+		UNSUPPORTED("VkCompareOp: %d", int(stencilCompareMode));
 	}
 }
 
@@ -458,45 +458,45 @@
 
 	switch(state.depthCompareMode)
 	{
-		case VK_COMPARE_OP_ALWAYS:
-			// Optimized
-			break;
-		case VK_COMPARE_OP_NEVER:
-			// Optimized
-			break;
-		case VK_COMPARE_OP_EQUAL:
-			zTest = CmpEQ(zValue, Z);
-			break;
-		case VK_COMPARE_OP_NOT_EQUAL:
-			zTest = CmpNEQ(zValue, Z);
-			break;
-		case VK_COMPARE_OP_LESS:
-			zTest = CmpNLE(zValue, Z);
-			break;
-		case VK_COMPARE_OP_GREATER_OR_EQUAL:
-			zTest = CmpLE(zValue, Z);
-			break;
-		case VK_COMPARE_OP_LESS_OR_EQUAL:
-			zTest = CmpNLT(zValue, Z);
-			break;
-		case VK_COMPARE_OP_GREATER:
-			zTest = CmpLT(zValue, Z);
-			break;
-		default:
-			UNSUPPORTED("VkCompareOp: %d", int(state.depthCompareMode));
+	case VK_COMPARE_OP_ALWAYS:
+		// Optimized
+		break;
+	case VK_COMPARE_OP_NEVER:
+		// Optimized
+		break;
+	case VK_COMPARE_OP_EQUAL:
+		zTest = CmpEQ(zValue, Z);
+		break;
+	case VK_COMPARE_OP_NOT_EQUAL:
+		zTest = CmpNEQ(zValue, Z);
+		break;
+	case VK_COMPARE_OP_LESS:
+		zTest = CmpNLE(zValue, Z);
+		break;
+	case VK_COMPARE_OP_GREATER_OR_EQUAL:
+		zTest = CmpLE(zValue, Z);
+		break;
+	case VK_COMPARE_OP_LESS_OR_EQUAL:
+		zTest = CmpNLT(zValue, Z);
+		break;
+	case VK_COMPARE_OP_GREATER:
+		zTest = CmpLT(zValue, Z);
+		break;
+	default:
+		UNSUPPORTED("VkCompareOp: %d", int(state.depthCompareMode));
 	}
 
 	switch(state.depthCompareMode)
 	{
-		case VK_COMPARE_OP_ALWAYS:
-			zMask = cMask;
-			break;
-		case VK_COMPARE_OP_NEVER:
-			zMask = 0x0;
-			break;
-		default:
-			zMask = SignMask(zTest) & cMask;
-			break;
+	case VK_COMPARE_OP_ALWAYS:
+		zMask = cMask;
+		break;
+	case VK_COMPARE_OP_NEVER:
+		zMask = 0x0;
+		break;
+	default:
+		zMask = SignMask(zTest) & cMask;
+		break;
 	}
 
 	if(state.stencilActive)
@@ -540,45 +540,45 @@
 
 	switch(state.depthCompareMode)
 	{
-		case VK_COMPARE_OP_ALWAYS:
-			// Optimized
-			break;
-		case VK_COMPARE_OP_NEVER:
-			// Optimized
-			break;
-		case VK_COMPARE_OP_EQUAL:
-			zTest = Int4(CmpEQ(zValue, Z));
-			break;
-		case VK_COMPARE_OP_NOT_EQUAL:
-			zTest = ~Int4(CmpEQ(zValue, Z));
-			break;
-		case VK_COMPARE_OP_LESS:
-			zTest = Int4(CmpGT(zValue, Z));
-			break;
-		case VK_COMPARE_OP_GREATER_OR_EQUAL:
-			zTest = ~Int4(CmpGT(zValue, Z));
-			break;
-		case VK_COMPARE_OP_LESS_OR_EQUAL:
-			zTest = ~Int4(CmpGT(Z, zValue));
-			break;
-		case VK_COMPARE_OP_GREATER:
-			zTest = Int4(CmpGT(Z, zValue));
-			break;
-		default:
-			UNSUPPORTED("VkCompareOp: %d", int(state.depthCompareMode));
+	case VK_COMPARE_OP_ALWAYS:
+		// Optimized
+		break;
+	case VK_COMPARE_OP_NEVER:
+		// Optimized
+		break;
+	case VK_COMPARE_OP_EQUAL:
+		zTest = Int4(CmpEQ(zValue, Z));
+		break;
+	case VK_COMPARE_OP_NOT_EQUAL:
+		zTest = ~Int4(CmpEQ(zValue, Z));
+		break;
+	case VK_COMPARE_OP_LESS:
+		zTest = Int4(CmpGT(zValue, Z));
+		break;
+	case VK_COMPARE_OP_GREATER_OR_EQUAL:
+		zTest = ~Int4(CmpGT(zValue, Z));
+		break;
+	case VK_COMPARE_OP_LESS_OR_EQUAL:
+		zTest = ~Int4(CmpGT(Z, zValue));
+		break;
+	case VK_COMPARE_OP_GREATER:
+		zTest = Int4(CmpGT(Z, zValue));
+		break;
+	default:
+		UNSUPPORTED("VkCompareOp: %d", int(state.depthCompareMode));
 	}
 
 	switch(state.depthCompareMode)
 	{
-		case VK_COMPARE_OP_ALWAYS:
-			zMask = cMask;
-			break;
-		case VK_COMPARE_OP_NEVER:
-			zMask = 0x0;
-			break;
-		default:
-			zMask = SignMask(zTest) & cMask;
-			break;
+	case VK_COMPARE_OP_ALWAYS:
+		zMask = cMask;
+		break;
+	case VK_COMPARE_OP_NEVER:
+		zMask = 0x0;
+		break;
+	default:
+		zMask = SignMask(zTest) & cMask;
+		break;
 	}
 
 	if(state.stencilActive)
@@ -885,32 +885,32 @@
 {
 	switch(operation)
 	{
-		case VK_STENCIL_OP_KEEP:
-			output = bufferValue;
-			break;
-		case VK_STENCIL_OP_ZERO:
-			output = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-			break;
-		case VK_STENCIL_OP_REPLACE:
-			output = stencilReplaceRef(isBack);
-			break;
-		case VK_STENCIL_OP_INCREMENT_AND_CLAMP:
-			output = AddSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
-			break;
-		case VK_STENCIL_OP_DECREMENT_AND_CLAMP:
-			output = SubSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
-			break;
-		case VK_STENCIL_OP_INVERT:
-			output = bufferValue ^ Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
-			break;
-		case VK_STENCIL_OP_INCREMENT_AND_WRAP:
-			output = bufferValue + Byte8(1, 1, 1, 1, 1, 1, 1, 1);
-			break;
-		case VK_STENCIL_OP_DECREMENT_AND_WRAP:
-			output = bufferValue - Byte8(1, 1, 1, 1, 1, 1, 1, 1);
-			break;
-		default:
-			UNSUPPORTED("VkStencilOp: %d", int(operation));
+	case VK_STENCIL_OP_KEEP:
+		output = bufferValue;
+		break;
+	case VK_STENCIL_OP_ZERO:
+		output = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+		break;
+	case VK_STENCIL_OP_REPLACE:
+		output = stencilReplaceRef(isBack);
+		break;
+	case VK_STENCIL_OP_INCREMENT_AND_CLAMP:
+		output = AddSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
+		break;
+	case VK_STENCIL_OP_DECREMENT_AND_CLAMP:
+		output = SubSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
+		break;
+	case VK_STENCIL_OP_INVERT:
+		output = bufferValue ^ Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+		break;
+	case VK_STENCIL_OP_INCREMENT_AND_WRAP:
+		output = bufferValue + Byte8(1, 1, 1, 1, 1, 1, 1, 1);
+		break;
+	case VK_STENCIL_OP_DECREMENT_AND_WRAP:
+		output = bufferValue - Byte8(1, 1, 1, 1, 1, 1, 1, 1);
+		break;
+	default:
+		UNSUPPORTED("VkStencilOp: %d", int(operation));
 	}
 }
 
@@ -918,80 +918,80 @@
 {
 	switch(blendFactorActive)
 	{
-		case VK_BLEND_FACTOR_ZERO:
-			// Optimized
-			break;
-		case VK_BLEND_FACTOR_ONE:
-			// Optimized
-			break;
-		case VK_BLEND_FACTOR_SRC_COLOR:
-			blendFactor.x = current.x;
-			blendFactor.y = current.y;
-			blendFactor.z = current.z;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
-			blendFactor.x = Short4(0xFFFFu) - current.x;
-			blendFactor.y = Short4(0xFFFFu) - current.y;
-			blendFactor.z = Short4(0xFFFFu) - current.z;
-			break;
-		case VK_BLEND_FACTOR_DST_COLOR:
-			blendFactor.x = pixel.x;
-			blendFactor.y = pixel.y;
-			blendFactor.z = pixel.z;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
-			blendFactor.x = Short4(0xFFFFu) - pixel.x;
-			blendFactor.y = Short4(0xFFFFu) - pixel.y;
-			blendFactor.z = Short4(0xFFFFu) - pixel.z;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA:
-			blendFactor.x = current.w;
-			blendFactor.y = current.w;
-			blendFactor.z = current.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
-			blendFactor.x = Short4(0xFFFFu) - current.w;
-			blendFactor.y = Short4(0xFFFFu) - current.w;
-			blendFactor.z = Short4(0xFFFFu) - current.w;
-			break;
-		case VK_BLEND_FACTOR_DST_ALPHA:
-			blendFactor.x = pixel.w;
-			blendFactor.y = pixel.w;
-			blendFactor.z = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
-			blendFactor.x = Short4(0xFFFFu) - pixel.w;
-			blendFactor.y = Short4(0xFFFFu) - pixel.w;
-			blendFactor.z = Short4(0xFFFFu) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
-			blendFactor.x = Short4(0xFFFFu) - pixel.w;
-			blendFactor.x = Min(As<UShort4>(blendFactor.x), As<UShort4>(current.w));
-			blendFactor.y = blendFactor.x;
-			blendFactor.z = blendFactor.x;
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_COLOR:
-			blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[0]));
-			blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[1]));
-			blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[2]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
-			blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[0]));
-			blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[1]));
-			blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[2]));
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_ALPHA:
-			blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
-			blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
-			blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
-			blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
-			blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
-			blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
-			break;
-		default:
-			UNSUPPORTED("VkBlendFactor: %d", int(blendFactorActive));
+	case VK_BLEND_FACTOR_ZERO:
+		// Optimized
+		break;
+	case VK_BLEND_FACTOR_ONE:
+		// Optimized
+		break;
+	case VK_BLEND_FACTOR_SRC_COLOR:
+		blendFactor.x = current.x;
+		blendFactor.y = current.y;
+		blendFactor.z = current.z;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
+		blendFactor.x = Short4(0xFFFFu) - current.x;
+		blendFactor.y = Short4(0xFFFFu) - current.y;
+		blendFactor.z = Short4(0xFFFFu) - current.z;
+		break;
+	case VK_BLEND_FACTOR_DST_COLOR:
+		blendFactor.x = pixel.x;
+		blendFactor.y = pixel.y;
+		blendFactor.z = pixel.z;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
+		blendFactor.x = Short4(0xFFFFu) - pixel.x;
+		blendFactor.y = Short4(0xFFFFu) - pixel.y;
+		blendFactor.z = Short4(0xFFFFu) - pixel.z;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA:
+		blendFactor.x = current.w;
+		blendFactor.y = current.w;
+		blendFactor.z = current.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
+		blendFactor.x = Short4(0xFFFFu) - current.w;
+		blendFactor.y = Short4(0xFFFFu) - current.w;
+		blendFactor.z = Short4(0xFFFFu) - current.w;
+		break;
+	case VK_BLEND_FACTOR_DST_ALPHA:
+		blendFactor.x = pixel.w;
+		blendFactor.y = pixel.w;
+		blendFactor.z = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
+		blendFactor.x = Short4(0xFFFFu) - pixel.w;
+		blendFactor.y = Short4(0xFFFFu) - pixel.w;
+		blendFactor.z = Short4(0xFFFFu) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
+		blendFactor.x = Short4(0xFFFFu) - pixel.w;
+		blendFactor.x = Min(As<UShort4>(blendFactor.x), As<UShort4>(current.w));
+		blendFactor.y = blendFactor.x;
+		blendFactor.z = blendFactor.x;
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_COLOR:
+		blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[0]));
+		blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[1]));
+		blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[2]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
+		blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[0]));
+		blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[1]));
+		blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[2]));
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_ALPHA:
+		blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
+		blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
+		blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
+		blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
+		blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
+		blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
+		break;
+	default:
+		UNSUPPORTED("VkBlendFactor: %d", int(blendFactorActive));
 	}
 }
 
@@ -999,49 +999,49 @@
 {
 	switch(blendFactorAlphaActive)
 	{
-		case VK_BLEND_FACTOR_ZERO:
-			// Optimized
-			break;
-		case VK_BLEND_FACTOR_ONE:
-			// Optimized
-			break;
-		case VK_BLEND_FACTOR_SRC_COLOR:
-			blendFactor.w = current.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
-			blendFactor.w = Short4(0xFFFFu) - current.w;
-			break;
-		case VK_BLEND_FACTOR_DST_COLOR:
-			blendFactor.w = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
-			blendFactor.w = Short4(0xFFFFu) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA:
-			blendFactor.w = current.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
-			blendFactor.w = Short4(0xFFFFu) - current.w;
-			break;
-		case VK_BLEND_FACTOR_DST_ALPHA:
-			blendFactor.w = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
-			blendFactor.w = Short4(0xFFFFu) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
-			blendFactor.w = Short4(0xFFFFu);
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_COLOR:
-		case VK_BLEND_FACTOR_CONSTANT_ALPHA:
-			blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
-			blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
-			break;
-		default:
-			UNSUPPORTED("VkBlendFactor: %d", int(blendFactorAlphaActive));
+	case VK_BLEND_FACTOR_ZERO:
+		// Optimized
+		break;
+	case VK_BLEND_FACTOR_ONE:
+		// Optimized
+		break;
+	case VK_BLEND_FACTOR_SRC_COLOR:
+		blendFactor.w = current.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
+		blendFactor.w = Short4(0xFFFFu) - current.w;
+		break;
+	case VK_BLEND_FACTOR_DST_COLOR:
+		blendFactor.w = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
+		blendFactor.w = Short4(0xFFFFu) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA:
+		blendFactor.w = current.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
+		blendFactor.w = Short4(0xFFFFu) - current.w;
+		break;
+	case VK_BLEND_FACTOR_DST_ALPHA:
+		blendFactor.w = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
+		blendFactor.w = Short4(0xFFFFu) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
+		blendFactor.w = Short4(0xFFFFu);
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_COLOR:
+	case VK_BLEND_FACTOR_CONSTANT_ALPHA:
+		blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData, factor.blendConstant4W[3]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
+		blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData, factor.invBlendConstant4W[3]));
+		break;
+	default:
+		UNSUPPORTED("VkBlendFactor: %d", int(blendFactorAlphaActive));
 	}
 }
 
@@ -1061,126 +1061,126 @@
 
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			buffer += 2 * x;
-			buffer2 = buffer + pitchB;
-			c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		buffer += 2 * x;
+		buffer2 = buffer + pitchB;
+		c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
 
-			pixel.x = (c01 & Short4(0x7C00u)) << 1;
-			pixel.y = (c01 & Short4(0x03E0u)) << 6;
-			pixel.z = (c01 & Short4(0x001Fu)) << 11;
-			pixel.w = (c01 & Short4(0x8000u)) >> 15;
+		pixel.x = (c01 & Short4(0x7C00u)) << 1;
+		pixel.y = (c01 & Short4(0x03E0u)) << 6;
+		pixel.z = (c01 & Short4(0x001Fu)) << 11;
+		pixel.w = (c01 & Short4(0x8000u)) >> 15;
 
-			// Expand to 16 bit range
-			pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 5);
-			pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 10);
-			pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 5);
-			pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 10);
-			pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 5);
-			pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 10);
-			break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			buffer += 2 * x;
-			buffer2 = buffer + pitchB;
-			c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
+		// Expand to 16 bit range
+		pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 5);
+		pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 10);
+		pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 5);
+		pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 10);
+		pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 5);
+		pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 10);
+		break;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		buffer += 2 * x;
+		buffer2 = buffer + pitchB;
+		c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
 
-			pixel.x = c01 & Short4(0xF800u);
-			pixel.y = (c01 & Short4(0x07E0u)) << 5;
-			pixel.z = (c01 & Short4(0x001Fu)) << 11;
-			pixel.w = Short4(0xFFFFu);
+		pixel.x = c01 & Short4(0xF800u);
+		pixel.y = (c01 & Short4(0x07E0u)) << 5;
+		pixel.z = (c01 & Short4(0x001Fu)) << 11;
+		pixel.w = Short4(0xFFFFu);
 
-			// Expand to 16 bit range
-			pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 5);
-			pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 10);
-			pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 6);
-			pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 12);
-			pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 5);
-			pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 10);
-			break;
-		case VK_FORMAT_B8G8R8A8_UNORM:
-		case VK_FORMAT_B8G8R8A8_SRGB:
-			buffer += 4 * x;
-			c01 = *Pointer<Short4>(buffer);
-			buffer += pitchB;
-			c23 = *Pointer<Short4>(buffer);
-			pixel.z = c01;
-			pixel.y = c01;
-			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
-			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
-			pixel.x = pixel.z;
-			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
-			pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
-			pixel.y = pixel.z;
-			pixel.w = pixel.x;
-			pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
-			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
-			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
-			pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
-			break;
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-			buffer += 4 * x;
-			c01 = *Pointer<Short4>(buffer);
-			buffer += pitchB;
-			c23 = *Pointer<Short4>(buffer);
-			pixel.z = c01;
-			pixel.y = c01;
-			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
-			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
-			pixel.x = pixel.z;
-			pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
-			pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
-			pixel.y = pixel.z;
-			pixel.w = pixel.x;
-			pixel.x = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
-			pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
-			pixel.z = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
-			pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
-			break;
-		case VK_FORMAT_R8_UNORM:
-			buffer += 1 * x;
-			pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 0);
-			buffer += pitchB;
-			pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 1);
-			pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
-			pixel.y = Short4(0x0000);
-			pixel.z = Short4(0x0000);
-			pixel.w = Short4(0xFFFFu);
-			break;
-		case VK_FORMAT_R8G8_UNORM:
-			buffer += 2 * x;
-			c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 0));
-			buffer += pitchB;
-			c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 1));
-			pixel.x = (c01 & Short4(0x00FFu)) | (c01 << 8);
-			pixel.y = (c01 & Short4(0xFF00u)) | As<Short4>(As<UShort4>(c01) >> 8);
-			pixel.z = Short4(0x0000u);
-			pixel.w = Short4(0xFFFFu);
-			break;
-		case VK_FORMAT_R16G16B16A16_UNORM:
-			buffer += 8 * x;
-			pixel.x = *Pointer<Short4>(buffer + 0);
-			pixel.y = *Pointer<Short4>(buffer + 8);
-			buffer += pitchB;
-			pixel.z = *Pointer<Short4>(buffer + 0);
-			pixel.w = *Pointer<Short4>(buffer + 8);
-			transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
-			break;
-		case VK_FORMAT_R16G16_UNORM:
-			buffer += 4 * x;
-			pixel.x = *Pointer<Short4>(buffer);
-			buffer += pitchB;
-			pixel.y = *Pointer<Short4>(buffer);
-			pixel.z = pixel.x;
-			pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.y));
-			pixel.z = As<Short4>(UnpackHigh(pixel.z, pixel.y));
-			pixel.y = pixel.z;
-			pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.z));
-			pixel.y = As<Short4>(UnpackHigh(pixel.y, pixel.z));
-			pixel.z = Short4(0xFFFFu);
-			pixel.w = Short4(0xFFFFu);
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+		// Expand to 16 bit range
+		pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 5);
+		pixel.x |= As<Short4>(As<UShort4>(pixel.x) >> 10);
+		pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 6);
+		pixel.y |= As<Short4>(As<UShort4>(pixel.y) >> 12);
+		pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 5);
+		pixel.z |= As<Short4>(As<UShort4>(pixel.z) >> 10);
+		break;
+	case VK_FORMAT_B8G8R8A8_UNORM:
+	case VK_FORMAT_B8G8R8A8_SRGB:
+		buffer += 4 * x;
+		c01 = *Pointer<Short4>(buffer);
+		buffer += pitchB;
+		c23 = *Pointer<Short4>(buffer);
+		pixel.z = c01;
+		pixel.y = c01;
+		pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
+		pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
+		pixel.x = pixel.z;
+		pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
+		pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
+		pixel.y = pixel.z;
+		pixel.w = pixel.x;
+		pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
+		pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
+		pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
+		pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
+		break;
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+		buffer += 4 * x;
+		c01 = *Pointer<Short4>(buffer);
+		buffer += pitchB;
+		c23 = *Pointer<Short4>(buffer);
+		pixel.z = c01;
+		pixel.y = c01;
+		pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
+		pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
+		pixel.x = pixel.z;
+		pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
+		pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
+		pixel.y = pixel.z;
+		pixel.w = pixel.x;
+		pixel.x = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
+		pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
+		pixel.z = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
+		pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
+		break;
+	case VK_FORMAT_R8_UNORM:
+		buffer += 1 * x;
+		pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 0);
+		buffer += pitchB;
+		pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 1);
+		pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
+		pixel.y = Short4(0x0000);
+		pixel.z = Short4(0x0000);
+		pixel.w = Short4(0xFFFFu);
+		break;
+	case VK_FORMAT_R8G8_UNORM:
+		buffer += 2 * x;
+		c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 0));
+		buffer += pitchB;
+		c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 1));
+		pixel.x = (c01 & Short4(0x00FFu)) | (c01 << 8);
+		pixel.y = (c01 & Short4(0xFF00u)) | As<Short4>(As<UShort4>(c01) >> 8);
+		pixel.z = Short4(0x0000u);
+		pixel.w = Short4(0xFFFFu);
+		break;
+	case VK_FORMAT_R16G16B16A16_UNORM:
+		buffer += 8 * x;
+		pixel.x = *Pointer<Short4>(buffer + 0);
+		pixel.y = *Pointer<Short4>(buffer + 8);
+		buffer += pitchB;
+		pixel.z = *Pointer<Short4>(buffer + 0);
+		pixel.w = *Pointer<Short4>(buffer + 8);
+		transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
+		break;
+	case VK_FORMAT_R16G16_UNORM:
+		buffer += 4 * x;
+		pixel.x = *Pointer<Short4>(buffer);
+		buffer += pitchB;
+		pixel.y = *Pointer<Short4>(buffer);
+		pixel.z = pixel.x;
+		pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.y));
+		pixel.z = As<Short4>(UnpackHigh(pixel.z, pixel.y));
+		pixel.y = pixel.z;
+		pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.z));
+		pixel.y = As<Short4>(UnpackHigh(pixel.y, pixel.z));
+		pixel.z = Short4(0xFFFFu);
+		pixel.w = Short4(0xFFFFu);
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
 		{
 			Int4 v = Int4(0);
 			buffer += 4 * x;
@@ -1193,7 +1193,7 @@
 			pixel = a2b10g10r10Unpack(v);
 		}
 		break;
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
 		{
 			Int4 v = Int4(0);
 			v = Insert(v, *Pointer<Int>(buffer + 4 * x), 0);
@@ -1205,8 +1205,8 @@
 			pixel = a2r10g10b10Unpack(v);
 		}
 		break;
-		default:
-			UNSUPPORTED("VkFormat %d", int(state.targetFormat[index]));
+	default:
+		UNSUPPORTED("VkFormat %d", int(state.targetFormat[index]));
 	}
 
 	if(isSRGB(index))
@@ -1250,46 +1250,46 @@
 
 	switch(state.blendState[index].blendOperation)
 	{
-		case VK_BLEND_OP_ADD:
-			current.x = AddSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
-			current.y = AddSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
-			current.z = AddSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
-			break;
-		case VK_BLEND_OP_SUBTRACT:
-			current.x = SubSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
-			current.y = SubSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
-			current.z = SubSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
-			break;
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			current.x = SubSat(As<UShort4>(pixel.x), As<UShort4>(current.x));
-			current.y = SubSat(As<UShort4>(pixel.y), As<UShort4>(current.y));
-			current.z = SubSat(As<UShort4>(pixel.z), As<UShort4>(current.z));
-			break;
-		case VK_BLEND_OP_MIN:
-			current.x = Min(As<UShort4>(current.x), As<UShort4>(pixel.x));
-			current.y = Min(As<UShort4>(current.y), As<UShort4>(pixel.y));
-			current.z = Min(As<UShort4>(current.z), As<UShort4>(pixel.z));
-			break;
-		case VK_BLEND_OP_MAX:
-			current.x = Max(As<UShort4>(current.x), As<UShort4>(pixel.x));
-			current.y = Max(As<UShort4>(current.y), As<UShort4>(pixel.y));
-			current.z = Max(As<UShort4>(current.z), As<UShort4>(pixel.z));
-			break;
-		case VK_BLEND_OP_SRC_EXT:
-			// No operation
-			break;
-		case VK_BLEND_OP_DST_EXT:
-			current.x = pixel.x;
-			current.y = pixel.y;
-			current.z = pixel.z;
-			break;
-		case VK_BLEND_OP_ZERO_EXT:
-			current.x = Short4(0x0000);
-			current.y = Short4(0x0000);
-			current.z = Short4(0x0000);
-			break;
-		default:
-			UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperation));
+	case VK_BLEND_OP_ADD:
+		current.x = AddSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
+		current.y = AddSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
+		current.z = AddSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
+		break;
+	case VK_BLEND_OP_SUBTRACT:
+		current.x = SubSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
+		current.y = SubSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
+		current.z = SubSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
+		break;
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		current.x = SubSat(As<UShort4>(pixel.x), As<UShort4>(current.x));
+		current.y = SubSat(As<UShort4>(pixel.y), As<UShort4>(current.y));
+		current.z = SubSat(As<UShort4>(pixel.z), As<UShort4>(current.z));
+		break;
+	case VK_BLEND_OP_MIN:
+		current.x = Min(As<UShort4>(current.x), As<UShort4>(pixel.x));
+		current.y = Min(As<UShort4>(current.y), As<UShort4>(pixel.y));
+		current.z = Min(As<UShort4>(current.z), As<UShort4>(pixel.z));
+		break;
+	case VK_BLEND_OP_MAX:
+		current.x = Max(As<UShort4>(current.x), As<UShort4>(pixel.x));
+		current.y = Max(As<UShort4>(current.y), As<UShort4>(pixel.y));
+		current.z = Max(As<UShort4>(current.z), As<UShort4>(pixel.z));
+		break;
+	case VK_BLEND_OP_SRC_EXT:
+		// No operation
+		break;
+	case VK_BLEND_OP_DST_EXT:
+		current.x = pixel.x;
+		current.y = pixel.y;
+		current.z = pixel.z;
+		break;
+	case VK_BLEND_OP_ZERO_EXT:
+		current.x = Short4(0x0000);
+		current.y = Short4(0x0000);
+		current.z = Short4(0x0000);
+		break;
+	default:
+		UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperation));
 	}
 
 	blendFactorAlpha(sourceFactor, current, pixel, state.blendState[index].sourceBlendFactorAlpha);
@@ -1307,32 +1307,32 @@
 
 	switch(state.blendState[index].blendOperationAlpha)
 	{
-		case VK_BLEND_OP_ADD:
-			current.w = AddSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
-			break;
-		case VK_BLEND_OP_SUBTRACT:
-			current.w = SubSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
-			break;
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			current.w = SubSat(As<UShort4>(pixel.w), As<UShort4>(current.w));
-			break;
-		case VK_BLEND_OP_MIN:
-			current.w = Min(As<UShort4>(current.w), As<UShort4>(pixel.w));
-			break;
-		case VK_BLEND_OP_MAX:
-			current.w = Max(As<UShort4>(current.w), As<UShort4>(pixel.w));
-			break;
-		case VK_BLEND_OP_SRC_EXT:
-			// No operation
-			break;
-		case VK_BLEND_OP_DST_EXT:
-			current.w = pixel.w;
-			break;
-		case VK_BLEND_OP_ZERO_EXT:
-			current.w = Short4(0x0000);
-			break;
-		default:
-			UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperationAlpha));
+	case VK_BLEND_OP_ADD:
+		current.w = AddSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
+		break;
+	case VK_BLEND_OP_SUBTRACT:
+		current.w = SubSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
+		break;
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		current.w = SubSat(As<UShort4>(pixel.w), As<UShort4>(current.w));
+		break;
+	case VK_BLEND_OP_MIN:
+		current.w = Min(As<UShort4>(current.w), As<UShort4>(pixel.w));
+		break;
+	case VK_BLEND_OP_MAX:
+		current.w = Max(As<UShort4>(current.w), As<UShort4>(pixel.w));
+		break;
+	case VK_BLEND_OP_SRC_EXT:
+		// No operation
+		break;
+	case VK_BLEND_OP_DST_EXT:
+		current.w = pixel.w;
+		break;
+	case VK_BLEND_OP_ZERO_EXT:
+		current.w = Short4(0x0000);
+		break;
+	default:
+		UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperationAlpha));
 	}
 }
 
@@ -1345,39 +1345,39 @@
 
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_B8G8R8A8_UNORM:
-		case VK_FORMAT_B8G8R8A8_SRGB:
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-		case VK_FORMAT_R8G8_UNORM:
-		case VK_FORMAT_R8_UNORM:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-			current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
-			current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
-			current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
-			current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-			current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 10) + Short4(0x0020);
-			current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 10) + Short4(0x0020);
-			current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 10) + Short4(0x0020);
-			current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 2) + Short4(0x2000);
-			break;
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
-			current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 5) + Short4(0x0400);
-			current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
-			current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 1) + Short4(0x4000);
-			break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
-			current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 6) + Short4(0x0200);
-			current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
-			break;
-		default:
-			break;
+	case VK_FORMAT_B8G8R8A8_UNORM:
+	case VK_FORMAT_B8G8R8A8_SRGB:
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+	case VK_FORMAT_R8G8_UNORM:
+	case VK_FORMAT_R8_UNORM:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+		current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
+		current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
+		current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
+		current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+		current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 10) + Short4(0x0020);
+		current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 10) + Short4(0x0020);
+		current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 10) + Short4(0x0020);
+		current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 2) + Short4(0x2000);
+		break;
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
+		current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 5) + Short4(0x0400);
+		current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
+		current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 1) + Short4(0x4000);
+		break;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 5) + Short4(0x0400);
+		current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 6) + Short4(0x0200);
+		current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 5) + Short4(0x0400);
+		break;
+	default:
+		break;
 	}
 
 	int rgbaWriteMask = state.colorWriteActive(index) & outputMasks[index];
@@ -1385,7 +1385,7 @@
 
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
 		{
 			current.w = current.w & Short4(0x8000u);
 			current.x = As<UShort4>(current.x & Short4(0xF800)) >> 1;
@@ -1395,7 +1395,7 @@
 			current.x = current.x | current.y | current.z | current.w;
 		}
 		break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
 		{
 			current.x = current.x & Short4(0xF800u);
 			current.y = As<UShort4>(current.y & Short4(0xFC00u)) >> 5;
@@ -1404,101 +1404,101 @@
 			current.x = current.x | current.y | current.z;
 		}
 		break;
-		case VK_FORMAT_B8G8R8A8_UNORM:
-		case VK_FORMAT_B8G8R8A8_SRGB:
-			if(rgbaWriteMask == 0x7)
-			{
-				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
-				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
-				current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-
-				current.z = As<Short4>(PackUnsigned(current.z, current.x));
-				current.y = As<Short4>(PackUnsigned(current.y, current.y));
-
-				current.x = current.z;
-				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
-				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
-				current.y = current.z;
-				current.z = As<Short4>(UnpackLow(current.z, current.x));
-				current.y = As<Short4>(UnpackHigh(current.y, current.x));
-			}
-			else
-			{
-				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
-				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
-				current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-				current.w = As<Short4>(As<UShort4>(current.w) >> 8);
-
-				current.z = As<Short4>(PackUnsigned(current.z, current.x));
-				current.y = As<Short4>(PackUnsigned(current.y, current.w));
-
-				current.x = current.z;
-				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
-				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
-				current.y = current.z;
-				current.z = As<Short4>(UnpackLow(current.z, current.x));
-				current.y = As<Short4>(UnpackHigh(current.y, current.x));
-			}
-			break;
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-			if(rgbaWriteMask == 0x7)
-			{
-				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
-				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
-				current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-
-				current.z = As<Short4>(PackUnsigned(current.x, current.z));
-				current.y = As<Short4>(PackUnsigned(current.y, current.y));
-
-				current.x = current.z;
-				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
-				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
-				current.y = current.z;
-				current.z = As<Short4>(UnpackLow(current.z, current.x));
-				current.y = As<Short4>(UnpackHigh(current.y, current.x));
-			}
-			else
-			{
-				current.x = As<Short4>(As<UShort4>(current.x) >> 8);
-				current.y = As<Short4>(As<UShort4>(current.y) >> 8);
-				current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-				current.w = As<Short4>(As<UShort4>(current.w) >> 8);
-
-				current.z = As<Short4>(PackUnsigned(current.x, current.z));
-				current.y = As<Short4>(PackUnsigned(current.y, current.w));
-
-				current.x = current.z;
-				current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
-				current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
-				current.y = current.z;
-				current.z = As<Short4>(UnpackLow(current.z, current.x));
-				current.y = As<Short4>(UnpackHigh(current.y, current.x));
-			}
-			break;
-		case VK_FORMAT_R8G8_UNORM:
+	case VK_FORMAT_B8G8R8A8_UNORM:
+	case VK_FORMAT_B8G8R8A8_SRGB:
+		if(rgbaWriteMask == 0x7)
+		{
 			current.x = As<Short4>(As<UShort4>(current.x) >> 8);
 			current.y = As<Short4>(As<UShort4>(current.y) >> 8);
-			current.x = As<Short4>(PackUnsigned(current.x, current.x));
+			current.z = As<Short4>(As<UShort4>(current.z) >> 8);
+
+			current.z = As<Short4>(PackUnsigned(current.z, current.x));
 			current.y = As<Short4>(PackUnsigned(current.y, current.y));
-			current.x = UnpackLow(As<Byte8>(current.x), As<Byte8>(current.y));
-			break;
-		case VK_FORMAT_R8_UNORM:
-			current.x = As<Short4>(As<UShort4>(current.x) >> 8);
-			current.x = As<Short4>(PackUnsigned(current.x, current.x));
-			break;
-		case VK_FORMAT_R16G16_UNORM:
-			current.z = current.x;
-			current.x = As<Short4>(UnpackLow(current.x, current.y));
-			current.z = As<Short4>(UnpackHigh(current.z, current.y));
+
+			current.x = current.z;
+			current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
+			current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
 			current.y = current.z;
-			break;
-		case VK_FORMAT_R16G16B16A16_UNORM:
-			transpose4x4(current.x, current.y, current.z, current.w);
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+			current.z = As<Short4>(UnpackLow(current.z, current.x));
+			current.y = As<Short4>(UnpackHigh(current.y, current.x));
+		}
+		else
+		{
+			current.x = As<Short4>(As<UShort4>(current.x) >> 8);
+			current.y = As<Short4>(As<UShort4>(current.y) >> 8);
+			current.z = As<Short4>(As<UShort4>(current.z) >> 8);
+			current.w = As<Short4>(As<UShort4>(current.w) >> 8);
+
+			current.z = As<Short4>(PackUnsigned(current.z, current.x));
+			current.y = As<Short4>(PackUnsigned(current.y, current.w));
+
+			current.x = current.z;
+			current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
+			current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
+			current.y = current.z;
+			current.z = As<Short4>(UnpackLow(current.z, current.x));
+			current.y = As<Short4>(UnpackHigh(current.y, current.x));
+		}
+		break;
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+		if(rgbaWriteMask == 0x7)
+		{
+			current.x = As<Short4>(As<UShort4>(current.x) >> 8);
+			current.y = As<Short4>(As<UShort4>(current.y) >> 8);
+			current.z = As<Short4>(As<UShort4>(current.z) >> 8);
+
+			current.z = As<Short4>(PackUnsigned(current.x, current.z));
+			current.y = As<Short4>(PackUnsigned(current.y, current.y));
+
+			current.x = current.z;
+			current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
+			current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
+			current.y = current.z;
+			current.z = As<Short4>(UnpackLow(current.z, current.x));
+			current.y = As<Short4>(UnpackHigh(current.y, current.x));
+		}
+		else
+		{
+			current.x = As<Short4>(As<UShort4>(current.x) >> 8);
+			current.y = As<Short4>(As<UShort4>(current.y) >> 8);
+			current.z = As<Short4>(As<UShort4>(current.z) >> 8);
+			current.w = As<Short4>(As<UShort4>(current.w) >> 8);
+
+			current.z = As<Short4>(PackUnsigned(current.x, current.z));
+			current.y = As<Short4>(PackUnsigned(current.y, current.w));
+
+			current.x = current.z;
+			current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
+			current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
+			current.y = current.z;
+			current.z = As<Short4>(UnpackLow(current.z, current.x));
+			current.y = As<Short4>(UnpackHigh(current.y, current.x));
+		}
+		break;
+	case VK_FORMAT_R8G8_UNORM:
+		current.x = As<Short4>(As<UShort4>(current.x) >> 8);
+		current.y = As<Short4>(As<UShort4>(current.y) >> 8);
+		current.x = As<Short4>(PackUnsigned(current.x, current.x));
+		current.y = As<Short4>(PackUnsigned(current.y, current.y));
+		current.x = UnpackLow(As<Byte8>(current.x), As<Byte8>(current.y));
+		break;
+	case VK_FORMAT_R8_UNORM:
+		current.x = As<Short4>(As<UShort4>(current.x) >> 8);
+		current.x = As<Short4>(PackUnsigned(current.x, current.x));
+		break;
+	case VK_FORMAT_R16G16_UNORM:
+		current.z = current.x;
+		current.x = As<Short4>(UnpackLow(current.x, current.y));
+		current.z = As<Short4>(UnpackHigh(current.z, current.y));
+		current.y = current.z;
+		break;
+	case VK_FORMAT_R16G16B16A16_UNORM:
+		transpose4x4(current.x, current.y, current.z, current.w);
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
 		{
 			auto r = (Int4(current.x) >> 6) & Int4(0x3ff);
 			auto g = (Int4(current.y) >> 6) & Int4(0x3ff);
@@ -1509,9 +1509,9 @@
 			auto c13 = As<Int2>(Int4(packed.ywww));  // TODO: auto c13 = packed.yw;
 			current.x = UnpackLow(c02, c13);
 			current.y = UnpackHigh(c02, c13);
-			break;
 		}
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+		break;
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
 		{
 			auto r = (Int4(current.x) >> 6) & Int4(0x3ff);
 			auto g = (Int4(current.y) >> 6) & Int4(0x3ff);
@@ -1522,10 +1522,10 @@
 			auto c13 = As<Int2>(Int4(packed.ywww));  // TODO: auto c13 = packed.yw;
 			current.x = UnpackLow(c02, c13);
 			current.y = UnpackHigh(c02, c13);
-			break;
 		}
-		default:
-			UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
+		break;
+	default:
+		UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
 	}
 
 	Short4 c01 = current.z;
@@ -1552,7 +1552,7 @@
 
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
 		{
 			buffer += 2 * x;
 			Int value = *Pointer<Int>(buffer);
@@ -1579,7 +1579,7 @@
 			*Pointer<Int>(buffer) = (c23 & mask23) | (value & ~mask23);
 		}
 		break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
 		{
 			buffer += 2 * x;
 			Int value = *Pointer<Int>(buffer);
@@ -1606,8 +1606,8 @@
 			*Pointer<Int>(buffer) = (c23 & mask23) | (value & ~mask23);
 		}
 		break;
-		case VK_FORMAT_B8G8R8A8_UNORM:
-		case VK_FORMAT_B8G8R8A8_SRGB:
+	case VK_FORMAT_B8G8R8A8_UNORM:
+	case VK_FORMAT_B8G8R8A8_SRGB:
 		{
 			buffer += x * 4;
 			Short4 value = *Pointer<Short4>(buffer);
@@ -1631,10 +1631,10 @@
 			*Pointer<Short4>(buffer) = (c23 & mask23) | (value & ~mask23);
 		}
 		break;
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_R8G8B8A8_SRGB:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_R8G8B8A8_SRGB:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
 		{
 			buffer += x * 4;
 			Short4 value = *Pointer<Short4>(buffer);
@@ -1658,47 +1658,47 @@
 			*Pointer<Short4>(buffer) = (c23 & mask23) | (value & ~mask23);
 		}
 		break;
-		case VK_FORMAT_R8G8_UNORM:
-			if((rgbaWriteMask & 0x00000003) != 0x0)
+	case VK_FORMAT_R8G8_UNORM:
+		if((rgbaWriteMask & 0x00000003) != 0x0)
+		{
+			buffer += 2 * x;
+			Int2 value;
+			value = Insert(value, *Pointer<Int>(buffer), 0);
+			value = Insert(value, *Pointer<Int>(buffer + pitchB), 1);
+
+			Int2 packedCol = As<Int2>(current.x);
+
+			UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
 			{
-				buffer += 2 * x;
-				Int2 value;
-				value = Insert(value, *Pointer<Int>(buffer), 0);
-				value = Insert(value, *Pointer<Int>(buffer + pitchB), 1);
-
-				Int2 packedCol = As<Int2>(current.x);
-
-				UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
-					UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
-					mergedMask &= rgbaMask;
-				}
-
-				packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask));
-
-				*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
-				*Pointer<UInt>(buffer + pitchB) = As<UInt>(Extract(packedCol, 1));
+				Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
+				UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
+				mergedMask &= rgbaMask;
 			}
-			break;
-		case VK_FORMAT_R8_UNORM:
-			if(rgbaWriteMask & 0x00000001)
-			{
-				buffer += 1 * x;
-				Short4 value;
-				value = Insert(value, *Pointer<Short>(buffer), 0);
-				value = Insert(value, *Pointer<Short>(buffer + pitchB), 1);
 
-				current.x &= *Pointer<Short4>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask);
-				value &= *Pointer<Short4>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask);
-				current.x |= value;
+			packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask));
 
-				*Pointer<Short>(buffer) = Extract(current.x, 0);
-				*Pointer<Short>(buffer + pitchB) = Extract(current.x, 1);
-			}
-			break;
-		case VK_FORMAT_R16G16_UNORM:
+			*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
+			*Pointer<UInt>(buffer + pitchB) = As<UInt>(Extract(packedCol, 1));
+		}
+		break;
+	case VK_FORMAT_R8_UNORM:
+		if(rgbaWriteMask & 0x00000001)
+		{
+			buffer += 1 * x;
+			Short4 value;
+			value = Insert(value, *Pointer<Short>(buffer), 0);
+			value = Insert(value, *Pointer<Short>(buffer + pitchB), 1);
+
+			current.x &= *Pointer<Short4>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask);
+			value &= *Pointer<Short4>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask);
+			current.x |= value;
+
+			*Pointer<Short>(buffer) = Extract(current.x, 0);
+			*Pointer<Short>(buffer + pitchB) = Extract(current.x, 1);
+		}
+		break;
+	case VK_FORMAT_R16G16_UNORM:
 		{
 			buffer += 4 * x;
 
@@ -1735,7 +1735,7 @@
 			*Pointer<Short4>(buffer) = current.y;
 		}
 		break;
-		case VK_FORMAT_R16G16B16A16_UNORM:
+	case VK_FORMAT_R16G16B16A16_UNORM:
 		{
 			buffer += 8 * x;
 
@@ -1810,10 +1810,10 @@
 			}
 		}
 		break;
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-			rgbaWriteMask = bgraWriteMask;
-			// [[fallthrough]]
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+		rgbaWriteMask = bgraWriteMask;
+		// [[fallthrough]]
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
 		{
 			buffer += 4 * x;
 
@@ -1836,8 +1836,8 @@
 			*Pointer<Int2>(buffer) = (As<Int2>(current.y) & mergedMask) | (value & ~mergedMask);
 		}
 		break;
-		default:
-			UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
+	default:
+		UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
 	}
 }
 
@@ -1845,85 +1845,85 @@
 {
 	switch(blendFactorActive)
 	{
-		case VK_BLEND_FACTOR_ZERO:
-			blendFactor.x = Float4(0);
-			blendFactor.y = Float4(0);
-			blendFactor.z = Float4(0);
-			break;
-		case VK_BLEND_FACTOR_ONE:
-			blendFactor.x = Float4(1);
-			blendFactor.y = Float4(1);
-			blendFactor.z = Float4(1);
-			break;
-		case VK_BLEND_FACTOR_SRC_COLOR:
-			blendFactor.x = oC.x;
-			blendFactor.y = oC.y;
-			blendFactor.z = oC.z;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
-			blendFactor.x = Float4(1.0f) - oC.x;
-			blendFactor.y = Float4(1.0f) - oC.y;
-			blendFactor.z = Float4(1.0f) - oC.z;
-			break;
-		case VK_BLEND_FACTOR_DST_COLOR:
-			blendFactor.x = pixel.x;
-			blendFactor.y = pixel.y;
-			blendFactor.z = pixel.z;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
-			blendFactor.x = Float4(1.0f) - pixel.x;
-			blendFactor.y = Float4(1.0f) - pixel.y;
-			blendFactor.z = Float4(1.0f) - pixel.z;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA:
-			blendFactor.x = oC.w;
-			blendFactor.y = oC.w;
-			blendFactor.z = oC.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
-			blendFactor.x = Float4(1.0f) - oC.w;
-			blendFactor.y = Float4(1.0f) - oC.w;
-			blendFactor.z = Float4(1.0f) - oC.w;
-			break;
-		case VK_BLEND_FACTOR_DST_ALPHA:
-			blendFactor.x = pixel.w;
-			blendFactor.y = pixel.w;
-			blendFactor.z = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
-			blendFactor.x = Float4(1.0f) - pixel.w;
-			blendFactor.y = Float4(1.0f) - pixel.w;
-			blendFactor.z = Float4(1.0f) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
-			blendFactor.x = Float4(1.0f) - pixel.w;
-			blendFactor.x = Min(blendFactor.x, oC.w);
-			blendFactor.y = blendFactor.x;
-			blendFactor.z = blendFactor.x;
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_COLOR:
-			blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[0]));
-			blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[1]));
-			blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[2]));
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_ALPHA:
-			blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
-			blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
-			blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
-			blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[0]));
-			blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[1]));
-			blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[2]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
-			blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
-			blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
-			blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
-			break;
+	case VK_BLEND_FACTOR_ZERO:
+		blendFactor.x = Float4(0);
+		blendFactor.y = Float4(0);
+		blendFactor.z = Float4(0);
+		break;
+	case VK_BLEND_FACTOR_ONE:
+		blendFactor.x = Float4(1);
+		blendFactor.y = Float4(1);
+		blendFactor.z = Float4(1);
+		break;
+	case VK_BLEND_FACTOR_SRC_COLOR:
+		blendFactor.x = oC.x;
+		blendFactor.y = oC.y;
+		blendFactor.z = oC.z;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
+		blendFactor.x = Float4(1.0f) - oC.x;
+		blendFactor.y = Float4(1.0f) - oC.y;
+		blendFactor.z = Float4(1.0f) - oC.z;
+		break;
+	case VK_BLEND_FACTOR_DST_COLOR:
+		blendFactor.x = pixel.x;
+		blendFactor.y = pixel.y;
+		blendFactor.z = pixel.z;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
+		blendFactor.x = Float4(1.0f) - pixel.x;
+		blendFactor.y = Float4(1.0f) - pixel.y;
+		blendFactor.z = Float4(1.0f) - pixel.z;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA:
+		blendFactor.x = oC.w;
+		blendFactor.y = oC.w;
+		blendFactor.z = oC.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
+		blendFactor.x = Float4(1.0f) - oC.w;
+		blendFactor.y = Float4(1.0f) - oC.w;
+		blendFactor.z = Float4(1.0f) - oC.w;
+		break;
+	case VK_BLEND_FACTOR_DST_ALPHA:
+		blendFactor.x = pixel.w;
+		blendFactor.y = pixel.w;
+		blendFactor.z = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
+		blendFactor.x = Float4(1.0f) - pixel.w;
+		blendFactor.y = Float4(1.0f) - pixel.w;
+		blendFactor.z = Float4(1.0f) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
+		blendFactor.x = Float4(1.0f) - pixel.w;
+		blendFactor.x = Min(blendFactor.x, oC.w);
+		blendFactor.y = blendFactor.x;
+		blendFactor.z = blendFactor.x;
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_COLOR:
+		blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[0]));
+		blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[1]));
+		blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[2]));
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_ALPHA:
+		blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
+		blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
+		blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
+		blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[0]));
+		blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[1]));
+		blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[2]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
+		blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
+		blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
+		blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
+		break;
 
-		default:
-			UNSUPPORTED("VkBlendFactor: %d", int(blendFactorActive));
+	default:
+		UNSUPPORTED("VkBlendFactor: %d", int(blendFactorActive));
 	}
 }
 
@@ -1931,49 +1931,49 @@
 {
 	switch(blendFactorAlphaActive)
 	{
-		case VK_BLEND_FACTOR_ZERO:
-			blendFactor.w = Float4(0);
-			break;
-		case VK_BLEND_FACTOR_ONE:
-			blendFactor.w = Float4(1);
-			break;
-		case VK_BLEND_FACTOR_SRC_COLOR:
-			blendFactor.w = oC.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
-			blendFactor.w = Float4(1.0f) - oC.w;
-			break;
-		case VK_BLEND_FACTOR_DST_COLOR:
-			blendFactor.w = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
-			blendFactor.w = Float4(1.0f) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA:
-			blendFactor.w = oC.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
-			blendFactor.w = Float4(1.0f) - oC.w;
-			break;
-		case VK_BLEND_FACTOR_DST_ALPHA:
-			blendFactor.w = pixel.w;
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
-			blendFactor.w = Float4(1.0f) - pixel.w;
-			break;
-		case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
-			blendFactor.w = Float4(1.0f);
-			break;
-		case VK_BLEND_FACTOR_CONSTANT_COLOR:
-		case VK_BLEND_FACTOR_CONSTANT_ALPHA:
-			blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
-			break;
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
-		case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
-			blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
-			break;
-		default:
-			UNSUPPORTED("VkBlendFactor: %d", int(blendFactorAlphaActive));
+	case VK_BLEND_FACTOR_ZERO:
+		blendFactor.w = Float4(0);
+		break;
+	case VK_BLEND_FACTOR_ONE:
+		blendFactor.w = Float4(1);
+		break;
+	case VK_BLEND_FACTOR_SRC_COLOR:
+		blendFactor.w = oC.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
+		blendFactor.w = Float4(1.0f) - oC.w;
+		break;
+	case VK_BLEND_FACTOR_DST_COLOR:
+		blendFactor.w = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
+		blendFactor.w = Float4(1.0f) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA:
+		blendFactor.w = oC.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
+		blendFactor.w = Float4(1.0f) - oC.w;
+		break;
+	case VK_BLEND_FACTOR_DST_ALPHA:
+		blendFactor.w = pixel.w;
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
+		blendFactor.w = Float4(1.0f) - pixel.w;
+		break;
+	case VK_BLEND_FACTOR_SRC_ALPHA_SATURATE:
+		blendFactor.w = Float4(1.0f);
+		break;
+	case VK_BLEND_FACTOR_CONSTANT_COLOR:
+	case VK_BLEND_FACTOR_CONSTANT_ALPHA:
+		blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData, factor.blendConstant4F[3]));
+		break;
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
+	case VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
+		blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData, factor.invBlendConstant4F[3]));
+		break;
+	default:
+		UNSUPPORTED("VkBlendFactor: %d", int(blendFactorAlphaActive));
 	}
 }
 
@@ -2012,97 +2012,97 @@
 
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_R32_SINT:
-		case VK_FORMAT_R32_UINT:
-		case VK_FORMAT_R32_SFLOAT:
-			// FIXME: movlps
-			buffer += 4 * x;
-			pixel.x.x = *Pointer<Float>(buffer + 0);
-			pixel.x.y = *Pointer<Float>(buffer + 4);
-			buffer += pitchB;
-			// FIXME: movhps
-			pixel.x.z = *Pointer<Float>(buffer + 0);
-			pixel.x.w = *Pointer<Float>(buffer + 4);
-			pixel.y = pixel.z = pixel.w = one;
-			break;
-		case VK_FORMAT_R32G32_SINT:
-		case VK_FORMAT_R32G32_UINT:
-		case VK_FORMAT_R32G32_SFLOAT:
-			buffer += 8 * x;
-			pixel.x = *Pointer<Float4>(buffer, 16);
-			buffer += pitchB;
-			pixel.y = *Pointer<Float4>(buffer, 16);
-			pixel.z = pixel.x;
-			pixel.x = ShuffleLowHigh(pixel.x, pixel.y, 0x0202);
-			pixel.z = ShuffleLowHigh(pixel.z, pixel.y, 0x1313);
-			pixel.y = pixel.z;
-			pixel.z = pixel.w = one;
-			break;
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-		case VK_FORMAT_R32G32B32A32_SINT:
-		case VK_FORMAT_R32G32B32A32_UINT:
-			buffer += 16 * x;
-			pixel.x = *Pointer<Float4>(buffer + 0, 16);
-			pixel.y = *Pointer<Float4>(buffer + 16, 16);
-			buffer += pitchB;
-			pixel.z = *Pointer<Float4>(buffer + 0, 16);
-			pixel.w = *Pointer<Float4>(buffer + 16, 16);
-			transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
-			break;
-		case VK_FORMAT_R16_SFLOAT:
-			buffer += 2 * x;
-			pixel.x.x = Float(*Pointer<Half>(buffer + 0));
-			pixel.x.y = Float(*Pointer<Half>(buffer + 2));
-			buffer += pitchB;
-			pixel.x.z = Float(*Pointer<Half>(buffer + 0));
-			pixel.x.w = Float(*Pointer<Half>(buffer + 2));
-			pixel.y = pixel.z = pixel.w = one;
-			break;
-		case VK_FORMAT_R16G16_SFLOAT:
-			buffer += 4 * x;
-			pixel.x.x = Float(*Pointer<Half>(buffer + 0));
-			pixel.y.x = Float(*Pointer<Half>(buffer + 2));
-			pixel.x.y = Float(*Pointer<Half>(buffer + 4));
-			pixel.y.y = Float(*Pointer<Half>(buffer + 6));
-			buffer += pitchB;
-			pixel.x.z = Float(*Pointer<Half>(buffer + 0));
-			pixel.y.z = Float(*Pointer<Half>(buffer + 2));
-			pixel.x.w = Float(*Pointer<Half>(buffer + 4));
-			pixel.y.w = Float(*Pointer<Half>(buffer + 6));
-			pixel.z = pixel.w = one;
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-			buffer += 8 * x;
-			pixel.x.x = Float(*Pointer<Half>(buffer + 0x0));
-			pixel.y.x = Float(*Pointer<Half>(buffer + 0x2));
-			pixel.z.x = Float(*Pointer<Half>(buffer + 0x4));
-			pixel.w.x = Float(*Pointer<Half>(buffer + 0x6));
-			pixel.x.y = Float(*Pointer<Half>(buffer + 0x8));
-			pixel.y.y = Float(*Pointer<Half>(buffer + 0xa));
-			pixel.z.y = Float(*Pointer<Half>(buffer + 0xc));
-			pixel.w.y = Float(*Pointer<Half>(buffer + 0xe));
-			buffer += pitchB;
-			pixel.x.z = Float(*Pointer<Half>(buffer + 0x0));
-			pixel.y.z = Float(*Pointer<Half>(buffer + 0x2));
-			pixel.z.z = Float(*Pointer<Half>(buffer + 0x4));
-			pixel.w.z = Float(*Pointer<Half>(buffer + 0x6));
-			pixel.x.w = Float(*Pointer<Half>(buffer + 0x8));
-			pixel.y.w = Float(*Pointer<Half>(buffer + 0xa));
-			pixel.z.w = Float(*Pointer<Half>(buffer + 0xc));
-			pixel.w.w = Float(*Pointer<Half>(buffer + 0xe));
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			buffer += 4 * x;
-			pixel.x = r11g11b10Unpack(*Pointer<UInt>(buffer + 0));
-			pixel.y = r11g11b10Unpack(*Pointer<UInt>(buffer + 4));
-			buffer += pitchB;
-			pixel.z = r11g11b10Unpack(*Pointer<UInt>(buffer + 0));
-			pixel.w = r11g11b10Unpack(*Pointer<UInt>(buffer + 4));
-			transpose4x3(pixel.x, pixel.y, pixel.z, pixel.w);
-			pixel.w = one;
-			break;
-		default:
-			UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
+	case VK_FORMAT_R32_SINT:
+	case VK_FORMAT_R32_UINT:
+	case VK_FORMAT_R32_SFLOAT:
+		// FIXME: movlps
+		buffer += 4 * x;
+		pixel.x.x = *Pointer<Float>(buffer + 0);
+		pixel.x.y = *Pointer<Float>(buffer + 4);
+		buffer += pitchB;
+		// FIXME: movhps
+		pixel.x.z = *Pointer<Float>(buffer + 0);
+		pixel.x.w = *Pointer<Float>(buffer + 4);
+		pixel.y = pixel.z = pixel.w = one;
+		break;
+	case VK_FORMAT_R32G32_SINT:
+	case VK_FORMAT_R32G32_UINT:
+	case VK_FORMAT_R32G32_SFLOAT:
+		buffer += 8 * x;
+		pixel.x = *Pointer<Float4>(buffer, 16);
+		buffer += pitchB;
+		pixel.y = *Pointer<Float4>(buffer, 16);
+		pixel.z = pixel.x;
+		pixel.x = ShuffleLowHigh(pixel.x, pixel.y, 0x0202);
+		pixel.z = ShuffleLowHigh(pixel.z, pixel.y, 0x1313);
+		pixel.y = pixel.z;
+		pixel.z = pixel.w = one;
+		break;
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+	case VK_FORMAT_R32G32B32A32_SINT:
+	case VK_FORMAT_R32G32B32A32_UINT:
+		buffer += 16 * x;
+		pixel.x = *Pointer<Float4>(buffer + 0, 16);
+		pixel.y = *Pointer<Float4>(buffer + 16, 16);
+		buffer += pitchB;
+		pixel.z = *Pointer<Float4>(buffer + 0, 16);
+		pixel.w = *Pointer<Float4>(buffer + 16, 16);
+		transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
+		break;
+	case VK_FORMAT_R16_SFLOAT:
+		buffer += 2 * x;
+		pixel.x.x = Float(*Pointer<Half>(buffer + 0));
+		pixel.x.y = Float(*Pointer<Half>(buffer + 2));
+		buffer += pitchB;
+		pixel.x.z = Float(*Pointer<Half>(buffer + 0));
+		pixel.x.w = Float(*Pointer<Half>(buffer + 2));
+		pixel.y = pixel.z = pixel.w = one;
+		break;
+	case VK_FORMAT_R16G16_SFLOAT:
+		buffer += 4 * x;
+		pixel.x.x = Float(*Pointer<Half>(buffer + 0));
+		pixel.y.x = Float(*Pointer<Half>(buffer + 2));
+		pixel.x.y = Float(*Pointer<Half>(buffer + 4));
+		pixel.y.y = Float(*Pointer<Half>(buffer + 6));
+		buffer += pitchB;
+		pixel.x.z = Float(*Pointer<Half>(buffer + 0));
+		pixel.y.z = Float(*Pointer<Half>(buffer + 2));
+		pixel.x.w = Float(*Pointer<Half>(buffer + 4));
+		pixel.y.w = Float(*Pointer<Half>(buffer + 6));
+		pixel.z = pixel.w = one;
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+		buffer += 8 * x;
+		pixel.x.x = Float(*Pointer<Half>(buffer + 0x0));
+		pixel.y.x = Float(*Pointer<Half>(buffer + 0x2));
+		pixel.z.x = Float(*Pointer<Half>(buffer + 0x4));
+		pixel.w.x = Float(*Pointer<Half>(buffer + 0x6));
+		pixel.x.y = Float(*Pointer<Half>(buffer + 0x8));
+		pixel.y.y = Float(*Pointer<Half>(buffer + 0xa));
+		pixel.z.y = Float(*Pointer<Half>(buffer + 0xc));
+		pixel.w.y = Float(*Pointer<Half>(buffer + 0xe));
+		buffer += pitchB;
+		pixel.x.z = Float(*Pointer<Half>(buffer + 0x0));
+		pixel.y.z = Float(*Pointer<Half>(buffer + 0x2));
+		pixel.z.z = Float(*Pointer<Half>(buffer + 0x4));
+		pixel.w.z = Float(*Pointer<Half>(buffer + 0x6));
+		pixel.x.w = Float(*Pointer<Half>(buffer + 0x8));
+		pixel.y.w = Float(*Pointer<Half>(buffer + 0xa));
+		pixel.z.w = Float(*Pointer<Half>(buffer + 0xc));
+		pixel.w.w = Float(*Pointer<Half>(buffer + 0xe));
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		buffer += 4 * x;
+		pixel.x = r11g11b10Unpack(*Pointer<UInt>(buffer + 0));
+		pixel.y = r11g11b10Unpack(*Pointer<UInt>(buffer + 4));
+		buffer += pitchB;
+		pixel.z = r11g11b10Unpack(*Pointer<UInt>(buffer + 0));
+		pixel.w = r11g11b10Unpack(*Pointer<UInt>(buffer + 4));
+		transpose4x3(pixel.x, pixel.y, pixel.z, pixel.w);
+		pixel.w = one;
+		break;
+	default:
+		UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
 	}
 
 	// Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
@@ -2122,46 +2122,46 @@
 
 	switch(state.blendState[index].blendOperation)
 	{
-		case VK_BLEND_OP_ADD:
-			oC.x += pixel.x;
-			oC.y += pixel.y;
-			oC.z += pixel.z;
-			break;
-		case VK_BLEND_OP_SUBTRACT:
-			oC.x -= pixel.x;
-			oC.y -= pixel.y;
-			oC.z -= pixel.z;
-			break;
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			oC.x = pixel.x - oC.x;
-			oC.y = pixel.y - oC.y;
-			oC.z = pixel.z - oC.z;
-			break;
-		case VK_BLEND_OP_MIN:
-			oC.x = Min(oC.x, pixel.x);
-			oC.y = Min(oC.y, pixel.y);
-			oC.z = Min(oC.z, pixel.z);
-			break;
-		case VK_BLEND_OP_MAX:
-			oC.x = Max(oC.x, pixel.x);
-			oC.y = Max(oC.y, pixel.y);
-			oC.z = Max(oC.z, pixel.z);
-			break;
-		case VK_BLEND_OP_SRC_EXT:
-			// No operation
-			break;
-		case VK_BLEND_OP_DST_EXT:
-			oC.x = pixel.x;
-			oC.y = pixel.y;
-			oC.z = pixel.z;
-			break;
-		case VK_BLEND_OP_ZERO_EXT:
-			oC.x = Float4(0.0f);
-			oC.y = Float4(0.0f);
-			oC.z = Float4(0.0f);
-			break;
-		default:
-			UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperation));
+	case VK_BLEND_OP_ADD:
+		oC.x += pixel.x;
+		oC.y += pixel.y;
+		oC.z += pixel.z;
+		break;
+	case VK_BLEND_OP_SUBTRACT:
+		oC.x -= pixel.x;
+		oC.y -= pixel.y;
+		oC.z -= pixel.z;
+		break;
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		oC.x = pixel.x - oC.x;
+		oC.y = pixel.y - oC.y;
+		oC.z = pixel.z - oC.z;
+		break;
+	case VK_BLEND_OP_MIN:
+		oC.x = Min(oC.x, pixel.x);
+		oC.y = Min(oC.y, pixel.y);
+		oC.z = Min(oC.z, pixel.z);
+		break;
+	case VK_BLEND_OP_MAX:
+		oC.x = Max(oC.x, pixel.x);
+		oC.y = Max(oC.y, pixel.y);
+		oC.z = Max(oC.z, pixel.z);
+		break;
+	case VK_BLEND_OP_SRC_EXT:
+		// No operation
+		break;
+	case VK_BLEND_OP_DST_EXT:
+		oC.x = pixel.x;
+		oC.y = pixel.y;
+		oC.z = pixel.z;
+		break;
+	case VK_BLEND_OP_ZERO_EXT:
+		oC.x = Float4(0.0f);
+		oC.y = Float4(0.0f);
+		oC.z = Float4(0.0f);
+		break;
+	default:
+		UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperation));
 	}
 
 	blendFactorAlpha(sourceFactor, oC, pixel, state.blendState[index].sourceBlendFactorAlpha);
@@ -2172,33 +2172,33 @@
 
 	switch(state.blendState[index].blendOperationAlpha)
 	{
-		case VK_BLEND_OP_ADD:
-			oC.w += pixel.w;
-			break;
-		case VK_BLEND_OP_SUBTRACT:
-			oC.w -= pixel.w;
-			break;
-		case VK_BLEND_OP_REVERSE_SUBTRACT:
-			pixel.w -= oC.w;
-			oC.w = pixel.w;
-			break;
-		case VK_BLEND_OP_MIN:
-			oC.w = Min(oC.w, pixel.w);
-			break;
-		case VK_BLEND_OP_MAX:
-			oC.w = Max(oC.w, pixel.w);
-			break;
-		case VK_BLEND_OP_SRC_EXT:
-			// No operation
-			break;
-		case VK_BLEND_OP_DST_EXT:
-			oC.w = pixel.w;
-			break;
-		case VK_BLEND_OP_ZERO_EXT:
-			oC.w = Float4(0.0f);
-			break;
-		default:
-			UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperationAlpha));
+	case VK_BLEND_OP_ADD:
+		oC.w += pixel.w;
+		break;
+	case VK_BLEND_OP_SUBTRACT:
+		oC.w -= pixel.w;
+		break;
+	case VK_BLEND_OP_REVERSE_SUBTRACT:
+		pixel.w -= oC.w;
+		oC.w = pixel.w;
+		break;
+	case VK_BLEND_OP_MIN:
+		oC.w = Min(oC.w, pixel.w);
+		break;
+	case VK_BLEND_OP_MAX:
+		oC.w = Max(oC.w, pixel.w);
+		break;
+	case VK_BLEND_OP_SRC_EXT:
+		// No operation
+		break;
+	case VK_BLEND_OP_DST_EXT:
+		oC.w = pixel.w;
+		break;
+	case VK_BLEND_OP_ZERO_EXT:
+		oC.w = Float4(0.0f);
+		break;
+	default:
+		UNSUPPORTED("VkBlendOp: %d", int(state.blendState[index].blendOperationAlpha));
 	}
 
 	if(format.isUnsignedComponent(0)) { oC.x = Max(oC.x, Float4(0.0f)); }
@@ -2211,45 +2211,45 @@
 {
 	switch(state.targetFormat[index])
 	{
-		case VK_FORMAT_R16_SFLOAT:
-		case VK_FORMAT_R32_SFLOAT:
-		case VK_FORMAT_R32_SINT:
-		case VK_FORMAT_R32_UINT:
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16_UINT:
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			break;
-		case VK_FORMAT_R16G16_SFLOAT:
-		case VK_FORMAT_R32G32_SFLOAT:
-		case VK_FORMAT_R32G32_SINT:
-		case VK_FORMAT_R32G32_UINT:
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16G16_UINT:
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8G8_UINT:
-			oC.z = oC.x;
-			oC.x = UnpackLow(oC.x, oC.y);
-			oC.z = UnpackHigh(oC.z, oC.y);
-			oC.y = oC.z;
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-		case VK_FORMAT_R32G32B32A32_SINT:
-		case VK_FORMAT_R32G32B32A32_UINT:
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16A16_UINT:
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-			transpose4x4(oC.x, oC.y, oC.z, oC.w);
-			break;
-		default:
-			UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
+	case VK_FORMAT_R16_SFLOAT:
+	case VK_FORMAT_R32_SFLOAT:
+	case VK_FORMAT_R32_SINT:
+	case VK_FORMAT_R32_UINT:
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16_UINT:
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		break;
+	case VK_FORMAT_R16G16_SFLOAT:
+	case VK_FORMAT_R32G32_SFLOAT:
+	case VK_FORMAT_R32G32_SINT:
+	case VK_FORMAT_R32G32_UINT:
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16G16_UINT:
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8G8_UINT:
+		oC.z = oC.x;
+		oC.x = UnpackLow(oC.x, oC.y);
+		oC.z = UnpackHigh(oC.z, oC.y);
+		oC.y = oC.z;
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+	case VK_FORMAT_R32G32B32A32_SINT:
+	case VK_FORMAT_R32G32B32A32_UINT:
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16A16_UINT:
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+		transpose4x4(oC.x, oC.y, oC.z, oC.w);
+		break;
+	default:
+		UNSUPPORTED("VkFormat: %d", int(state.targetFormat[index]));
 	}
 
 	int rgbaWriteMask = state.colorWriteActive(index) & outputMasks[index];
@@ -2279,561 +2279,561 @@
 
 	switch(targetFormat)
 	{
-		case VK_FORMAT_R32_SFLOAT:
-		case VK_FORMAT_R32_SINT:
-		case VK_FORMAT_R32_UINT:
-			if(rgbaWriteMask & 0x00000001)
+	case VK_FORMAT_R32_SFLOAT:
+	case VK_FORMAT_R32_SINT:
+	case VK_FORMAT_R32_UINT:
+		if(rgbaWriteMask & 0x00000001)
+		{
+			buffer += 4 * x;
+
+			// FIXME: movlps
+			value.x = *Pointer<Float>(buffer + 0);
+			value.y = *Pointer<Float>(buffer + 4);
+
+			buffer += pitchB;
+
+			// FIXME: movhps
+			value.z = *Pointer<Float>(buffer + 0);
+			value.w = *Pointer<Float>(buffer + 4);
+
+			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
+			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
+
+			// FIXME: movhps
+			*Pointer<Float>(buffer + 0) = oC.x.z;
+			*Pointer<Float>(buffer + 4) = oC.x.w;
+
+			buffer -= pitchB;
+
+			// FIXME: movlps
+			*Pointer<Float>(buffer + 0) = oC.x.x;
+			*Pointer<Float>(buffer + 4) = oC.x.y;
+		}
+		break;
+	case VK_FORMAT_R16_SFLOAT:
+		if(rgbaWriteMask & 0x00000001)
+		{
+			buffer += 2 * x;
+
+			value = Insert(value, Float(*Pointer<Half>(buffer + 0)), 0);
+			value = Insert(value, Float(*Pointer<Half>(buffer + 2)), 1);
+
+			buffer += pitchB;
+
+			value = Insert(value, Float(*Pointer<Half>(buffer + 0)), 2);
+			value = Insert(value, Float(*Pointer<Half>(buffer + 2)), 3);
+
+			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
+			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
+
+			*Pointer<Half>(buffer + 0) = Half(oC.x.z);
+			*Pointer<Half>(buffer + 2) = Half(oC.x.w);
+
+			buffer -= pitchB;
+
+			*Pointer<Half>(buffer + 0) = Half(oC.x.x);
+			*Pointer<Half>(buffer + 2) = Half(oC.x.y);
+		}
+		break;
+	case VK_FORMAT_R16_SINT:
+	case VK_FORMAT_R16_UINT:
+		if(rgbaWriteMask & 0x00000001)
+		{
+			buffer += 2 * x;
+
+			UShort4 xyzw;
+			xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 0));
+
+			buffer += pitchB;
+
+			xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 1));
+			value = As<Float4>(Int4(xyzw));
+
+			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
+			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
+
+			if(targetFormat == VK_FORMAT_R16_SINT)
 			{
-				buffer += 4 * x;
-
-				// FIXME: movlps
-				value.x = *Pointer<Float>(buffer + 0);
-				value.y = *Pointer<Float>(buffer + 4);
-
-				buffer += pitchB;
-
-				// FIXME: movhps
-				value.z = *Pointer<Float>(buffer + 0);
-				value.w = *Pointer<Float>(buffer + 4);
-
-				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
-				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-
-				// FIXME: movhps
-				*Pointer<Float>(buffer + 0) = oC.x.z;
-				*Pointer<Float>(buffer + 4) = oC.x.w;
+				Float component = oC.x.z;
+				*Pointer<Short>(buffer + 0) = Short(As<Int>(component));
+				component = oC.x.w;
+				*Pointer<Short>(buffer + 2) = Short(As<Int>(component));
 
 				buffer -= pitchB;
 
-				// FIXME: movlps
-				*Pointer<Float>(buffer + 0) = oC.x.x;
-				*Pointer<Float>(buffer + 4) = oC.x.y;
+				component = oC.x.x;
+				*Pointer<Short>(buffer + 0) = Short(As<Int>(component));
+				component = oC.x.y;
+				*Pointer<Short>(buffer + 2) = Short(As<Int>(component));
 			}
-			break;
-		case VK_FORMAT_R16_SFLOAT:
-			if(rgbaWriteMask & 0x00000001)
+			else  // VK_FORMAT_R16_UINT
 			{
-				buffer += 2 * x;
-
-				value = Insert(value, Float(*Pointer<Half>(buffer + 0)), 0);
-				value = Insert(value, Float(*Pointer<Half>(buffer + 2)), 1);
-
-				buffer += pitchB;
-
-				value = Insert(value, Float(*Pointer<Half>(buffer + 0)), 2);
-				value = Insert(value, Float(*Pointer<Half>(buffer + 2)), 3);
-
-				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
-				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-
-				*Pointer<Half>(buffer + 0) = Half(oC.x.z);
-				*Pointer<Half>(buffer + 2) = Half(oC.x.w);
+				Float component = oC.x.z;
+				*Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
+				component = oC.x.w;
+				*Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
 
 				buffer -= pitchB;
 
-				*Pointer<Half>(buffer + 0) = Half(oC.x.x);
-				*Pointer<Half>(buffer + 2) = Half(oC.x.y);
+				component = oC.x.x;
+				*Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
+				component = oC.x.y;
+				*Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
 			}
-			break;
-		case VK_FORMAT_R16_SINT:
-		case VK_FORMAT_R16_UINT:
-			if(rgbaWriteMask & 0x00000001)
+		}
+		break;
+	case VK_FORMAT_R8_SINT:
+	case VK_FORMAT_R8_UINT:
+		if(rgbaWriteMask & 0x00000001)
+		{
+			buffer += x;
+
+			UInt xyzw, packedCol;
+
+			xyzw = UInt(*Pointer<UShort>(buffer)) & 0xFFFF;
+			buffer += pitchB;
+			xyzw |= UInt(*Pointer<UShort>(buffer)) << 16;
+
+			Short4 tmpCol = Short4(As<Int4>(oC.x));
+			if(targetFormat == VK_FORMAT_R8_SINT)
 			{
-				buffer += 2 * x;
-
-				UShort4 xyzw;
-				xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 0));
-
-				buffer += pitchB;
-
-				xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 1));
-				value = As<Float4>(Int4(xyzw));
-
-				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
-				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-
-				if(targetFormat == VK_FORMAT_R16_SINT)
-				{
-					Float component = oC.x.z;
-					*Pointer<Short>(buffer + 0) = Short(As<Int>(component));
-					component = oC.x.w;
-					*Pointer<Short>(buffer + 2) = Short(As<Int>(component));
-
-					buffer -= pitchB;
-
-					component = oC.x.x;
-					*Pointer<Short>(buffer + 0) = Short(As<Int>(component));
-					component = oC.x.y;
-					*Pointer<Short>(buffer + 2) = Short(As<Int>(component));
-				}
-				else  // VK_FORMAT_R16_UINT
-				{
-					Float component = oC.x.z;
-					*Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
-					component = oC.x.w;
-					*Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
-
-					buffer -= pitchB;
-
-					component = oC.x.x;
-					*Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
-					component = oC.x.y;
-					*Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
-				}
+				tmpCol = As<Short4>(PackSigned(tmpCol, tmpCol));
 			}
-			break;
-		case VK_FORMAT_R8_SINT:
-		case VK_FORMAT_R8_UINT:
-			if(rgbaWriteMask & 0x00000001)
+			else
 			{
-				buffer += x;
-
-				UInt xyzw, packedCol;
-
-				xyzw = UInt(*Pointer<UShort>(buffer)) & 0xFFFF;
-				buffer += pitchB;
-				xyzw |= UInt(*Pointer<UShort>(buffer)) << 16;
-
-				Short4 tmpCol = Short4(As<Int4>(oC.x));
-				if(targetFormat == VK_FORMAT_R8_SINT)
-				{
-					tmpCol = As<Short4>(PackSigned(tmpCol, tmpCol));
-				}
-				else
-				{
-					tmpCol = As<Short4>(PackUnsigned(tmpCol, tmpCol));
-				}
-				packedCol = Extract(As<Int2>(tmpCol), 0);
-
-				packedCol = (packedCol & *Pointer<UInt>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask)) |
-				            (xyzw & *Pointer<UInt>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask));
-
-				*Pointer<UShort>(buffer) = UShort(packedCol >> 16);
-				buffer -= pitchB;
-				*Pointer<UShort>(buffer) = UShort(packedCol);
+				tmpCol = As<Short4>(PackUnsigned(tmpCol, tmpCol));
 			}
-			break;
-		case VK_FORMAT_R32G32_SFLOAT:
-		case VK_FORMAT_R32G32_SINT:
-		case VK_FORMAT_R32G32_UINT:
-			buffer += 8 * x;
+			packedCol = Extract(As<Int2>(tmpCol), 0);
 
-			value = *Pointer<Float4>(buffer);
+			packedCol = (packedCol & *Pointer<UInt>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask)) |
+			            (xyzw & *Pointer<UInt>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask));
 
-			if((rgbaWriteMask & 0x00000003) != 0x00000003)
+			*Pointer<UShort>(buffer) = UShort(packedCol >> 16);
+			buffer -= pitchB;
+			*Pointer<UShort>(buffer) = UShort(packedCol);
+		}
+		break;
+	case VK_FORMAT_R32G32_SFLOAT:
+	case VK_FORMAT_R32G32_SINT:
+	case VK_FORMAT_R32G32_UINT:
+		buffer += 8 * x;
+
+		value = *Pointer<Float4>(buffer);
+
+		if((rgbaWriteMask & 0x00000003) != 0x00000003)
+		{
+			Float4 masked = value;
+			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[rgbaWriteMask & 0x3][0])));
+			masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[~rgbaWriteMask & 0x3][0])));
+			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
+		}
+
+		oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16, 16));
+		value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskQ01X) + xMask * 16, 16));
+		oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
+		*Pointer<Float4>(buffer) = oC.x;
+
+		buffer += pitchB;
+
+		value = *Pointer<Float4>(buffer);
+
+		if((rgbaWriteMask & 0x00000003) != 0x00000003)
+		{
+			Float4 masked;
+
+			masked = value;
+			oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[rgbaWriteMask & 0x3][0])));
+			masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[~rgbaWriteMask & 0x3][0])));
+			oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
+		}
+
+		oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16, 16));
+		value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskQ23X) + xMask * 16, 16));
+		oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
+		*Pointer<Float4>(buffer) = oC.y;
+		break;
+	case VK_FORMAT_R16G16_SFLOAT:
+		if((rgbaWriteMask & 0x00000003) != 0x0)
+		{
+			buffer += 4 * x;
+
+			UInt2 rgbaMask;
+			UInt2 packedCol;
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.y))) << 16) | UInt(As<UShort>(Half(oC.x.x))), 0);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.w))) << 16) | UInt(As<UShort>(Half(oC.x.z))), 1);
+
+			UShort4 value = *Pointer<UShort4>(buffer);
+			UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
+			{
+				Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask & 0x3][0]));
+				rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
+				mergedMask &= rgbaMask;
+			}
+			*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (As<UInt2>(value) & ~mergedMask);
+
+			buffer += pitchB;
+
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.y))) << 16) | UInt(As<UShort>(Half(oC.y.x))), 0);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.w))) << 16) | UInt(As<UShort>(Half(oC.y.z))), 1);
+			value = *Pointer<UShort4>(buffer);
+			mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
+			{
+				mergedMask &= rgbaMask;
+			}
+			*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (As<UInt2>(value) & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_R16G16_SINT:
+	case VK_FORMAT_R16G16_UINT:
+		if((rgbaWriteMask & 0x00000003) != 0x0)
+		{
+			buffer += 4 * x;
+
+			UInt2 rgbaMask;
+			UShort4 packedCol = UShort4(As<Int4>(oC.x));
+			UShort4 value = *Pointer<UShort4>(buffer);
+			UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
+			{
+				Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask & 0x3][0]));
+				rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
+				mergedMask &= rgbaMask;
+			}
+			*Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
+
+			buffer += pitchB;
+
+			packedCol = UShort4(As<Int4>(oC.y));
+			value = *Pointer<UShort4>(buffer);
+			mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
+			{
+				mergedMask &= rgbaMask;
+			}
+			*Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_R8G8_SINT:
+	case VK_FORMAT_R8G8_UINT:
+		if((rgbaWriteMask & 0x00000003) != 0x0)
+		{
+			buffer += 2 * x;
+
+			Int2 xyzw, packedCol;
+
+			xyzw = Insert(xyzw, *Pointer<Int>(buffer), 0);
+			buffer += pitchB;
+			xyzw = Insert(xyzw, *Pointer<Int>(buffer), 1);
+
+			if(targetFormat == VK_FORMAT_R8G8_SINT)
+			{
+				packedCol = As<Int2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
+			}
+			else
+			{
+				packedCol = As<Int2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
+			}
+
+			UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
+			if((rgbaWriteMask & 0x3) != 0x3)
+			{
+				Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
+				UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
+				mergedMask &= rgbaMask;
+			}
+
+			packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(xyzw) & ~mergedMask));
+
+			*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 1));
+			buffer -= pitchB;
+			*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
+		}
+		break;
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+	case VK_FORMAT_R32G32B32A32_SINT:
+	case VK_FORMAT_R32G32B32A32_UINT:
+		buffer += 16 * x;
+
+		{
+			value = *Pointer<Float4>(buffer, 16);
+
+			if(rgbaWriteMask != 0x0000000F)
 			{
 				Float4 masked = value;
-				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[rgbaWriteMask & 0x3][0])));
-				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[~rgbaWriteMask & 0x3][0])));
+				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
+				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
 				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
 			}
 
-			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16, 16));
-			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskQ01X) + xMask * 16, 16));
+			oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskX0X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX0X) + xMask * 16, 16));
 			oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-			*Pointer<Float4>(buffer) = oC.x;
+			*Pointer<Float4>(buffer, 16) = oC.x;
+		}
 
-			buffer += pitchB;
+		{
+			value = *Pointer<Float4>(buffer + 16, 16);
 
-			value = *Pointer<Float4>(buffer);
-
-			if((rgbaWriteMask & 0x00000003) != 0x00000003)
+			if(rgbaWriteMask != 0x0000000F)
 			{
-				Float4 masked;
-
-				masked = value;
-				oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[rgbaWriteMask & 0x3][0])));
-				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, maskD01X[~rgbaWriteMask & 0x3][0])));
+				Float4 masked = value;
+				oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
+				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
 				oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
 			}
 
-			oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16, 16));
-			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskQ23X) + xMask * 16, 16));
+			oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskX1X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX1X) + xMask * 16, 16));
 			oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
-			*Pointer<Float4>(buffer) = oC.y;
-			break;
-		case VK_FORMAT_R16G16_SFLOAT:
-			if((rgbaWriteMask & 0x00000003) != 0x0)
+			*Pointer<Float4>(buffer + 16, 16) = oC.y;
+		}
+
+		buffer += pitchB;
+
+		{
+			value = *Pointer<Float4>(buffer, 16);
+
+			if(rgbaWriteMask != 0x0000000F)
 			{
-				buffer += 4 * x;
-
-				UInt2 rgbaMask;
-				UInt2 packedCol;
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.y))) << 16) | UInt(As<UShort>(Half(oC.x.x))), 0);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.w))) << 16) | UInt(As<UShort>(Half(oC.x.z))), 1);
-
-				UShort4 value = *Pointer<UShort4>(buffer);
-				UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask & 0x3][0]));
-					rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (As<UInt2>(value) & ~mergedMask);
-
-				buffer += pitchB;
-
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.y))) << 16) | UInt(As<UShort>(Half(oC.y.x))), 0);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.w))) << 16) | UInt(As<UShort>(Half(oC.y.z))), 1);
-				value = *Pointer<UShort4>(buffer);
-				mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (As<UInt2>(value) & ~mergedMask);
-			}
-			break;
-		case VK_FORMAT_R16G16_SINT:
-		case VK_FORMAT_R16G16_UINT:
-			if((rgbaWriteMask & 0x00000003) != 0x0)
-			{
-				buffer += 4 * x;
-
-				UInt2 rgbaMask;
-				UShort4 packedCol = UShort4(As<Int4>(oC.x));
-				UShort4 value = *Pointer<UShort4>(buffer);
-				UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask & 0x3][0]));
-					rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
-
-				buffer += pitchB;
-
-				packedCol = UShort4(As<Int4>(oC.y));
-				value = *Pointer<UShort4>(buffer);
-				mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
-			}
-			break;
-		case VK_FORMAT_R8G8_SINT:
-		case VK_FORMAT_R8G8_UINT:
-			if((rgbaWriteMask & 0x00000003) != 0x0)
-			{
-				buffer += 2 * x;
-
-				Int2 xyzw, packedCol;
-
-				xyzw = Insert(xyzw, *Pointer<Int>(buffer), 0);
-				buffer += pitchB;
-				xyzw = Insert(xyzw, *Pointer<Int>(buffer), 1);
-
-				if(targetFormat == VK_FORMAT_R8G8_SINT)
-				{
-					packedCol = As<Int2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
-				}
-				else
-				{
-					packedCol = As<Int2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
-				}
-
-				UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
-				if((rgbaWriteMask & 0x3) != 0x3)
-				{
-					Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
-					UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
-					mergedMask &= rgbaMask;
-				}
-
-				packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(xyzw) & ~mergedMask));
-
-				*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 1));
-				buffer -= pitchB;
-				*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
-			}
-			break;
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-		case VK_FORMAT_R32G32B32A32_SINT:
-		case VK_FORMAT_R32G32B32A32_UINT:
-			buffer += 16 * x;
-
-			{
-				value = *Pointer<Float4>(buffer, 16);
-
-				if(rgbaWriteMask != 0x0000000F)
-				{
-					Float4 masked = value;
-					oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
-					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
-					oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
-				}
-
-				oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskX0X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX0X) + xMask * 16, 16));
-				oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-				*Pointer<Float4>(buffer, 16) = oC.x;
+				Float4 masked = value;
+				oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
+				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
+				oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(masked));
 			}
 
+			oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants, maskX2X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX2X) + xMask * 16, 16));
+			oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(value));
+			*Pointer<Float4>(buffer, 16) = oC.z;
+		}
+
+		{
+			value = *Pointer<Float4>(buffer + 16, 16);
+
+			if(rgbaWriteMask != 0x0000000F)
 			{
-				value = *Pointer<Float4>(buffer + 16, 16);
-
-				if(rgbaWriteMask != 0x0000000F)
-				{
-					Float4 masked = value;
-					oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
-					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
-					oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
-				}
-
-				oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants, maskX1X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX1X) + xMask * 16, 16));
-				oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
-				*Pointer<Float4>(buffer + 16, 16) = oC.y;
+				Float4 masked = value;
+				oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
+				masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
+				oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(masked));
 			}
 
+			oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants, maskX3X) + xMask * 16, 16));
+			value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX3X) + xMask * 16, 16));
+			oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(value));
+			*Pointer<Float4>(buffer + 16, 16) = oC.w;
+		}
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+		if((rgbaWriteMask & 0x0000000F) != 0x0)
+		{
+			buffer += 8 * x;
+
+			UInt4 rgbaMask;
+			UInt4 value = *Pointer<UInt4>(buffer);
+			UInt4 packedCol;
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.y))) << 16) | UInt(As<UShort>(Half(oC.x.x))), 0);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.w))) << 16) | UInt(As<UShort>(Half(oC.x.z))), 1);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.y))) << 16) | UInt(As<UShort>(Half(oC.y.x))), 2);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.w))) << 16) | UInt(As<UShort>(Half(oC.y.z))), 3);
+			UInt4 mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16);
+			if((rgbaWriteMask & 0xF) != 0xF)
+			{
+				UInt2 tmpMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask][0]));
+				rgbaMask = UInt4(tmpMask, tmpMask);
+				mergedMask &= rgbaMask;
+			}
+			*Pointer<UInt4>(buffer) = (packedCol & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+
 			buffer += pitchB;
 
+			value = *Pointer<UInt4>(buffer);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.z.y))) << 16) | UInt(As<UShort>(Half(oC.z.x))), 0);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.z.w))) << 16) | UInt(As<UShort>(Half(oC.z.z))), 1);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.w.y))) << 16) | UInt(As<UShort>(Half(oC.w.x))), 2);
+			packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.w.w))) << 16) | UInt(As<UShort>(Half(oC.w.z))), 3);
+			mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16);
+			if((rgbaWriteMask & 0xF) != 0xF)
 			{
-				value = *Pointer<Float4>(buffer, 16);
-
-				if(rgbaWriteMask != 0x0000000F)
-				{
-					Float4 masked = value;
-					oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
-					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
-					oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(masked));
-				}
-
-				oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants, maskX2X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX2X) + xMask * 16, 16));
-				oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(value));
-				*Pointer<Float4>(buffer, 16) = oC.z;
+				mergedMask &= rgbaMask;
 			}
+			*Pointer<UInt4>(buffer) = (packedCol & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		if((rgbaWriteMask & 0x7) != 0x0)
+		{
+			buffer += 4 * x;
 
+			UInt4 packedCol;
+			packedCol = Insert(packedCol, r11g11b10Pack(oC.x), 0);
+			packedCol = Insert(packedCol, r11g11b10Pack(oC.y), 1);
+			packedCol = Insert(packedCol, r11g11b10Pack(oC.z), 2);
+			packedCol = Insert(packedCol, r11g11b10Pack(oC.w), 3);
+
+			UInt4 value;
+			value = Insert(value, *Pointer<UInt>(buffer + 0), 0);
+			value = Insert(value, *Pointer<UInt>(buffer + 4), 1);
+			buffer += pitchB;
+			value = Insert(value, *Pointer<UInt>(buffer + 0), 2);
+			value = Insert(value, *Pointer<UInt>(buffer + 4), 3);
+
+			UInt4 mask = *Pointer<UInt4>(constants + OFFSET(Constants, maskD4X[0][0]) + xMask * 16, 16);
+			if((rgbaWriteMask & 0x7) != 0x7)
 			{
-				value = *Pointer<Float4>(buffer + 16, 16);
-
-				if(rgbaWriteMask != 0x0000000F)
-				{
-					Float4 masked = value;
-					oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X[rgbaWriteMask][0])));
-					masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X[rgbaWriteMask][0])));
-					oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(masked));
-				}
-
-				oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants, maskX3X) + xMask * 16, 16));
-				value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskX3X) + xMask * 16, 16));
-				oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(value));
-				*Pointer<Float4>(buffer + 16, 16) = oC.w;
+				mask &= *Pointer<UInt4>(constants + OFFSET(Constants, mask11X[rgbaWriteMask & 0x7][0]), 16);
 			}
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-			if((rgbaWriteMask & 0x0000000F) != 0x0)
+			value = (packedCol & mask) | (value & ~mask);
+
+			*Pointer<UInt>(buffer + 0) = value.z;
+			*Pointer<UInt>(buffer + 4) = value.w;
+			buffer -= pitchB;
+			*Pointer<UInt>(buffer + 0) = value.x;
+			*Pointer<UInt>(buffer + 4) = value.y;
+		}
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+	case VK_FORMAT_R16G16B16A16_UINT:
+		if((rgbaWriteMask & 0x0000000F) != 0x0)
+		{
+			buffer += 8 * x;
+
+			UInt4 rgbaMask;
+			UShort8 value = *Pointer<UShort8>(buffer);
+			UShort8 packedCol = UShort8(UShort4(As<Int4>(oC.x)), UShort4(As<Int4>(oC.y)));
+			UInt4 mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16);
+			if((rgbaWriteMask & 0xF) != 0xF)
 			{
-				buffer += 8 * x;
-
-				UInt4 rgbaMask;
-				UInt4 value = *Pointer<UInt4>(buffer);
-				UInt4 packedCol;
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.y))) << 16) | UInt(As<UShort>(Half(oC.x.x))), 0);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.x.w))) << 16) | UInt(As<UShort>(Half(oC.x.z))), 1);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.y))) << 16) | UInt(As<UShort>(Half(oC.y.x))), 2);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.y.w))) << 16) | UInt(As<UShort>(Half(oC.y.z))), 3);
-				UInt4 mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16);
-				if((rgbaWriteMask & 0xF) != 0xF)
-				{
-					UInt2 tmpMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask][0]));
-					rgbaMask = UInt4(tmpMask, tmpMask);
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt4>(buffer) = (packedCol & mergedMask) | (As<UInt4>(value) & ~mergedMask);
-
-				buffer += pitchB;
-
-				value = *Pointer<UInt4>(buffer);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.z.y))) << 16) | UInt(As<UShort>(Half(oC.z.x))), 0);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.z.w))) << 16) | UInt(As<UShort>(Half(oC.z.z))), 1);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.w.y))) << 16) | UInt(As<UShort>(Half(oC.w.x))), 2);
-				packedCol = Insert(packedCol, (UInt(As<UShort>(Half(oC.w.w))) << 16) | UInt(As<UShort>(Half(oC.w.z))), 3);
-				mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16);
-				if((rgbaWriteMask & 0xF) != 0xF)
-				{
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt4>(buffer) = (packedCol & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+				UInt2 tmpMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask][0]));
+				rgbaMask = UInt4(tmpMask, tmpMask);
+				mergedMask &= rgbaMask;
 			}
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			if((rgbaWriteMask & 0x7) != 0x0)
+			*Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+
+			buffer += pitchB;
+
+			value = *Pointer<UShort8>(buffer);
+			packedCol = UShort8(UShort4(As<Int4>(oC.z)), UShort4(As<Int4>(oC.w)));
+			mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16);
+			if((rgbaWriteMask & 0xF) != 0xF)
 			{
-				buffer += 4 * x;
-
-				UInt4 packedCol;
-				packedCol = Insert(packedCol, r11g11b10Pack(oC.x), 0);
-				packedCol = Insert(packedCol, r11g11b10Pack(oC.y), 1);
-				packedCol = Insert(packedCol, r11g11b10Pack(oC.z), 2);
-				packedCol = Insert(packedCol, r11g11b10Pack(oC.w), 3);
-
-				UInt4 value;
-				value = Insert(value, *Pointer<UInt>(buffer + 0), 0);
-				value = Insert(value, *Pointer<UInt>(buffer + 4), 1);
-				buffer += pitchB;
-				value = Insert(value, *Pointer<UInt>(buffer + 0), 2);
-				value = Insert(value, *Pointer<UInt>(buffer + 4), 3);
-
-				UInt4 mask = *Pointer<UInt4>(constants + OFFSET(Constants, maskD4X[0][0]) + xMask * 16, 16);
-				if((rgbaWriteMask & 0x7) != 0x7)
-				{
-					mask &= *Pointer<UInt4>(constants + OFFSET(Constants, mask11X[rgbaWriteMask & 0x7][0]), 16);
-				}
-				value = (packedCol & mask) | (value & ~mask);
-
-				*Pointer<UInt>(buffer + 0) = value.z;
-				*Pointer<UInt>(buffer + 4) = value.w;
-				buffer -= pitchB;
-				*Pointer<UInt>(buffer + 0) = value.x;
-				*Pointer<UInt>(buffer + 4) = value.y;
+				mergedMask &= rgbaMask;
 			}
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-		case VK_FORMAT_R16G16B16A16_UINT:
-			if((rgbaWriteMask & 0x0000000F) != 0x0)
+			*Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+		if((rgbaWriteMask & 0x0000000F) != 0x0)
+		{
+			UInt2 value, packedCol, mergedMask;
+
+			buffer += 4 * x;
+
+			bool isSigned = targetFormat == VK_FORMAT_R8G8B8A8_SINT || targetFormat == VK_FORMAT_A8B8G8R8_SINT_PACK32;
+
+			if(isSigned)
 			{
-				buffer += 8 * x;
-
-				UInt4 rgbaMask;
-				UShort8 value = *Pointer<UShort8>(buffer);
-				UShort8 packedCol = UShort8(UShort4(As<Int4>(oC.x)), UShort4(As<Int4>(oC.y)));
-				UInt4 mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16);
-				if((rgbaWriteMask & 0xF) != 0xF)
-				{
-					UInt2 tmpMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask][0]));
-					rgbaMask = UInt4(tmpMask, tmpMask);
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
-
-				buffer += pitchB;
-
-				value = *Pointer<UShort8>(buffer);
-				packedCol = UShort8(UShort4(As<Int4>(oC.z)), UShort4(As<Int4>(oC.w)));
-				mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16);
-				if((rgbaWriteMask & 0xF) != 0xF)
-				{
-					mergedMask &= rgbaMask;
-				}
-				*Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
+				packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
 			}
-			break;
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-			if((rgbaWriteMask & 0x0000000F) != 0x0)
+			else
 			{
-				UInt2 value, packedCol, mergedMask;
-
-				buffer += 4 * x;
-
-				bool isSigned = targetFormat == VK_FORMAT_R8G8B8A8_SINT || targetFormat == VK_FORMAT_A8B8G8R8_SINT_PACK32;
-
-				if(isSigned)
-				{
-					packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
-				}
-				else
-				{
-					packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
-				}
-				value = *Pointer<UInt2>(buffer, 16);
-				mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
-				if(rgbaWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
-				}
-				*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
-
-				buffer += pitchB;
-
-				if(isSigned)
-				{
-					packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
-				}
-				else
-				{
-					packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
-				}
-				value = *Pointer<UInt2>(buffer, 16);
-				mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
-				if(rgbaWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
-				}
-				*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
+				packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
 			}
-			break;
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			if((rgbaWriteMask & 0x0000000F) != 0x0)
+			value = *Pointer<UInt2>(buffer, 16);
+			mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
+			if(rgbaWriteMask != 0xF)
 			{
-				Int2 mergedMask, packedCol, value;
-				Int4 packed = ((As<Int4>(oC.w) & Int4(0x3)) << 30) |
-				              ((As<Int4>(oC.z) & Int4(0x3ff)) << 20) |
-				              ((As<Int4>(oC.y) & Int4(0x3ff)) << 10) |
-				              ((As<Int4>(oC.x) & Int4(0x3ff)));
-
-				buffer += 4 * x;
-				value = *Pointer<Int2>(buffer, 16);
-				mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
-				if(rgbaWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[rgbaWriteMask][0]));
-				}
-				*Pointer<Int2>(buffer) = (As<Int2>(packed) & mergedMask) | (value & ~mergedMask);
-
-				buffer += pitchB;
-
-				value = *Pointer<Int2>(buffer, 16);
-				mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
-				if(rgbaWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[rgbaWriteMask][0]));
-				}
-				*Pointer<Int2>(buffer) = (As<Int2>(Int4(packed.zwww)) & mergedMask) | (value & ~mergedMask);
+				mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
 			}
-			break;
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			if((bgraWriteMask & 0x0000000F) != 0x0)
+			*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
+
+			buffer += pitchB;
+
+			if(isSigned)
 			{
-				Int2 mergedMask, packedCol, value;
-				Int4 packed = ((As<Int4>(oC.w) & Int4(0x3)) << 30) |
-				              ((As<Int4>(oC.x) & Int4(0x3ff)) << 20) |
-				              ((As<Int4>(oC.y) & Int4(0x3ff)) << 10) |
-				              ((As<Int4>(oC.z) & Int4(0x3ff)));
-
-				buffer += 4 * x;
-				value = *Pointer<Int2>(buffer, 16);
-				mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
-				if(bgraWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[bgraWriteMask][0]));
-				}
-				*Pointer<Int2>(buffer) = (As<Int2>(packed) & mergedMask) | (value & ~mergedMask);
-
-				buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
-				value = *Pointer<Int2>(buffer, 16);
-				mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
-				if(bgraWriteMask != 0xF)
-				{
-					mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[bgraWriteMask][0]));
-				}
-				*Pointer<Int2>(buffer) = (As<Int2>(Int4(packed.zwww)) & mergedMask) | (value & ~mergedMask);
+				packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
 			}
-			break;
-		default:
-			UNSUPPORTED("VkFormat: %d", int(targetFormat));
+			else
+			{
+				packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
+			}
+			value = *Pointer<UInt2>(buffer, 16);
+			mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
+			if(rgbaWriteMask != 0xF)
+			{
+				mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
+			}
+			*Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		if((rgbaWriteMask & 0x0000000F) != 0x0)
+		{
+			Int2 mergedMask, packedCol, value;
+			Int4 packed = ((As<Int4>(oC.w) & Int4(0x3)) << 30) |
+			              ((As<Int4>(oC.z) & Int4(0x3ff)) << 20) |
+			              ((As<Int4>(oC.y) & Int4(0x3ff)) << 10) |
+			              ((As<Int4>(oC.x) & Int4(0x3ff)));
+
+			buffer += 4 * x;
+			value = *Pointer<Int2>(buffer, 16);
+			mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
+			if(rgbaWriteMask != 0xF)
+			{
+				mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[rgbaWriteMask][0]));
+			}
+			*Pointer<Int2>(buffer) = (As<Int2>(packed) & mergedMask) | (value & ~mergedMask);
+
+			buffer += pitchB;
+
+			value = *Pointer<Int2>(buffer, 16);
+			mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
+			if(rgbaWriteMask != 0xF)
+			{
+				mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[rgbaWriteMask][0]));
+			}
+			*Pointer<Int2>(buffer) = (As<Int2>(Int4(packed.zwww)) & mergedMask) | (value & ~mergedMask);
+		}
+		break;
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		if((bgraWriteMask & 0x0000000F) != 0x0)
+		{
+			Int2 mergedMask, packedCol, value;
+			Int4 packed = ((As<Int4>(oC.w) & Int4(0x3)) << 30) |
+			              ((As<Int4>(oC.x) & Int4(0x3ff)) << 20) |
+			              ((As<Int4>(oC.y) & Int4(0x3ff)) << 10) |
+			              ((As<Int4>(oC.z) & Int4(0x3ff)));
+
+			buffer += 4 * x;
+			value = *Pointer<Int2>(buffer, 16);
+			mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
+			if(bgraWriteMask != 0xF)
+			{
+				mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[bgraWriteMask][0]));
+			}
+			*Pointer<Int2>(buffer) = (As<Int2>(packed) & mergedMask) | (value & ~mergedMask);
+
+			buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
+
+			value = *Pointer<Int2>(buffer, 16);
+			mergedMask = *Pointer<Int2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
+			if(bgraWriteMask != 0xF)
+			{
+				mergedMask &= *Pointer<Int2>(constants + OFFSET(Constants, mask10Q[bgraWriteMask][0]));
+			}
+			*Pointer<Int2>(buffer) = (As<Int2>(Int4(packed.zwww)) & mergedMask) | (value & ~mergedMask);
+		}
+		break;
+	default:
+		UNSUPPORTED("VkFormat: %d", int(targetFormat));
 	}
 }
 
diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp
index 2a80211..646d875 100644
--- a/src/Pipeline/SamplerCore.cpp
+++ b/src/Pipeline/SamplerCore.cpp
@@ -36,10 +36,10 @@
 	Float4 a;  // Array layer coordinate
 	switch(state.textureType)
 	{
-		case VK_IMAGE_VIEW_TYPE_1D_ARRAY: a = uvwa[1]; break;
-		case VK_IMAGE_VIEW_TYPE_2D_ARRAY: a = uvwa[2]; break;
-		case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY: a = uvwa[3]; break;
-		default: break;
+	case VK_IMAGE_VIEW_TYPE_1D_ARRAY: a = uvwa[1]; break;
+	case VK_IMAGE_VIEW_TYPE_2D_ARRAY: a = uvwa[2]; break;
+	case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY: a = uvwa[3]; break;
+	default: break;
 	}
 
 	Float lod;
@@ -138,93 +138,31 @@
 		{
 			switch(state.textureFormat)
 			{
-				case VK_FORMAT_R5G6B5_UNORM_PACK16:
-					c.x *= Float4(1.0f / 0xF800);
-					c.y *= Float4(1.0f / 0xFC00);
-					c.z *= Float4(1.0f / 0xF800);
-					break;
-				case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
-					c.x *= Float4(1.0f / 0xF000);
-					c.y *= Float4(1.0f / 0xF000);
-					c.z *= Float4(1.0f / 0xF000);
-					c.w *= Float4(1.0f / 0xF000);
-					break;
-				case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-					c.x *= Float4(1.0f / 0xF800);
-					c.y *= Float4(1.0f / 0xF800);
-					c.z *= Float4(1.0f / 0xF800);
-					c.w *= Float4(1.0f / 0x8000);
-					break;
-				case VK_FORMAT_R8_SNORM:
-				case VK_FORMAT_R8G8_SNORM:
-				case VK_FORMAT_R8G8B8A8_SNORM:
-				case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-					c.x = Max(c.x * Float4(1.0f / 0x7F00), Float4(-1.0f));
-					c.y = Max(c.y * Float4(1.0f / 0x7F00), Float4(-1.0f));
-					c.z = Max(c.z * Float4(1.0f / 0x7F00), Float4(-1.0f));
-					c.w = Max(c.w * Float4(1.0f / 0x7F00), Float4(-1.0f));
-					break;
-				case VK_FORMAT_R8_UNORM:
-				case VK_FORMAT_R8G8_UNORM:
-				case VK_FORMAT_R8G8B8A8_UNORM:
-				case VK_FORMAT_B8G8R8A8_UNORM:
-				case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-				case VK_FORMAT_B8G8R8A8_SRGB:
-				case VK_FORMAT_R8G8B8A8_SRGB:
-				case VK_FORMAT_R8_SRGB:
-				case VK_FORMAT_R8G8_SRGB:
-					c.x *= Float4(1.0f / 0xFF00u);
-					c.y *= Float4(1.0f / 0xFF00u);
-					c.z *= Float4(1.0f / 0xFF00u);
-					c.w *= Float4(1.0f / 0xFF00u);
-					break;
-				case VK_FORMAT_R16_SNORM:
-				case VK_FORMAT_R16G16_SNORM:
-				case VK_FORMAT_R16G16B16A16_SNORM:
-					c.x = Max(c.x * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-					c.y = Max(c.y * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-					c.z = Max(c.z * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-					c.w = Max(c.w * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-					break;
-				default:
-					for(int component = 0; component < textureComponentCount(); component++)
-					{
-						c[component] *= Float4(hasUnsignedTextureComponent(component) ? 1.0f / 0xFFFF : 1.0f / 0x7FFF);
-					}
-			}
-		}
-	}
-	else  // 16-bit filtering.
-	{
-		Vector4s cs = sampleFilter(texture, u, v, w, a, offset, sample, lod, anisotropy, uDelta, vDelta, function);
-
-		switch(state.textureFormat)
-		{
 			case VK_FORMAT_R5G6B5_UNORM_PACK16:
-				c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF800);
-				c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xFC00);
-				c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF800);
+				c.x *= Float4(1.0f / 0xF800);
+				c.y *= Float4(1.0f / 0xFC00);
+				c.z *= Float4(1.0f / 0xF800);
 				break;
 			case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
-				c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF000);
-				c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xF000);
-				c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF000);
-				c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0xF000);
+				c.x *= Float4(1.0f / 0xF000);
+				c.y *= Float4(1.0f / 0xF000);
+				c.z *= Float4(1.0f / 0xF000);
+				c.w *= Float4(1.0f / 0xF000);
 				break;
 			case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-				c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF800);
-				c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xF800);
-				c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF800);
-				c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0x8000);
+				c.x *= Float4(1.0f / 0xF800);
+				c.y *= Float4(1.0f / 0xF800);
+				c.z *= Float4(1.0f / 0xF800);
+				c.w *= Float4(1.0f / 0x8000);
 				break;
 			case VK_FORMAT_R8_SNORM:
 			case VK_FORMAT_R8G8_SNORM:
 			case VK_FORMAT_R8G8B8A8_SNORM:
 			case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-				c.x = Max(Float4(cs.x) * Float4(1.0f / 0x7F00), Float4(-1.0f));
-				c.y = Max(Float4(cs.y) * Float4(1.0f / 0x7F00), Float4(-1.0f));
-				c.z = Max(Float4(cs.z) * Float4(1.0f / 0x7F00), Float4(-1.0f));
-				c.w = Max(Float4(cs.w) * Float4(1.0f / 0x7F00), Float4(-1.0f));
+				c.x = Max(c.x * Float4(1.0f / 0x7F00), Float4(-1.0f));
+				c.y = Max(c.y * Float4(1.0f / 0x7F00), Float4(-1.0f));
+				c.z = Max(c.z * Float4(1.0f / 0x7F00), Float4(-1.0f));
+				c.w = Max(c.w * Float4(1.0f / 0x7F00), Float4(-1.0f));
 				break;
 			case VK_FORMAT_R8_UNORM:
 			case VK_FORMAT_R8G8_UNORM:
@@ -235,31 +173,93 @@
 			case VK_FORMAT_R8G8B8A8_SRGB:
 			case VK_FORMAT_R8_SRGB:
 			case VK_FORMAT_R8G8_SRGB:
-				c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xFF00u);
-				c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xFF00u);
-				c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xFF00u);
-				c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0xFF00u);
+				c.x *= Float4(1.0f / 0xFF00u);
+				c.y *= Float4(1.0f / 0xFF00u);
+				c.z *= Float4(1.0f / 0xFF00u);
+				c.w *= Float4(1.0f / 0xFF00u);
 				break;
 			case VK_FORMAT_R16_SNORM:
 			case VK_FORMAT_R16G16_SNORM:
 			case VK_FORMAT_R16G16B16A16_SNORM:
-				c.x = Max(Float4(cs.x) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-				c.y = Max(Float4(cs.y) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-				c.z = Max(Float4(cs.z) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
-				c.w = Max(Float4(cs.w) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+				c.x = Max(c.x * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+				c.y = Max(c.y * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+				c.z = Max(c.z * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+				c.w = Max(c.w * Float4(1.0f / 0x7FFF), Float4(-1.0f));
 				break;
 			default:
 				for(int component = 0; component < textureComponentCount(); component++)
 				{
-					if(hasUnsignedTextureComponent(component))
-					{
-						convertUnsigned16(c[component], cs[component]);
-					}
-					else
-					{
-						convertSigned15(c[component], cs[component]);
-					}
+					c[component] *= Float4(hasUnsignedTextureComponent(component) ? 1.0f / 0xFFFF : 1.0f / 0x7FFF);
 				}
+			}
+		}
+	}
+	else  // 16-bit filtering.
+	{
+		Vector4s cs = sampleFilter(texture, u, v, w, a, offset, sample, lod, anisotropy, uDelta, vDelta, function);
+
+		switch(state.textureFormat)
+		{
+		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+			c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF800);
+			c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xFC00);
+			c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF800);
+			break;
+		case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+			c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF000);
+			c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xF000);
+			c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF000);
+			c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0xF000);
+			break;
+		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+			c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF800);
+			c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xF800);
+			c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF800);
+			c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0x8000);
+			break;
+		case VK_FORMAT_R8_SNORM:
+		case VK_FORMAT_R8G8_SNORM:
+		case VK_FORMAT_R8G8B8A8_SNORM:
+		case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+			c.x = Max(Float4(cs.x) * Float4(1.0f / 0x7F00), Float4(-1.0f));
+			c.y = Max(Float4(cs.y) * Float4(1.0f / 0x7F00), Float4(-1.0f));
+			c.z = Max(Float4(cs.z) * Float4(1.0f / 0x7F00), Float4(-1.0f));
+			c.w = Max(Float4(cs.w) * Float4(1.0f / 0x7F00), Float4(-1.0f));
+			break;
+		case VK_FORMAT_R8_UNORM:
+		case VK_FORMAT_R8G8_UNORM:
+		case VK_FORMAT_R8G8B8A8_UNORM:
+		case VK_FORMAT_B8G8R8A8_UNORM:
+		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+		case VK_FORMAT_B8G8R8A8_SRGB:
+		case VK_FORMAT_R8G8B8A8_SRGB:
+		case VK_FORMAT_R8_SRGB:
+		case VK_FORMAT_R8G8_SRGB:
+			c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xFF00u);
+			c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xFF00u);
+			c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xFF00u);
+			c.w = Float4(As<UShort4>(cs.w)) * Float4(1.0f / 0xFF00u);
+			break;
+		case VK_FORMAT_R16_SNORM:
+		case VK_FORMAT_R16G16_SNORM:
+		case VK_FORMAT_R16G16B16A16_SNORM:
+			c.x = Max(Float4(cs.x) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+			c.y = Max(Float4(cs.y) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+			c.z = Max(Float4(cs.z) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+			c.w = Max(Float4(cs.w) * Float4(1.0f / 0x7FFF), Float4(-1.0f));
+			break;
+		default:
+			for(int component = 0; component < textureComponentCount(); component++)
+			{
+				if(hasUnsignedTextureComponent(component))
+				{
+					convertUnsigned16(c[component], cs[component]);
+				}
+				else
+				{
+					convertSigned15(c[component], cs[component]);
+				}
+			}
 		}
 	}
 
@@ -303,22 +303,22 @@
 {
 	switch(swizzle)
 	{
-		default: UNSUPPORTED("VkComponentSwizzle %d", (int)swizzle);
-		case VK_COMPONENT_SWIZZLE_R: return c.x;
-		case VK_COMPONENT_SWIZZLE_G: return c.y;
-		case VK_COMPONENT_SWIZZLE_B: return c.z;
-		case VK_COMPONENT_SWIZZLE_A: return c.w;
-		case VK_COMPONENT_SWIZZLE_ZERO: return Float4(0.0f, 0.0f, 0.0f, 0.0f);
-		case VK_COMPONENT_SWIZZLE_ONE:
-			if(integer)
-			{
-				return Float4(As<Float4>(sw::Int4(1, 1, 1, 1)));
-			}
-			else
-			{
-				return Float4(1.0f, 1.0f, 1.0f, 1.0f);
-			}
-			break;
+	default: UNSUPPORTED("VkComponentSwizzle %d", (int)swizzle);
+	case VK_COMPONENT_SWIZZLE_R: return c.x;
+	case VK_COMPONENT_SWIZZLE_G: return c.y;
+	case VK_COMPONENT_SWIZZLE_B: return c.z;
+	case VK_COMPONENT_SWIZZLE_A: return c.w;
+	case VK_COMPONENT_SWIZZLE_ZERO: return Float4(0.0f, 0.0f, 0.0f, 0.0f);
+	case VK_COMPONENT_SWIZZLE_ONE:
+		if(integer)
+		{
+			return Float4(As<Float4>(sw::Int4(1, 1, 1, 1)));
+		}
+		else
+		{
+			return Float4(1.0f, 1.0f, 1.0f, 1.0f);
+		}
+		break;
 	}
 };
 
@@ -339,20 +339,20 @@
 	{
 		switch(count)
 		{
-			case -1: return uvw - offset;
-			case 0: return uvw;
-			case +1: return uvw + offset;
-			case 2: return uvw + offset + offset;
+		case -1: return uvw - offset;
+		case 0: return uvw;
+		case +1: return uvw + offset;
+		case 2: return uvw + offset + offset;
 		}
 	}
 	else  // Clamp or mirror
 	{
 		switch(count)
 		{
-			case -1: return SubSat(As<UShort4>(uvw), As<UShort4>(offset));
-			case 0: return uvw;
-			case +1: return AddSat(As<UShort4>(uvw), As<UShort4>(offset));
-			case 2: return AddSat(AddSat(As<UShort4>(uvw), As<UShort4>(offset)), As<UShort4>(offset));
+		case -1: return SubSat(As<UShort4>(uvw), As<UShort4>(offset));
+		case 0: return uvw;
+		case +1: return AddSat(As<UShort4>(uvw), As<UShort4>(offset));
+		case 2: return AddSat(AddSat(As<UShort4>(uvw), As<UShort4>(offset)), As<UShort4>(offset));
 		}
 	}
 
@@ -710,16 +710,16 @@
 			VkComponentSwizzle swizzle = gatherSwizzle();
 			switch(swizzle)
 			{
-				case VK_COMPONENT_SWIZZLE_ZERO:
-				case VK_COMPONENT_SWIZZLE_ONE:
-					// Handled at the final component swizzle.
-					break;
-				default:
-					c.x = c01[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.y = c11[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.z = c10[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.w = c00[swizzle - VK_COMPONENT_SWIZZLE_R];
-					break;
+			case VK_COMPONENT_SWIZZLE_ZERO:
+			case VK_COMPONENT_SWIZZLE_ONE:
+				// Handled at the final component swizzle.
+				break;
+			default:
+				c.x = c01[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.y = c11[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.z = c10[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.w = c00[swizzle - VK_COMPONENT_SWIZZLE_R];
+				break;
 			}
 		}
 	}
@@ -1047,16 +1047,16 @@
 			VkComponentSwizzle swizzle = gatherSwizzle();
 			switch(swizzle)
 			{
-				case VK_COMPONENT_SWIZZLE_ZERO:
-				case VK_COMPONENT_SWIZZLE_ONE:
-					// Handled at the final component swizzle.
-					break;
-				default:
-					c.x = c01[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.y = c11[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.z = c10[swizzle - VK_COMPONENT_SWIZZLE_R];
-					c.w = c00[swizzle - VK_COMPONENT_SWIZZLE_R];
-					break;
+			case VK_COMPONENT_SWIZZLE_ZERO:
+			case VK_COMPONENT_SWIZZLE_ONE:
+				// Handled at the final component swizzle.
+				break;
+			default:
+				c.x = c01[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.y = c11[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.z = c10[swizzle - VK_COMPONENT_SWIZZLE_R];
+				c.w = c00[swizzle - VK_COMPONENT_SWIZZLE_R];
+				break;
 			}
 		}
 	}
@@ -1375,19 +1375,19 @@
 
 	switch(mode)
 	{
-		case AddressingMode::ADDRESSING_WRAP:
-			tmp = (tmp + whd * Int4(-MIN_TEXEL_OFFSET)) % whd;
-			break;
-		case AddressingMode::ADDRESSING_CLAMP:
-		case AddressingMode::ADDRESSING_MIRROR:
-		case AddressingMode::ADDRESSING_MIRRORONCE:
-		case AddressingMode::ADDRESSING_BORDER:  // FIXME: Implement and test ADDRESSING_MIRROR, ADDRESSING_MIRRORONCE, ADDRESSING_BORDER
-			tmp = Min(Max(tmp, Int4(0)), whd - Int4(1));
-			break;
-		case AddressingMode::ADDRESSING_SEAMLESS:
-			ASSERT(false);  // Cube sampling doesn't support offset.
-		default:
-			ASSERT(false);
+	case AddressingMode::ADDRESSING_WRAP:
+		tmp = (tmp + whd * Int4(-MIN_TEXEL_OFFSET)) % whd;
+		break;
+	case AddressingMode::ADDRESSING_CLAMP:
+	case AddressingMode::ADDRESSING_MIRROR:
+	case AddressingMode::ADDRESSING_MIRRORONCE:
+	case AddressingMode::ADDRESSING_BORDER:  // FIXME: Implement and test ADDRESSING_MIRROR, ADDRESSING_MIRRORONCE, ADDRESSING_BORDER
+		tmp = Min(Max(tmp, Int4(0)), whd - Int4(1));
+		break;
+	case AddressingMode::ADDRESSING_SEAMLESS:
+		ASSERT(false);  // Cube sampling doesn't support offset.
+	default:
+		ASSERT(false);
 	}
 
 	return As<Short4>(UShort4(tmp));
@@ -1506,32 +1506,32 @@
 
 		switch(state.textureFormat)
 		{
-			case VK_FORMAT_R5G6B5_UNORM_PACK16:
-				c.z = (c.x & Short4(0x001Fu)) << 11;
-				c.y = (c.x & Short4(0x07E0u)) << 5;
-				c.x = (c.x & Short4(0xF800u));
-				break;
-			case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
-				c.w = (c.x << 12) & Short4(0xF000u);
-				c.z = (c.x) & Short4(0xF000u);
-				c.y = (c.x << 4) & Short4(0xF000u);
-				c.x = (c.x << 8) & Short4(0xF000u);
-				break;
-			case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-				c.w = (c.x) & Short4(0x8000u);
-				c.z = (c.x << 11) & Short4(0xF800u);
-				c.y = (c.x << 6) & Short4(0xF800u);
-				c.x = (c.x << 1) & Short4(0xF800u);
-				break;
-			default:
-				ASSERT(false);
+		case VK_FORMAT_R5G6B5_UNORM_PACK16:
+			c.z = (c.x & Short4(0x001Fu)) << 11;
+			c.y = (c.x & Short4(0x07E0u)) << 5;
+			c.x = (c.x & Short4(0xF800u));
+			break;
+		case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
+			c.w = (c.x << 12) & Short4(0xF000u);
+			c.z = (c.x) & Short4(0xF000u);
+			c.y = (c.x << 4) & Short4(0xF000u);
+			c.x = (c.x << 8) & Short4(0xF000u);
+			break;
+		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+			c.w = (c.x) & Short4(0x8000u);
+			c.z = (c.x << 11) & Short4(0xF800u);
+			c.y = (c.x << 6) & Short4(0xF800u);
+			c.x = (c.x << 1) & Short4(0xF800u);
+			break;
+		default:
+			ASSERT(false);
 		}
 	}
 	else if(has8bitTextureComponents())
 	{
 		switch(textureComponentCount())
 		{
-			case 4:
+		case 4:
 			{
 				Byte4 c0 = Pointer<Byte4>(buffer)[index[0]];
 				Byte4 c1 = Pointer<Byte4>(buffer)[index[1]];
@@ -1542,86 +1542,86 @@
 
 				switch(state.textureFormat)
 				{
-					case VK_FORMAT_B8G8R8A8_UNORM:
-					case VK_FORMAT_B8G8R8A8_SRGB:
-						c.z = As<Short4>(UnpackLow(c.x, c.y));
-						c.x = As<Short4>(UnpackHigh(c.x, c.y));
-						c.y = c.z;
-						c.w = c.x;
-						c.z = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.z));
-						c.y = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.y));
-						c.x = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.x));
-						c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
-						break;
-					case VK_FORMAT_R8G8B8A8_UNORM:
-					case VK_FORMAT_R8G8B8A8_SNORM:
-					case VK_FORMAT_R8G8B8A8_SINT:
-					case VK_FORMAT_R8G8B8A8_SRGB:
-					case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-					case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-					case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-					case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-						c.z = As<Short4>(UnpackHigh(c.x, c.y));
-						c.x = As<Short4>(UnpackLow(c.x, c.y));
-						c.y = c.x;
-						c.w = c.z;
-						c.x = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.x));
-						c.y = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.y));
-						c.z = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.z));
-						c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
-						// Propagate sign bit
-						if(state.textureFormat == VK_FORMAT_R8G8B8A8_SINT ||
-						   state.textureFormat == VK_FORMAT_A8B8G8R8_SINT_PACK32)
-						{
-							c.x >>= 8;
-							c.y >>= 8;
-							c.z >>= 8;
-							c.w >>= 8;
-						}
-						break;
-					case VK_FORMAT_R8G8B8A8_UINT:
-					case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-						c.z = As<Short4>(UnpackHigh(c.x, c.y));
-						c.x = As<Short4>(UnpackLow(c.x, c.y));
-						c.y = c.x;
-						c.w = c.z;
-						c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(Short4(0)));
-						c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(Short4(0)));
-						c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(Short4(0)));
-						c.w = UnpackHigh(As<Byte8>(c.w), As<Byte8>(Short4(0)));
-						break;
-					default:
-						ASSERT(false);
+				case VK_FORMAT_B8G8R8A8_UNORM:
+				case VK_FORMAT_B8G8R8A8_SRGB:
+					c.z = As<Short4>(UnpackLow(c.x, c.y));
+					c.x = As<Short4>(UnpackHigh(c.x, c.y));
+					c.y = c.z;
+					c.w = c.x;
+					c.z = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.z));
+					c.y = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.y));
+					c.x = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.x));
+					c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
+					break;
+				case VK_FORMAT_R8G8B8A8_UNORM:
+				case VK_FORMAT_R8G8B8A8_SNORM:
+				case VK_FORMAT_R8G8B8A8_SINT:
+				case VK_FORMAT_R8G8B8A8_SRGB:
+				case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+				case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+				case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+				case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+					c.z = As<Short4>(UnpackHigh(c.x, c.y));
+					c.x = As<Short4>(UnpackLow(c.x, c.y));
+					c.y = c.x;
+					c.w = c.z;
+					c.x = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.x));
+					c.y = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.y));
+					c.z = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.z));
+					c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
+					// Propagate sign bit
+					if(state.textureFormat == VK_FORMAT_R8G8B8A8_SINT ||
+					   state.textureFormat == VK_FORMAT_A8B8G8R8_SINT_PACK32)
+					{
+						c.x >>= 8;
+						c.y >>= 8;
+						c.z >>= 8;
+						c.w >>= 8;
+					}
+					break;
+				case VK_FORMAT_R8G8B8A8_UINT:
+				case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+					c.z = As<Short4>(UnpackHigh(c.x, c.y));
+					c.x = As<Short4>(UnpackLow(c.x, c.y));
+					c.y = c.x;
+					c.w = c.z;
+					c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(Short4(0)));
+					c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(Short4(0)));
+					c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(Short4(0)));
+					c.w = UnpackHigh(As<Byte8>(c.w), As<Byte8>(Short4(0)));
+					break;
+				default:
+					ASSERT(false);
 				}
 			}
 			break;
-			case 2:
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[0]], 0);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[1]], 1);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[2]], 2);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[3]], 3);
+		case 2:
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[0]], 0);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[1]], 1);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[2]], 2);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[3]], 3);
 
-				switch(state.textureFormat)
-				{
-					case VK_FORMAT_R8G8_UNORM:
-					case VK_FORMAT_R8G8_SNORM:
-					case VK_FORMAT_R8G8_SRGB:
-						c.y = (c.x & Short4(0xFF00u));
-						c.x = (c.x << 8);
-						break;
-					case VK_FORMAT_R8G8_SINT:
-						c.y = c.x >> 8;
-						c.x = (c.x << 8) >> 8;  // Propagate sign bit
-						break;
-					case VK_FORMAT_R8G8_UINT:
-						c.y = As<Short4>(As<UShort4>(c.x) >> 8);
-						c.x &= Short4(0x00FFu);
-						break;
-					default:
-						ASSERT(false);
-				}
+			switch(state.textureFormat)
+			{
+			case VK_FORMAT_R8G8_UNORM:
+			case VK_FORMAT_R8G8_SNORM:
+			case VK_FORMAT_R8G8_SRGB:
+				c.y = (c.x & Short4(0xFF00u));
+				c.x = (c.x << 8);
 				break;
-			case 1:
+			case VK_FORMAT_R8G8_SINT:
+				c.y = c.x >> 8;
+				c.x = (c.x << 8) >> 8;  // Propagate sign bit
+				break;
+			case VK_FORMAT_R8G8_UINT:
+				c.y = As<Short4>(As<UShort4>(c.x) >> 8);
+				c.x &= Short4(0x00FFu);
+				break;
+			default:
+				ASSERT(false);
+			}
+			break;
+		case 1:
 			{
 				Int c0 = Int(*Pointer<Byte>(buffer + index[0]));
 				Int c1 = Int(*Pointer<Byte>(buffer + index[1]));
@@ -1631,9 +1631,9 @@
 
 				switch(state.textureFormat)
 				{
-					case VK_FORMAT_R8_SINT:
-					case VK_FORMAT_R8_UINT:
-					case VK_FORMAT_S8_UINT:
+				case VK_FORMAT_R8_SINT:
+				case VK_FORMAT_R8_UINT:
+				case VK_FORMAT_S8_UINT:
 					{
 						Int zero(0);
 						c.x = Unpack(As<Byte4>(c0), As<Byte4>(zero));
@@ -1644,51 +1644,51 @@
 						}
 					}
 					break;
-					case VK_FORMAT_R8_SNORM:
-					case VK_FORMAT_R8_UNORM:
-					case VK_FORMAT_R8_SRGB:
-						// TODO: avoid populating the low bits at all.
-						c.x = Unpack(As<Byte4>(c0));
-						c.x &= Short4(0xFF00u);
-						break;
-					default:
-						c.x = Unpack(As<Byte4>(c0));
-						break;
+				case VK_FORMAT_R8_SNORM:
+				case VK_FORMAT_R8_UNORM:
+				case VK_FORMAT_R8_SRGB:
+					// TODO: avoid populating the low bits at all.
+					c.x = Unpack(As<Byte4>(c0));
+					c.x &= Short4(0xFF00u);
+					break;
+				default:
+					c.x = Unpack(As<Byte4>(c0));
+					break;
 				}
 			}
 			break;
-			default:
-				ASSERT(false);
+		default:
+			ASSERT(false);
 		}
 	}
 	else if(has16bitTextureComponents())
 	{
 		switch(textureComponentCount())
 		{
-			case 4:
-				c.x = Pointer<Short4>(buffer)[index[0]];
-				c.y = Pointer<Short4>(buffer)[index[1]];
-				c.z = Pointer<Short4>(buffer)[index[2]];
-				c.w = Pointer<Short4>(buffer)[index[3]];
-				transpose4x4(c.x, c.y, c.z, c.w);
-				break;
-			case 2:
-				c.x = *Pointer<Short4>(buffer + 4 * index[0]);
-				c.x = As<Short4>(UnpackLow(c.x, *Pointer<Short4>(buffer + 4 * index[1])));
-				c.z = *Pointer<Short4>(buffer + 4 * index[2]);
-				c.z = As<Short4>(UnpackLow(c.z, *Pointer<Short4>(buffer + 4 * index[3])));
-				c.y = c.x;
-				c.x = UnpackLow(As<Int2>(c.x), As<Int2>(c.z));
-				c.y = UnpackHigh(As<Int2>(c.y), As<Int2>(c.z));
-				break;
-			case 1:
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[0]], 0);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[1]], 1);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[2]], 2);
-				c.x = Insert(c.x, Pointer<Short>(buffer)[index[3]], 3);
-				break;
-			default:
-				ASSERT(false);
+		case 4:
+			c.x = Pointer<Short4>(buffer)[index[0]];
+			c.y = Pointer<Short4>(buffer)[index[1]];
+			c.z = Pointer<Short4>(buffer)[index[2]];
+			c.w = Pointer<Short4>(buffer)[index[3]];
+			transpose4x4(c.x, c.y, c.z, c.w);
+			break;
+		case 2:
+			c.x = *Pointer<Short4>(buffer + 4 * index[0]);
+			c.x = As<Short4>(UnpackLow(c.x, *Pointer<Short4>(buffer + 4 * index[1])));
+			c.z = *Pointer<Short4>(buffer + 4 * index[2]);
+			c.z = As<Short4>(UnpackLow(c.z, *Pointer<Short4>(buffer + 4 * index[3])));
+			c.y = c.x;
+			c.x = UnpackLow(As<Int2>(c.x), As<Int2>(c.z));
+			c.y = UnpackHigh(As<Int2>(c.y), As<Int2>(c.z));
+			break;
+		case 1:
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[0]], 0);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[1]], 1);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[2]], 2);
+			c.x = Insert(c.x, Pointer<Short>(buffer)[index[3]], 3);
+			break;
+		default:
+			ASSERT(false);
 		}
 	}
 	else if(state.textureFormat == VK_FORMAT_A2B10G10R10_UNORM_PACK32)
@@ -1865,20 +1865,20 @@
 
 				switch(state.ycbcrModel)
 				{
-					case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709:
-						Kb = 0.0722f;
-						Kr = 0.2126f;
-						break;
-					case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601:
-						Kb = 0.114f;
-						Kr = 0.299f;
-						break;
-					case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020:
-						Kb = 0.0593f;
-						Kr = 0.2627f;
-						break;
-					default:
-						UNSUPPORTED("ycbcrModel %d", int(state.ycbcrModel));
+				case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709:
+					Kb = 0.0722f;
+					Kr = 0.2126f;
+					break;
+				case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601:
+					Kb = 0.114f;
+					Kr = 0.299f;
+					break;
+				case VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020:
+					Kb = 0.0593f;
+					Kr = 0.2627f;
+					break;
+				default:
+					UNSUPPORTED("ycbcrModel %d", int(state.ycbcrModel));
 				}
 
 				const float Kg = 1.0f - Kr - Kb;
@@ -1930,74 +1930,74 @@
 
 		switch(state.textureFormat)
 		{
-			case VK_FORMAT_R16_SFLOAT:
-				t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 2));
-				t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 2));
-				t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 2));
-				t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 2));
+		case VK_FORMAT_R16_SFLOAT:
+			t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 2));
+			t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 2));
+			t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 2));
+			t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 2));
 
-				c.x.x = Extract(As<Float4>(halfToFloatBits(t0)), 0);
-				c.x.y = Extract(As<Float4>(halfToFloatBits(t1)), 0);
-				c.x.z = Extract(As<Float4>(halfToFloatBits(t2)), 0);
-				c.x.w = Extract(As<Float4>(halfToFloatBits(t3)), 0);
-				break;
-			case VK_FORMAT_R16G16_SFLOAT:
-				t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 4));
-				t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 4));
-				t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 4));
-				t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 4));
+			c.x.x = Extract(As<Float4>(halfToFloatBits(t0)), 0);
+			c.x.y = Extract(As<Float4>(halfToFloatBits(t1)), 0);
+			c.x.z = Extract(As<Float4>(halfToFloatBits(t2)), 0);
+			c.x.w = Extract(As<Float4>(halfToFloatBits(t3)), 0);
+			break;
+		case VK_FORMAT_R16G16_SFLOAT:
+			t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 4));
+			t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 4));
+			t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 4));
+			t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 4));
 
-				// FIXME: shuffles
-				c.x = As<Float4>(halfToFloatBits(t0));
-				c.y = As<Float4>(halfToFloatBits(t1));
-				c.z = As<Float4>(halfToFloatBits(t2));
-				c.w = As<Float4>(halfToFloatBits(t3));
-				transpose4x4(c.x, c.y, c.z, c.w);
-				break;
-			case VK_FORMAT_R16G16B16A16_SFLOAT:
-				t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 8));
-				t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 8));
-				t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 8));
-				t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 8));
+			// FIXME: shuffles
+			c.x = As<Float4>(halfToFloatBits(t0));
+			c.y = As<Float4>(halfToFloatBits(t1));
+			c.z = As<Float4>(halfToFloatBits(t2));
+			c.w = As<Float4>(halfToFloatBits(t3));
+			transpose4x4(c.x, c.y, c.z, c.w);
+			break;
+		case VK_FORMAT_R16G16B16A16_SFLOAT:
+			t0 = Int4(*Pointer<UShort4>(buffer + index[0] * 8));
+			t1 = Int4(*Pointer<UShort4>(buffer + index[1] * 8));
+			t2 = Int4(*Pointer<UShort4>(buffer + index[2] * 8));
+			t3 = Int4(*Pointer<UShort4>(buffer + index[3] * 8));
 
-				c.x = As<Float4>(halfToFloatBits(t0));
-				c.y = As<Float4>(halfToFloatBits(t1));
-				c.z = As<Float4>(halfToFloatBits(t2));
-				c.w = As<Float4>(halfToFloatBits(t3));
-				transpose4x4(c.x, c.y, c.z, c.w);
-				break;
-			case VK_FORMAT_R32_SFLOAT:
-			case VK_FORMAT_R32_SINT:
-			case VK_FORMAT_R32_UINT:
-			case VK_FORMAT_D32_SFLOAT:
-				// FIXME: Optimal shuffling?
-				c.x.x = *Pointer<Float>(buffer + index[0] * 4);
-				c.x.y = *Pointer<Float>(buffer + index[1] * 4);
-				c.x.z = *Pointer<Float>(buffer + index[2] * 4);
-				c.x.w = *Pointer<Float>(buffer + index[3] * 4);
-				break;
-			case VK_FORMAT_R32G32_SFLOAT:
-			case VK_FORMAT_R32G32_SINT:
-			case VK_FORMAT_R32G32_UINT:
-				// FIXME: Optimal shuffling?
-				c.x.xy = *Pointer<Float4>(buffer + index[0] * 8);
-				c.x.zw = *Pointer<Float4>(buffer + index[1] * 8 - 8);
-				c.z.xy = *Pointer<Float4>(buffer + index[2] * 8);
-				c.z.zw = *Pointer<Float4>(buffer + index[3] * 8 - 8);
-				c.y = c.x;
-				c.x = Float4(c.x.xz, c.z.xz);
-				c.y = Float4(c.y.yw, c.z.yw);
-				break;
-			case VK_FORMAT_R32G32B32A32_SFLOAT:
-			case VK_FORMAT_R32G32B32A32_SINT:
-			case VK_FORMAT_R32G32B32A32_UINT:
-				c.x = *Pointer<Float4>(buffer + index[0] * 16, 16);
-				c.y = *Pointer<Float4>(buffer + index[1] * 16, 16);
-				c.z = *Pointer<Float4>(buffer + index[2] * 16, 16);
-				c.w = *Pointer<Float4>(buffer + index[3] * 16, 16);
-				transpose4x4(c.x, c.y, c.z, c.w);
-				break;
-			case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
+			c.x = As<Float4>(halfToFloatBits(t0));
+			c.y = As<Float4>(halfToFloatBits(t1));
+			c.z = As<Float4>(halfToFloatBits(t2));
+			c.w = As<Float4>(halfToFloatBits(t3));
+			transpose4x4(c.x, c.y, c.z, c.w);
+			break;
+		case VK_FORMAT_R32_SFLOAT:
+		case VK_FORMAT_R32_SINT:
+		case VK_FORMAT_R32_UINT:
+		case VK_FORMAT_D32_SFLOAT:
+			// FIXME: Optimal shuffling?
+			c.x.x = *Pointer<Float>(buffer + index[0] * 4);
+			c.x.y = *Pointer<Float>(buffer + index[1] * 4);
+			c.x.z = *Pointer<Float>(buffer + index[2] * 4);
+			c.x.w = *Pointer<Float>(buffer + index[3] * 4);
+			break;
+		case VK_FORMAT_R32G32_SFLOAT:
+		case VK_FORMAT_R32G32_SINT:
+		case VK_FORMAT_R32G32_UINT:
+			// FIXME: Optimal shuffling?
+			c.x.xy = *Pointer<Float4>(buffer + index[0] * 8);
+			c.x.zw = *Pointer<Float4>(buffer + index[1] * 8 - 8);
+			c.z.xy = *Pointer<Float4>(buffer + index[2] * 8);
+			c.z.zw = *Pointer<Float4>(buffer + index[3] * 8 - 8);
+			c.y = c.x;
+			c.x = Float4(c.x.xz, c.z.xz);
+			c.y = Float4(c.y.yw, c.z.yw);
+			break;
+		case VK_FORMAT_R32G32B32A32_SFLOAT:
+		case VK_FORMAT_R32G32B32A32_SINT:
+		case VK_FORMAT_R32G32B32A32_UINT:
+			c.x = *Pointer<Float4>(buffer + index[0] * 16, 16);
+			c.y = *Pointer<Float4>(buffer + index[1] * 16, 16);
+			c.z = *Pointer<Float4>(buffer + index[2] * 16, 16);
+			c.w = *Pointer<Float4>(buffer + index[3] * 16, 16);
+			transpose4x4(c.x, c.y, c.z, c.w);
+			break;
+		case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
 			{
 				Float4 t;  // TODO: add Insert(UInt4, RValue<UInt>)
 				t.x = *Pointer<Float>(buffer + index[0] * 4);
@@ -2009,9 +2009,9 @@
 				c.x = Float4(t0 & UInt4(0x1FF)) * c.w;
 				c.y = Float4((t0 >> 9) & UInt4(0x1FF)) * c.w;
 				c.z = Float4((t0 >> 18) & UInt4(0x1FF)) * c.w;
-				break;
 			}
-			case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+			break;
+		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
 			{
 				Float4 t;  // TODO: add Insert(UInt4, RValue<UInt>)
 				t.x = *Pointer<Float>(buffer + index[0] * 4);
@@ -2022,10 +2022,10 @@
 				c.x = As<Float4>(halfToFloatBits((t0 << 4) & UInt4(0x7FF0)));
 				c.y = As<Float4>(halfToFloatBits((t0 >> 7) & UInt4(0x7FF0)));
 				c.z = As<Float4>(halfToFloatBits((t0 >> 17) & UInt4(0x7FE0)));
-				break;
 			}
-			default:
-				UNSUPPORTED("Format %d", VkFormat(state.textureFormat));
+			break;
+		default:
+			UNSUPPORTED("Format %d", VkFormat(state.textureFormat));
 		}
 	}
 	else
@@ -2078,15 +2078,15 @@
 
 		switch(state.compareOp)
 		{
-			case VK_COMPARE_OP_LESS_OR_EQUAL: boolean = CmpLE(ref, c.x); break;
-			case VK_COMPARE_OP_GREATER_OR_EQUAL: boolean = CmpNLT(ref, c.x); break;
-			case VK_COMPARE_OP_LESS: boolean = CmpLT(ref, c.x); break;
-			case VK_COMPARE_OP_GREATER: boolean = CmpNLE(ref, c.x); break;
-			case VK_COMPARE_OP_EQUAL: boolean = CmpEQ(ref, c.x); break;
-			case VK_COMPARE_OP_NOT_EQUAL: boolean = CmpNEQ(ref, c.x); break;
-			case VK_COMPARE_OP_ALWAYS: boolean = Int4(-1); break;
-			case VK_COMPARE_OP_NEVER: boolean = Int4(0); break;
-			default: ASSERT(false);
+		case VK_COMPARE_OP_LESS_OR_EQUAL: boolean = CmpLE(ref, c.x); break;
+		case VK_COMPARE_OP_GREATER_OR_EQUAL: boolean = CmpNLT(ref, c.x); break;
+		case VK_COMPARE_OP_LESS: boolean = CmpLT(ref, c.x); break;
+		case VK_COMPARE_OP_GREATER: boolean = CmpNLE(ref, c.x); break;
+		case VK_COMPARE_OP_EQUAL: boolean = CmpEQ(ref, c.x); break;
+		case VK_COMPARE_OP_NOT_EQUAL: boolean = CmpNEQ(ref, c.x); break;
+		case VK_COMPARE_OP_ALWAYS: boolean = Int4(-1); break;
+		case VK_COMPARE_OP_NEVER: boolean = Int4(0); break;
+		default: ASSERT(false);
 		}
 
 		c.x = As<Float4>(boolean & As<Int4>(Float4(1.0f)));
@@ -2114,29 +2114,29 @@
 
 	switch(state.border)
 	{
-		case VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK:
-		case VK_BORDER_COLOR_INT_TRANSPARENT_BLACK:
-			borderRGB = Int4(0);
-			borderA = Int4(0);
-			break;
-		case VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK:
-			borderRGB = Int4(0);
-			borderA = float_one;
-			break;
-		case VK_BORDER_COLOR_INT_OPAQUE_BLACK:
-			borderRGB = Int4(0);
-			borderA = Int4(1);
-			break;
-		case VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE:
-			borderRGB = float_one;
-			borderA = float_one;
-			break;
-		case VK_BORDER_COLOR_INT_OPAQUE_WHITE:
-			borderRGB = Int4(1);
-			borderA = Int4(1);
-			break;
-		default:
-			UNSUPPORTED("sint/uint/sfloat border: %u", state.border);
+	case VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK:
+	case VK_BORDER_COLOR_INT_TRANSPARENT_BLACK:
+		borderRGB = Int4(0);
+		borderA = Int4(0);
+		break;
+	case VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK:
+		borderRGB = Int4(0);
+		borderA = float_one;
+		break;
+	case VK_BORDER_COLOR_INT_OPAQUE_BLACK:
+		borderRGB = Int4(0);
+		borderA = Int4(1);
+		break;
+	case VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE:
+		borderRGB = float_one;
+		borderA = float_one;
+		break;
+	case VK_BORDER_COLOR_INT_OPAQUE_WHITE:
+		borderRGB = Int4(1);
+		borderA = Int4(1);
+		break;
+	default:
+		UNSUPPORTED("sint/uint/sfloat border: %u", state.border);
 	}
 
 	Vector4f out;
@@ -2297,17 +2297,17 @@
 		{
 			switch(addressingMode)
 			{
-				case ADDRESSING_CLAMP:
-					coord = Min(Max(coord, Float4(0.0f)), Float4(dim) * As<Float4>(Int4(oneBits)));
-					break;
-				case ADDRESSING_BORDER:
-					// Don't map to a valid range here.
-					break;
-				default:
-					// "If unnormalizedCoordinates is VK_TRUE, addressModeU and addressModeV must each be
-					//  either VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER"
-					UNREACHABLE("addressingMode %d", int(addressingMode));
-					break;
+			case ADDRESSING_CLAMP:
+				coord = Min(Max(coord, Float4(0.0f)), Float4(dim) * As<Float4>(Int4(oneBits)));
+				break;
+			case ADDRESSING_BORDER:
+				// Don't map to a valid range here.
+				break;
+			default:
+				// "If unnormalizedCoordinates is VK_TRUE, addressModeU and addressModeV must each be
+				//  either VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER"
+				UNREACHABLE("addressingMode %d", int(addressingMode));
+				break;
 			}
 		}
 		else if(state.textureFilter == FILTER_GATHER && addressingMode == ADDRESSING_MIRROR)
@@ -2340,18 +2340,18 @@
 			{
 				switch(addressingMode)
 				{
-					case ADDRESSING_CLAMP:
-					case ADDRESSING_SEAMLESS:
-						// While cube face coordinates are nominally already in the [0.0, 1.0] range
-						// due to the projection, and numerical imprecision is tolerated due to the
-						// border of pixels for seamless filtering, the projection doesn't cause
-						// range normalization for Inf and NaN values. So we always clamp.
-						{
-							Float4 one = As<Float4>(Int4(oneBits));
-							coord = Min(Max(coord, Float4(0.0f)), one);
-						}
-						break;
-					case ADDRESSING_MIRROR:
+				case ADDRESSING_CLAMP:
+				case ADDRESSING_SEAMLESS:
+					// While cube face coordinates are nominally already in the [0.0, 1.0] range
+					// due to the projection, and numerical imprecision is tolerated due to the
+					// border of pixels for seamless filtering, the projection doesn't cause
+					// range normalization for Inf and NaN values. So we always clamp.
+					{
+						Float4 one = As<Float4>(Int4(oneBits));
+						coord = Min(Max(coord, Float4(0.0f)), one);
+					}
+					break;
+				case ADDRESSING_MIRROR:
 					{
 						Float4 half = As<Float4>(Int4(halfBits));
 						Float4 one = As<Float4>(Int4(oneBits));
@@ -2359,7 +2359,7 @@
 						coord = one - Abs(two * Frac(coord * half) - one);
 					}
 					break;
-					case ADDRESSING_MIRRORONCE:
+				case ADDRESSING_MIRRORONCE:
 					{
 						Float4 half = As<Float4>(Int4(halfBits));
 						Float4 one = As<Float4>(Int4(oneBits));
@@ -2367,12 +2367,12 @@
 						coord = one - Abs(two * Frac(Min(Max(coord, -one), two) * half) - one);
 					}
 					break;
-					case ADDRESSING_BORDER:
-						// Don't map to a valid range here.
-						break;
-					default:  // Wrap
-						coord = Frac(coord);
-						break;
+				case ADDRESSING_BORDER:
+					// Don't map to a valid range here.
+					break;
+				default:  // Wrap
+					coord = Frac(coord);
+					break;
 				}
 			}
 
@@ -2431,35 +2431,35 @@
 		{
 			switch(addressingMode)
 			{
-				case ADDRESSING_SEAMLESS:
-					UNREACHABLE("addressingMode %d", int(addressingMode));  // Cube sampling doesn't support offset.
-				case ADDRESSING_MIRROR:
-				case ADDRESSING_MIRRORONCE:
-					// TODO: Implement ADDRESSING_MIRROR and ADDRESSING_MIRRORONCE.
-					// Fall through to Clamp.
-				case ADDRESSING_CLAMP:
-					xyz0 = Min(Max(xyz0, Int4(0)), maxXYZ);
-					xyz1 = Min(Max(xyz1, Int4(0)), maxXYZ);
-					break;
-				default:  // Wrap
-					xyz0 = mod(xyz0, dim);
-					xyz1 = mod(xyz1, dim);
-					break;
+			case ADDRESSING_SEAMLESS:
+				UNREACHABLE("addressingMode %d", int(addressingMode));  // Cube sampling doesn't support offset.
+			case ADDRESSING_MIRROR:
+			case ADDRESSING_MIRRORONCE:
+				// TODO: Implement ADDRESSING_MIRROR and ADDRESSING_MIRRORONCE.
+				// Fall through to Clamp.
+			case ADDRESSING_CLAMP:
+				xyz0 = Min(Max(xyz0, Int4(0)), maxXYZ);
+				xyz1 = Min(Max(xyz1, Int4(0)), maxXYZ);
+				break;
+			default:  // Wrap
+				xyz0 = mod(xyz0, dim);
+				xyz1 = mod(xyz1, dim);
+				break;
 			}
 		}
 		else if(state.textureFilter != FILTER_POINT)
 		{
 			switch(addressingMode)
 			{
-				case ADDRESSING_SEAMLESS:
-					break;
-				case ADDRESSING_MIRROR:
-				case ADDRESSING_MIRRORONCE:
-				case ADDRESSING_CLAMP:
-					xyz0 = Max(xyz0, Int4(0));
-					xyz1 = Min(xyz1, maxXYZ);
-					break;
-				default:  // Wrap
+			case ADDRESSING_SEAMLESS:
+				break;
+			case ADDRESSING_MIRROR:
+			case ADDRESSING_MIRRORONCE:
+			case ADDRESSING_CLAMP:
+				xyz0 = Max(xyz0, Int4(0));
+				xyz1 = Min(xyz1, maxXYZ);
+				break;
+			default:  // Wrap
 				{
 					Int4 under = CmpLT(xyz0, Int4(0));
 					xyz0 = (under & maxXYZ) | (~under & xyz0);  // xyz < 0 ? dim - 1 : xyz   // TODO: IfThenElse()
@@ -2586,13 +2586,13 @@
 {
 	switch(state.gatherComponent)
 	{
-		case 0: return state.swizzle.r;
-		case 1: return state.swizzle.g;
-		case 2: return state.swizzle.b;
-		case 3: return state.swizzle.a;
-		default:
-			UNREACHABLE("Invalid component");
-			return VK_COMPONENT_SWIZZLE_R;
+	case 0: return state.swizzle.r;
+	case 1: return state.swizzle.g;
+	case 2: return state.swizzle.b;
+	case 3: return state.swizzle.a;
+	default:
+		UNREACHABLE("Invalid component");
+		return VK_COMPONENT_SWIZZLE_R;
 	}
 }
 
diff --git a/src/Pipeline/ShaderCore.cpp b/src/Pipeline/ShaderCore.cpp
index 7a01ffc..b384af0 100644
--- a/src/Pipeline/ShaderCore.cpp
+++ b/src/Pipeline/ShaderCore.cpp
@@ -55,10 +55,10 @@
 {
 	switch(i)
 	{
-		case 0: return x;
-		case 1: return y;
-		case 2: return z;
-		case 3: return w;
+	case 0: return x;
+	case 1: return y;
+	case 2: return z;
+	case 3: return w;
 	}
 
 	return x;
@@ -98,10 +98,10 @@
 {
 	switch(i)
 	{
-		case 0: return x;
-		case 1: return y;
-		case 2: return z;
-		case 3: return w;
+	case 0: return x;
+	case 1: return y;
+	case 2: return z;
+	case 3: return w;
 	}
 
 	return x;
@@ -141,10 +141,10 @@
 {
 	switch(i)
 	{
-		case 0: return x;
-		case 1: return y;
-		case 2: return z;
-		case 3: return w;
+	case 0: return x;
+	case 1: return y;
+	case 2: return z;
+	case 3: return w;
 	}
 
 	return x;
@@ -551,10 +551,10 @@
 {
 	switch(N)
 	{
-		case 1: transpose4x1(row0, row1, row2, row3); break;
-		case 2: transpose4x2(row0, row1, row2, row3); break;
-		case 3: transpose4x3(row0, row1, row2, row3); break;
-		case 4: transpose4x4(row0, row1, row2, row3); break;
+	case 1: transpose4x1(row0, row1, row2, row3); break;
+	case 2: transpose4x2(row0, row1, row2, row3); break;
+	case 3: transpose4x3(row0, row1, row2, row3); break;
+	case 4: transpose4x4(row0, row1, row2, row3); break;
 	}
 }
 
@@ -1029,14 +1029,14 @@
 		{
 			switch(robustness)
 			{
-				case OutOfBoundsBehavior::UndefinedBehavior:
-					// With this robustness setting the application/compiler guarantees in-bounds accesses on active lanes,
-					// but since it can't know in advance which branches are taken this must be true even for inactives lanes.
-					return true;
-				case OutOfBoundsBehavior::Nullify:
-				case OutOfBoundsBehavior::RobustBufferAccess:
-				case OutOfBoundsBehavior::UndefinedValue:
-					return false;
+			case OutOfBoundsBehavior::UndefinedBehavior:
+				// With this robustness setting the application/compiler guarantees in-bounds accesses on active lanes,
+				// but since it can't know in advance which branches are taken this must be true even for inactives lanes.
+				return true;
+			case OutOfBoundsBehavior::Nullify:
+			case OutOfBoundsBehavior::RobustBufferAccess:
+			case OutOfBoundsBehavior::UndefinedValue:
+				return false;
 			}
 		}
 	}
diff --git a/src/Pipeline/ShaderCore.hpp b/src/Pipeline/ShaderCore.hpp
index b749ada..bb9205e 100644
--- a/src/Pipeline/ShaderCore.hpp
+++ b/src/Pipeline/ShaderCore.hpp
@@ -339,14 +339,14 @@
 	{
 		switch(robustness)
 		{
-			case OutOfBoundsBehavior::Nullify:
-			case OutOfBoundsBehavior::RobustBufferAccess:
-			case OutOfBoundsBehavior::UndefinedValue:
-				mask &= isInBounds(sizeof(float), robustness);  // Disable out-of-bounds reads.
-				break;
-			case OutOfBoundsBehavior::UndefinedBehavior:
-				// Nothing to do. Application/compiler must guarantee no out-of-bounds accesses.
-				break;
+		case OutOfBoundsBehavior::Nullify:
+		case OutOfBoundsBehavior::RobustBufferAccess:
+		case OutOfBoundsBehavior::UndefinedValue:
+			mask &= isInBounds(sizeof(float), robustness);  // Disable out-of-bounds reads.
+			break;
+		case OutOfBoundsBehavior::UndefinedBehavior:
+			// Nothing to do. Application/compiler must guarantee no out-of-bounds accesses.
+			break;
 		}
 	}
 
@@ -371,14 +371,14 @@
 		bool zeroMaskedLanes = true;
 		switch(robustness)
 		{
-			case OutOfBoundsBehavior::Nullify:
-			case OutOfBoundsBehavior::RobustBufferAccess:  // Must either return an in-bounds value, or zero.
-				zeroMaskedLanes = true;
-				break;
-			case OutOfBoundsBehavior::UndefinedValue:
-			case OutOfBoundsBehavior::UndefinedBehavior:
-				zeroMaskedLanes = false;
-				break;
+		case OutOfBoundsBehavior::Nullify:
+		case OutOfBoundsBehavior::RobustBufferAccess:  // Must either return an in-bounds value, or zero.
+			zeroMaskedLanes = true;
+			break;
+		case OutOfBoundsBehavior::UndefinedValue:
+		case OutOfBoundsBehavior::UndefinedBehavior:
+			zeroMaskedLanes = false;
+			break;
 		}
 
 		if(hasStaticSequentialOffsets(sizeof(float)))
@@ -431,14 +431,14 @@
 
 	switch(robustness)
 	{
-		case OutOfBoundsBehavior::Nullify:
-		case OutOfBoundsBehavior::RobustBufferAccess:       // TODO: Allows writing anywhere within bounds. Could be faster than masking.
-		case OutOfBoundsBehavior::UndefinedValue:           // Should not be used for store operations. Treat as robust buffer access.
-			mask &= isInBounds(sizeof(float), robustness);  // Disable out-of-bounds writes.
-			break;
-		case OutOfBoundsBehavior::UndefinedBehavior:
-			// Nothing to do. Application/compiler must guarantee no out-of-bounds accesses.
-			break;
+	case OutOfBoundsBehavior::Nullify:
+	case OutOfBoundsBehavior::RobustBufferAccess:       // TODO: Allows writing anywhere within bounds. Could be faster than masking.
+	case OutOfBoundsBehavior::UndefinedValue:           // Should not be used for store operations. Treat as robust buffer access.
+		mask &= isInBounds(sizeof(float), robustness);  // Disable out-of-bounds writes.
+		break;
+	case OutOfBoundsBehavior::UndefinedBehavior:
+		// Nothing to do. Application/compiler must guarantee no out-of-bounds accesses.
+		break;
 	}
 
 	if(!atomic && order == std::memory_order_relaxed)
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 9f33153..f82f1e8 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -74,7 +74,7 @@
 
 		switch(opcode)
 		{
-			case spv::OpEntryPoint:
+		case spv::OpEntryPoint:
 			{
 				executionModel = spv::ExecutionModel(insn.word(1));
 				auto id = Function::ID(insn.word(2));
@@ -85,14 +85,14 @@
 					ASSERT_MSG(entryPoint == 0, "Duplicate entry point with name '%s' and stage %d", name, int(stage));
 					entryPoint = id;
 				}
-				break;
 			}
+			break;
 
-			case spv::OpExecutionMode:
-				ProcessExecutionMode(insn);
-				break;
+		case spv::OpExecutionMode:
+			ProcessExecutionMode(insn);
+			break;
 
-			case spv::OpDecorate:
+		case spv::OpDecorate:
 			{
 				TypeOrObjectID targetId = insn.word(1);
 				auto decoration = static_cast<spv::Decoration>(insn.word(2));
@@ -102,29 +102,31 @@
 
 				switch(decoration)
 				{
-					case spv::DecorationDescriptorSet:
-						descriptorDecorations[targetId].DescriptorSet = value;
-						break;
-					case spv::DecorationBinding:
-						descriptorDecorations[targetId].Binding = value;
-						break;
-					case spv::DecorationInputAttachmentIndex:
-						descriptorDecorations[targetId].InputAttachmentIndex = value;
-						break;
-					case spv::DecorationSample:
-						modes.ContainsSampleQualifier = true;
-						break;
-					default:
-						// Only handling descriptor decorations here.
-						break;
+				case spv::DecorationDescriptorSet:
+					descriptorDecorations[targetId].DescriptorSet = value;
+					break;
+				case spv::DecorationBinding:
+					descriptorDecorations[targetId].Binding = value;
+					break;
+				case spv::DecorationInputAttachmentIndex:
+					descriptorDecorations[targetId].InputAttachmentIndex = value;
+					break;
+				case spv::DecorationSample:
+					modes.ContainsSampleQualifier = true;
+					break;
+				default:
+					// Only handling descriptor decorations here.
+					break;
 				}
 
 				if(decoration == spv::DecorationCentroid)
+				{
 					modes.NeedsCentroid = true;
-				break;
+				}
 			}
+			break;
 
-			case spv::OpMemberDecorate:
+		case spv::OpMemberDecorate:
 			{
 				Type::ID targetId = insn.word(1);
 				auto memberIndex = insn.word(2);
@@ -138,11 +140,13 @@
 				d[memberIndex].Apply(decoration, value);
 
 				if(decoration == spv::DecorationCentroid)
+				{
 					modes.NeedsCentroid = true;
-				break;
+				}
 			}
+			break;
 
-			case spv::OpDecorateId:
+		case spv::OpDecorateId:
 			{
 				auto decoration = static_cast<spv::Decoration>(insn.word(2));
 
@@ -151,23 +155,21 @@
 				// by HLSL to build the graphics pipeline with shader reflection. At the driver level,
 				// the CounterBuffer decoration does nothing, so we can safely ignore both decorations.
 				ASSERT(decoration == spv::DecorationUniformId || decoration == spv::DecorationCounterBuffer);
-				break;
 			}
+			break;
 
-			case spv::OpDecorateString:
-			case spv::OpMemberDecorateString:
-			{
-				// We assume these are for HLSL semantics, ignore them.
-				break;
-			}
+		case spv::OpDecorateString:
+		case spv::OpMemberDecorateString:
+			// We assume these are for HLSL semantics, ignore them.
+			break;
 
-			case spv::OpDecorationGroup:
-				// Nothing to do here. We don't need to record the definition of the group; we'll just have
-				// the bundle of decorations float around. If we were to ever walk the decorations directly,
-				// we might think about introducing this as a real Object.
-				break;
+		case spv::OpDecorationGroup:
+			// Nothing to do here. We don't need to record the definition of the group; we'll just have
+			// the bundle of decorations float around. If we were to ever walk the decorations directly,
+			// we might think about introducing this as a real Object.
+			break;
 
-			case spv::OpGroupDecorate:
+		case spv::OpGroupDecorate:
 			{
 				uint32_t group = insn.word(1);
 				auto const &groupDecorations = decorations[group];
@@ -179,11 +181,10 @@
 					decorations[target].Apply(groupDecorations);
 					descriptorDecorations[target].Apply(descriptorGroupDecorations);
 				}
-
-				break;
 			}
+			break;
 
-			case spv::OpGroupMemberDecorate:
+		case spv::OpGroupMemberDecorate:
 			{
 				auto const &srcDecorations = decorations[insn.word(1)];
 				for(auto i = 2u; i < insn.wordCount(); i += 2)
@@ -195,27 +196,27 @@
 						d.resize(memberIndex + 1);  // on demand resize, see above...
 					d[memberIndex].Apply(srcDecorations);
 				}
-				break;
 			}
+			break;
 
-			case spv::OpLabel:
+		case spv::OpLabel:
 			{
 				ASSERT(currentBlock.value() == 0);
 				currentBlock = Block::ID(insn.word(1));
 				blockStart = insn;
-				break;
 			}
+			break;
 
-			// Branch Instructions (subset of Termination Instructions):
-			case spv::OpBranch:
-			case spv::OpBranchConditional:
-			case spv::OpSwitch:
-			case spv::OpReturn:
-				// [[fallthrough]]
+		// Branch Instructions (subset of Termination Instructions):
+		case spv::OpBranch:
+		case spv::OpBranchConditional:
+		case spv::OpSwitch:
+		case spv::OpReturn:
+			// [[fallthrough]]
 
-			// Termination instruction:
-			case spv::OpKill:
-			case spv::OpUnreachable:
+		// Termination instruction:
+		case spv::OpKill:
+		case spv::OpUnreachable:
 			{
 				ASSERT(currentBlock.value() != 0);
 				ASSERT(currentFunction.value() != 0);
@@ -229,31 +230,31 @@
 				{
 					modes.ContainsKill = true;
 				}
-				break;
 			}
+			break;
 
-			case spv::OpLoopMerge:
-			case spv::OpSelectionMerge:
-				break;  // Nothing to do in analysis pass.
+		case spv::OpLoopMerge:
+		case spv::OpSelectionMerge:
+			break;  // Nothing to do in analysis pass.
 
-			case spv::OpTypeVoid:
-			case spv::OpTypeBool:
-			case spv::OpTypeInt:
-			case spv::OpTypeFloat:
-			case spv::OpTypeVector:
-			case spv::OpTypeMatrix:
-			case spv::OpTypeImage:
-			case spv::OpTypeSampler:
-			case spv::OpTypeSampledImage:
-			case spv::OpTypeArray:
-			case spv::OpTypeRuntimeArray:
-			case spv::OpTypeStruct:
-			case spv::OpTypePointer:
-			case spv::OpTypeFunction:
-				DeclareType(insn);
-				break;
+		case spv::OpTypeVoid:
+		case spv::OpTypeBool:
+		case spv::OpTypeInt:
+		case spv::OpTypeFloat:
+		case spv::OpTypeVector:
+		case spv::OpTypeMatrix:
+		case spv::OpTypeImage:
+		case spv::OpTypeSampler:
+		case spv::OpTypeSampledImage:
+		case spv::OpTypeArray:
+		case spv::OpTypeRuntimeArray:
+		case spv::OpTypeStruct:
+		case spv::OpTypePointer:
+		case spv::OpTypeFunction:
+			DeclareType(insn);
+			break;
 
-			case spv::OpVariable:
+		case spv::OpVariable:
 			{
 				Type::ID typeId = insn.word(1);
 				Object::ID resultId = insn.word(2);
@@ -268,64 +269,64 @@
 
 				switch(storageClass)
 				{
-					case spv::StorageClassInput:
-					case spv::StorageClassOutput:
-						ProcessInterfaceVariable(object);
-						break;
+				case spv::StorageClassInput:
+				case spv::StorageClassOutput:
+					ProcessInterfaceVariable(object);
+					break;
 
-					case spv::StorageClassUniform:
-					case spv::StorageClassStorageBuffer:
-						object.kind = Object::Kind::DescriptorSet;
-						break;
+				case spv::StorageClassUniform:
+				case spv::StorageClassStorageBuffer:
+					object.kind = Object::Kind::DescriptorSet;
+					break;
 
-					case spv::StorageClassPushConstant:
-					case spv::StorageClassPrivate:
-					case spv::StorageClassFunction:
-					case spv::StorageClassUniformConstant:
-						break;  // Correctly handled.
+				case spv::StorageClassPushConstant:
+				case spv::StorageClassPrivate:
+				case spv::StorageClassFunction:
+				case spv::StorageClassUniformConstant:
+					break;  // Correctly handled.
 
-					case spv::StorageClassWorkgroup:
+				case spv::StorageClassWorkgroup:
 					{
 						auto &elTy = getType(getType(typeId).element);
 						auto sizeInBytes = elTy.componentCount * static_cast<uint32_t>(sizeof(float));
 						workgroupMemory.allocate(resultId, sizeInBytes);
 						object.kind = Object::Kind::Pointer;
-						break;
 					}
-					case spv::StorageClassAtomicCounter:
-					case spv::StorageClassImage:
-						UNSUPPORTED("StorageClass %d not yet supported", (int)storageClass);
-						break;
+					break;
+				case spv::StorageClassAtomicCounter:
+				case spv::StorageClassImage:
+					UNSUPPORTED("StorageClass %d not yet supported", (int)storageClass);
+					break;
 
-					case spv::StorageClassCrossWorkgroup:
-						UNSUPPORTED("SPIR-V OpenCL Execution Model (StorageClassCrossWorkgroup)");
-						break;
+				case spv::StorageClassCrossWorkgroup:
+					UNSUPPORTED("SPIR-V OpenCL Execution Model (StorageClassCrossWorkgroup)");
+					break;
 
-					case spv::StorageClassGeneric:
-						UNSUPPORTED("SPIR-V GenericPointer Capability (StorageClassGeneric)");
-						break;
+				case spv::StorageClassGeneric:
+					UNSUPPORTED("SPIR-V GenericPointer Capability (StorageClassGeneric)");
+					break;
 
-					default:
-						UNREACHABLE("Unexpected StorageClass %d", storageClass);  // See Appendix A of the Vulkan spec.
-						break;
+				default:
+					UNREACHABLE("Unexpected StorageClass %d", storageClass);  // See Appendix A of the Vulkan spec.
+					break;
 				}
-				break;
 			}
+			break;
 
-			case spv::OpConstant:
-			case spv::OpSpecConstant:
-				CreateConstant(insn).constantValue[0] = insn.word(3);
-				break;
-			case spv::OpConstantFalse:
-			case spv::OpSpecConstantFalse:
-				CreateConstant(insn).constantValue[0] = 0;  // Represent Boolean false as zero.
-				break;
-			case spv::OpConstantTrue:
-			case spv::OpSpecConstantTrue:
-				CreateConstant(insn).constantValue[0] = ~0u;  // Represent Boolean true as all bits set.
-				break;
-			case spv::OpConstantNull:
-			case spv::OpUndef:
+		case spv::OpConstant:
+		case spv::OpSpecConstant:
+			CreateConstant(insn).constantValue[0] = insn.word(3);
+			break;
+		case spv::OpConstantFalse:
+		case spv::OpSpecConstantFalse:
+			CreateConstant(insn).constantValue[0] = 0;  // Represent Boolean false as zero.
+			break;
+		case spv::OpConstantTrue:
+		case spv::OpSpecConstantTrue:
+			CreateConstant(insn).constantValue[0] = ~0u;  // Represent Boolean true as all bits set.
+			break;
+		case spv::OpConstantNull:
+		case spv::OpUndef:
 			{
 				// TODO: consider a real LLVM-level undef. For now, zero is a perfectly good value.
 				// OpConstantNull forms a constant of arbitrary type, all zeros.
@@ -335,10 +336,10 @@
 				{
 					object.constantValue[i] = 0;
 				}
-				break;
 			}
-			case spv::OpConstantComposite:
-			case spv::OpSpecConstantComposite:
+			break;
+		case spv::OpConstantComposite:
+		case spv::OpSpecConstantComposite:
 			{
 				auto &object = CreateConstant(insn);
 				auto offset = 0u;
@@ -370,54 +371,56 @@
 					modes.WorkgroupSizeY = object.constantValue[1];
 					modes.WorkgroupSizeZ = object.constantValue[2];
 				}
-				break;
 			}
-			case spv::OpSpecConstantOp:
-				EvalSpecConstantOp(insn);
-				break;
+			break;
+		case spv::OpSpecConstantOp:
+			EvalSpecConstantOp(insn);
+			break;
 
-			case spv::OpCapability:
+		case spv::OpCapability:
 			{
 				auto capability = static_cast<spv::Capability>(insn.word(1));
 				switch(capability)
 				{
-					case spv::CapabilityMatrix: capabilities.Matrix = true; break;
-					case spv::CapabilityShader: capabilities.Shader = true; break;
-					case spv::CapabilityStorageImageMultisample: capabilities.StorageImageMultisample = true; break;
-					case spv::CapabilityClipDistance: capabilities.ClipDistance = true; break;
-					case spv::CapabilityCullDistance: capabilities.CullDistance = true; break;
-					case spv::CapabilityImageCubeArray: capabilities.ImageCubeArray = true; break;
-					case spv::CapabilitySampleRateShading: capabilities.SampleRateShading = true; break;
-					case spv::CapabilityInputAttachment: capabilities.InputAttachment = true; break;
-					case spv::CapabilitySampled1D: capabilities.Sampled1D = true; break;
-					case spv::CapabilityImage1D: capabilities.Image1D = true; break;
-					case spv::CapabilitySampledBuffer: capabilities.SampledBuffer = true; break;
-					case spv::CapabilitySampledCubeArray: capabilities.SampledCubeArray = true; break;
-					case spv::CapabilityImageBuffer: capabilities.ImageBuffer = true; break;
-					case spv::CapabilityImageMSArray: capabilities.ImageMSArray = true; break;
-					case spv::CapabilityStorageImageExtendedFormats: capabilities.StorageImageExtendedFormats = true; break;
-					case spv::CapabilityImageQuery: capabilities.ImageQuery = true; break;
-					case spv::CapabilityDerivativeControl: capabilities.DerivativeControl = true; break;
-					case spv::CapabilityInterpolationFunction: capabilities.InterpolationFunction = true; break;
-					case spv::CapabilityGroupNonUniform: capabilities.GroupNonUniform = true; break;
-					case spv::CapabilityGroupNonUniformVote: capabilities.GroupNonUniformVote = true; break;
-					case spv::CapabilityGroupNonUniformArithmetic: capabilities.GroupNonUniformArithmetic = true; break;
-					case spv::CapabilityGroupNonUniformBallot: capabilities.GroupNonUniformBallot = true; break;
-					case spv::CapabilityGroupNonUniformShuffle: capabilities.GroupNonUniformShuffle = true; break;
-					case spv::CapabilityGroupNonUniformShuffleRelative: capabilities.GroupNonUniformShuffleRelative = true; break;
-					case spv::CapabilityDeviceGroup: capabilities.DeviceGroup = true; break;
-					case spv::CapabilityMultiView: capabilities.MultiView = true; break;
-					case spv::CapabilityStencilExportEXT: capabilities.StencilExportEXT = true; break;
-					default:
-						UNSUPPORTED("Unsupported capability %u", insn.word(1));
+				case spv::CapabilityMatrix: capabilities.Matrix = true; break;
+				case spv::CapabilityShader: capabilities.Shader = true; break;
+				case spv::CapabilityStorageImageMultisample: capabilities.StorageImageMultisample = true; break;
+				case spv::CapabilityClipDistance: capabilities.ClipDistance = true; break;
+				case spv::CapabilityCullDistance: capabilities.CullDistance = true; break;
+				case spv::CapabilityImageCubeArray: capabilities.ImageCubeArray = true; break;
+				case spv::CapabilitySampleRateShading: capabilities.SampleRateShading = true; break;
+				case spv::CapabilityInputAttachment: capabilities.InputAttachment = true; break;
+				case spv::CapabilitySampled1D: capabilities.Sampled1D = true; break;
+				case spv::CapabilityImage1D: capabilities.Image1D = true; break;
+				case spv::CapabilitySampledBuffer: capabilities.SampledBuffer = true; break;
+				case spv::CapabilitySampledCubeArray: capabilities.SampledCubeArray = true; break;
+				case spv::CapabilityImageBuffer: capabilities.ImageBuffer = true; break;
+				case spv::CapabilityImageMSArray: capabilities.ImageMSArray = true; break;
+				case spv::CapabilityStorageImageExtendedFormats: capabilities.StorageImageExtendedFormats = true; break;
+				case spv::CapabilityImageQuery: capabilities.ImageQuery = true; break;
+				case spv::CapabilityDerivativeControl: capabilities.DerivativeControl = true; break;
+				case spv::CapabilityInterpolationFunction: capabilities.InterpolationFunction = true; break;
+				case spv::CapabilityGroupNonUniform: capabilities.GroupNonUniform = true; break;
+				case spv::CapabilityGroupNonUniformVote: capabilities.GroupNonUniformVote = true; break;
+				case spv::CapabilityGroupNonUniformArithmetic: capabilities.GroupNonUniformArithmetic = true; break;
+				case spv::CapabilityGroupNonUniformBallot: capabilities.GroupNonUniformBallot = true; break;
+				case spv::CapabilityGroupNonUniformShuffle: capabilities.GroupNonUniformShuffle = true; break;
+				case spv::CapabilityGroupNonUniformShuffleRelative: capabilities.GroupNonUniformShuffleRelative = true; break;
+				case spv::CapabilityDeviceGroup: capabilities.DeviceGroup = true; break;
+				case spv::CapabilityMultiView: capabilities.MultiView = true; break;
+				case spv::CapabilityStencilExportEXT: capabilities.StencilExportEXT = true; break;
+				default:
+					UNSUPPORTED("Unsupported capability %u", insn.word(1));
 				}
-				break;  // Various capabilities will be declared, but none affect our code generation at this point.
+
+				// Various capabilities will be declared, but none affect our code generation at this point.
 			}
+			break;
 
-			case spv::OpMemoryModel:
-				break;  // Memory model does not affect our code generation until we decide to do Vulkan Memory Model support.
+		case spv::OpMemoryModel:
+			break;  // Memory model does not affect our code generation until we decide to do Vulkan Memory Model support.
 
-			case spv::OpFunction:
+		case spv::OpFunction:
 			{
 				auto functionId = Function::ID(insn.word(2));
 				ASSERT_MSG(currentFunction == 0, "Functions %d and %d overlap", currentFunction.value(), functionId.value());
@@ -435,14 +438,14 @@
 					}
 				}
 				ASSERT_MSG(function.entry != 0, "Function<%d> has no label", currentFunction.value());
-				break;
 			}
+			break;
 
-			case spv::OpFunctionEnd:
-				currentFunction = 0;
-				break;
+		case spv::OpFunctionEnd:
+			currentFunction = 0;
+			break;
 
-			case spv::OpExtInstImport:
+		case spv::OpExtInstImport:
 			{
 				static constexpr std::pair<const char *, Extension::Name> extensionsByName[] = {
 					{ "GLSL.std.450", Extension::GLSLstd450 },
@@ -468,50 +471,50 @@
 				}
 				extensionsByID.emplace(id, ext);
 				extensionsImported.emplace(ext.name);
-				break;
 			}
-			case spv::OpName:
-			case spv::OpMemberName:
-			case spv::OpSource:
-			case spv::OpSourceContinued:
-			case spv::OpSourceExtension:
-			case spv::OpLine:
-			case spv::OpNoLine:
-			case spv::OpModuleProcessed:
-				// No semantic impact
-				break;
+			break;
+		case spv::OpName:
+		case spv::OpMemberName:
+		case spv::OpSource:
+		case spv::OpSourceContinued:
+		case spv::OpSourceExtension:
+		case spv::OpLine:
+		case spv::OpNoLine:
+		case spv::OpModuleProcessed:
+			// No semantic impact
+			break;
 
-			case spv::OpString:
-				strings.emplace(insn.word(1), insn.string(2));
-				break;
+		case spv::OpString:
+			strings.emplace(insn.word(1), insn.string(2));
+			break;
 
-			case spv::OpFunctionParameter:
-				// These should have all been removed by preprocessing passes. If we see them here,
-				// our assumptions are wrong and we will probably generate wrong code.
-				UNREACHABLE("%s should have already been lowered.", OpcodeName(opcode));
-				break;
+		case spv::OpFunctionParameter:
+			// These should have all been removed by preprocessing passes. If we see them here,
+			// our assumptions are wrong and we will probably generate wrong code.
+			UNREACHABLE("%s should have already been lowered.", OpcodeName(opcode));
+			break;
 
-			case spv::OpFunctionCall:
-				// TODO(b/141246700): Add full support for spv::OpFunctionCall
-				break;
+		case spv::OpFunctionCall:
+			// TODO(b/141246700): Add full support for spv::OpFunctionCall
+			break;
 
-			case spv::OpFConvert:
-				UNSUPPORTED("SPIR-V Float16 or Float64 Capability (OpFConvert)");
-				break;
+		case spv::OpFConvert:
+			UNSUPPORTED("SPIR-V Float16 or Float64 Capability (OpFConvert)");
+			break;
 
-			case spv::OpSConvert:
-				UNSUPPORTED("SPIR-V Int16 or Int64 Capability (OpSConvert)");
-				break;
+		case spv::OpSConvert:
+			UNSUPPORTED("SPIR-V Int16 or Int64 Capability (OpSConvert)");
+			break;
 
-			case spv::OpUConvert:
-				UNSUPPORTED("SPIR-V Int16 or Int64 Capability (OpUConvert)");
-				break;
+		case spv::OpUConvert:
+			UNSUPPORTED("SPIR-V Int16 or Int64 Capability (OpUConvert)");
+			break;
 
-			case spv::OpLoad:
-			case spv::OpAccessChain:
-			case spv::OpInBoundsAccessChain:
-			case spv::OpSampledImage:
-			case spv::OpImage:
+		case spv::OpLoad:
+		case spv::OpAccessChain:
+		case spv::OpInBoundsAccessChain:
+		case spv::OpSampledImage:
+		case spv::OpImage:
 			{
 				// Propagate the descriptor decorations to the result.
 				Object::ID resultId = insn.word(2);
@@ -536,201 +539,201 @@
 			}
 			break;
 
-			case spv::OpCompositeConstruct:
-			case spv::OpCompositeInsert:
-			case spv::OpCompositeExtract:
-			case spv::OpVectorShuffle:
-			case spv::OpVectorTimesScalar:
-			case spv::OpMatrixTimesScalar:
-			case spv::OpMatrixTimesVector:
-			case spv::OpVectorTimesMatrix:
-			case spv::OpMatrixTimesMatrix:
-			case spv::OpOuterProduct:
-			case spv::OpTranspose:
-			case spv::OpVectorExtractDynamic:
-			case spv::OpVectorInsertDynamic:
-			// Unary ops
-			case spv::OpNot:
-			case spv::OpBitFieldInsert:
-			case spv::OpBitFieldSExtract:
-			case spv::OpBitFieldUExtract:
-			case spv::OpBitReverse:
-			case spv::OpBitCount:
-			case spv::OpSNegate:
-			case spv::OpFNegate:
-			case spv::OpLogicalNot:
-			case spv::OpQuantizeToF16:
-			// Binary ops
-			case spv::OpIAdd:
-			case spv::OpISub:
-			case spv::OpIMul:
-			case spv::OpSDiv:
-			case spv::OpUDiv:
-			case spv::OpFAdd:
-			case spv::OpFSub:
-			case spv::OpFMul:
-			case spv::OpFDiv:
-			case spv::OpFMod:
-			case spv::OpFRem:
-			case spv::OpFOrdEqual:
-			case spv::OpFUnordEqual:
-			case spv::OpFOrdNotEqual:
-			case spv::OpFUnordNotEqual:
-			case spv::OpFOrdLessThan:
-			case spv::OpFUnordLessThan:
-			case spv::OpFOrdGreaterThan:
-			case spv::OpFUnordGreaterThan:
-			case spv::OpFOrdLessThanEqual:
-			case spv::OpFUnordLessThanEqual:
-			case spv::OpFOrdGreaterThanEqual:
-			case spv::OpFUnordGreaterThanEqual:
-			case spv::OpSMod:
-			case spv::OpSRem:
-			case spv::OpUMod:
-			case spv::OpIEqual:
-			case spv::OpINotEqual:
-			case spv::OpUGreaterThan:
-			case spv::OpSGreaterThan:
-			case spv::OpUGreaterThanEqual:
-			case spv::OpSGreaterThanEqual:
-			case spv::OpULessThan:
-			case spv::OpSLessThan:
-			case spv::OpULessThanEqual:
-			case spv::OpSLessThanEqual:
-			case spv::OpShiftRightLogical:
-			case spv::OpShiftRightArithmetic:
-			case spv::OpShiftLeftLogical:
-			case spv::OpBitwiseOr:
-			case spv::OpBitwiseXor:
-			case spv::OpBitwiseAnd:
-			case spv::OpLogicalOr:
-			case spv::OpLogicalAnd:
-			case spv::OpLogicalEqual:
-			case spv::OpLogicalNotEqual:
-			case spv::OpUMulExtended:
-			case spv::OpSMulExtended:
-			case spv::OpIAddCarry:
-			case spv::OpISubBorrow:
-			case spv::OpDot:
-			case spv::OpConvertFToU:
-			case spv::OpConvertFToS:
-			case spv::OpConvertSToF:
-			case spv::OpConvertUToF:
-			case spv::OpBitcast:
-			case spv::OpSelect:
-			case spv::OpIsInf:
-			case spv::OpIsNan:
-			case spv::OpAny:
-			case spv::OpAll:
-			case spv::OpDPdx:
-			case spv::OpDPdxCoarse:
-			case spv::OpDPdy:
-			case spv::OpDPdyCoarse:
-			case spv::OpFwidth:
-			case spv::OpFwidthCoarse:
-			case spv::OpDPdxFine:
-			case spv::OpDPdyFine:
-			case spv::OpFwidthFine:
-			case spv::OpAtomicLoad:
-			case spv::OpAtomicIAdd:
-			case spv::OpAtomicISub:
-			case spv::OpAtomicSMin:
-			case spv::OpAtomicSMax:
-			case spv::OpAtomicUMin:
-			case spv::OpAtomicUMax:
-			case spv::OpAtomicAnd:
-			case spv::OpAtomicOr:
-			case spv::OpAtomicXor:
-			case spv::OpAtomicIIncrement:
-			case spv::OpAtomicIDecrement:
-			case spv::OpAtomicExchange:
-			case spv::OpAtomicCompareExchange:
-			case spv::OpPhi:
-			case spv::OpImageSampleImplicitLod:
-			case spv::OpImageSampleExplicitLod:
-			case spv::OpImageSampleDrefImplicitLod:
-			case spv::OpImageSampleDrefExplicitLod:
-			case spv::OpImageSampleProjImplicitLod:
-			case spv::OpImageSampleProjExplicitLod:
-			case spv::OpImageSampleProjDrefImplicitLod:
-			case spv::OpImageSampleProjDrefExplicitLod:
-			case spv::OpImageGather:
-			case spv::OpImageDrefGather:
-			case spv::OpImageFetch:
-			case spv::OpImageQuerySizeLod:
-			case spv::OpImageQuerySize:
-			case spv::OpImageQueryLod:
-			case spv::OpImageQueryLevels:
-			case spv::OpImageQuerySamples:
-			case spv::OpImageRead:
-			case spv::OpImageTexelPointer:
-			case spv::OpGroupNonUniformElect:
-			case spv::OpGroupNonUniformAll:
-			case spv::OpGroupNonUniformAny:
-			case spv::OpGroupNonUniformAllEqual:
-			case spv::OpGroupNonUniformBroadcast:
-			case spv::OpGroupNonUniformBroadcastFirst:
-			case spv::OpGroupNonUniformBallot:
-			case spv::OpGroupNonUniformInverseBallot:
-			case spv::OpGroupNonUniformBallotBitExtract:
-			case spv::OpGroupNonUniformBallotBitCount:
-			case spv::OpGroupNonUniformBallotFindLSB:
-			case spv::OpGroupNonUniformBallotFindMSB:
-			case spv::OpGroupNonUniformShuffle:
-			case spv::OpGroupNonUniformShuffleXor:
-			case spv::OpGroupNonUniformShuffleUp:
-			case spv::OpGroupNonUniformShuffleDown:
-			case spv::OpGroupNonUniformIAdd:
-			case spv::OpGroupNonUniformFAdd:
-			case spv::OpGroupNonUniformIMul:
-			case spv::OpGroupNonUniformFMul:
-			case spv::OpGroupNonUniformSMin:
-			case spv::OpGroupNonUniformUMin:
-			case spv::OpGroupNonUniformFMin:
-			case spv::OpGroupNonUniformSMax:
-			case spv::OpGroupNonUniformUMax:
-			case spv::OpGroupNonUniformFMax:
-			case spv::OpGroupNonUniformBitwiseAnd:
-			case spv::OpGroupNonUniformBitwiseOr:
-			case spv::OpGroupNonUniformBitwiseXor:
-			case spv::OpGroupNonUniformLogicalAnd:
-			case spv::OpGroupNonUniformLogicalOr:
-			case spv::OpGroupNonUniformLogicalXor:
-			case spv::OpCopyObject:
-			case spv::OpCopyLogical:
-			case spv::OpArrayLength:
-				// Instructions that yield an intermediate value or divergent pointer
+		case spv::OpCompositeConstruct:
+		case spv::OpCompositeInsert:
+		case spv::OpCompositeExtract:
+		case spv::OpVectorShuffle:
+		case spv::OpVectorTimesScalar:
+		case spv::OpMatrixTimesScalar:
+		case spv::OpMatrixTimesVector:
+		case spv::OpVectorTimesMatrix:
+		case spv::OpMatrixTimesMatrix:
+		case spv::OpOuterProduct:
+		case spv::OpTranspose:
+		case spv::OpVectorExtractDynamic:
+		case spv::OpVectorInsertDynamic:
+		// Unary ops
+		case spv::OpNot:
+		case spv::OpBitFieldInsert:
+		case spv::OpBitFieldSExtract:
+		case spv::OpBitFieldUExtract:
+		case spv::OpBitReverse:
+		case spv::OpBitCount:
+		case spv::OpSNegate:
+		case spv::OpFNegate:
+		case spv::OpLogicalNot:
+		case spv::OpQuantizeToF16:
+		// Binary ops
+		case spv::OpIAdd:
+		case spv::OpISub:
+		case spv::OpIMul:
+		case spv::OpSDiv:
+		case spv::OpUDiv:
+		case spv::OpFAdd:
+		case spv::OpFSub:
+		case spv::OpFMul:
+		case spv::OpFDiv:
+		case spv::OpFMod:
+		case spv::OpFRem:
+		case spv::OpFOrdEqual:
+		case spv::OpFUnordEqual:
+		case spv::OpFOrdNotEqual:
+		case spv::OpFUnordNotEqual:
+		case spv::OpFOrdLessThan:
+		case spv::OpFUnordLessThan:
+		case spv::OpFOrdGreaterThan:
+		case spv::OpFUnordGreaterThan:
+		case spv::OpFOrdLessThanEqual:
+		case spv::OpFUnordLessThanEqual:
+		case spv::OpFOrdGreaterThanEqual:
+		case spv::OpFUnordGreaterThanEqual:
+		case spv::OpSMod:
+		case spv::OpSRem:
+		case spv::OpUMod:
+		case spv::OpIEqual:
+		case spv::OpINotEqual:
+		case spv::OpUGreaterThan:
+		case spv::OpSGreaterThan:
+		case spv::OpUGreaterThanEqual:
+		case spv::OpSGreaterThanEqual:
+		case spv::OpULessThan:
+		case spv::OpSLessThan:
+		case spv::OpULessThanEqual:
+		case spv::OpSLessThanEqual:
+		case spv::OpShiftRightLogical:
+		case spv::OpShiftRightArithmetic:
+		case spv::OpShiftLeftLogical:
+		case spv::OpBitwiseOr:
+		case spv::OpBitwiseXor:
+		case spv::OpBitwiseAnd:
+		case spv::OpLogicalOr:
+		case spv::OpLogicalAnd:
+		case spv::OpLogicalEqual:
+		case spv::OpLogicalNotEqual:
+		case spv::OpUMulExtended:
+		case spv::OpSMulExtended:
+		case spv::OpIAddCarry:
+		case spv::OpISubBorrow:
+		case spv::OpDot:
+		case spv::OpConvertFToU:
+		case spv::OpConvertFToS:
+		case spv::OpConvertSToF:
+		case spv::OpConvertUToF:
+		case spv::OpBitcast:
+		case spv::OpSelect:
+		case spv::OpIsInf:
+		case spv::OpIsNan:
+		case spv::OpAny:
+		case spv::OpAll:
+		case spv::OpDPdx:
+		case spv::OpDPdxCoarse:
+		case spv::OpDPdy:
+		case spv::OpDPdyCoarse:
+		case spv::OpFwidth:
+		case spv::OpFwidthCoarse:
+		case spv::OpDPdxFine:
+		case spv::OpDPdyFine:
+		case spv::OpFwidthFine:
+		case spv::OpAtomicLoad:
+		case spv::OpAtomicIAdd:
+		case spv::OpAtomicISub:
+		case spv::OpAtomicSMin:
+		case spv::OpAtomicSMax:
+		case spv::OpAtomicUMin:
+		case spv::OpAtomicUMax:
+		case spv::OpAtomicAnd:
+		case spv::OpAtomicOr:
+		case spv::OpAtomicXor:
+		case spv::OpAtomicIIncrement:
+		case spv::OpAtomicIDecrement:
+		case spv::OpAtomicExchange:
+		case spv::OpAtomicCompareExchange:
+		case spv::OpPhi:
+		case spv::OpImageSampleImplicitLod:
+		case spv::OpImageSampleExplicitLod:
+		case spv::OpImageSampleDrefImplicitLod:
+		case spv::OpImageSampleDrefExplicitLod:
+		case spv::OpImageSampleProjImplicitLod:
+		case spv::OpImageSampleProjExplicitLod:
+		case spv::OpImageSampleProjDrefImplicitLod:
+		case spv::OpImageSampleProjDrefExplicitLod:
+		case spv::OpImageGather:
+		case spv::OpImageDrefGather:
+		case spv::OpImageFetch:
+		case spv::OpImageQuerySizeLod:
+		case spv::OpImageQuerySize:
+		case spv::OpImageQueryLod:
+		case spv::OpImageQueryLevels:
+		case spv::OpImageQuerySamples:
+		case spv::OpImageRead:
+		case spv::OpImageTexelPointer:
+		case spv::OpGroupNonUniformElect:
+		case spv::OpGroupNonUniformAll:
+		case spv::OpGroupNonUniformAny:
+		case spv::OpGroupNonUniformAllEqual:
+		case spv::OpGroupNonUniformBroadcast:
+		case spv::OpGroupNonUniformBroadcastFirst:
+		case spv::OpGroupNonUniformBallot:
+		case spv::OpGroupNonUniformInverseBallot:
+		case spv::OpGroupNonUniformBallotBitExtract:
+		case spv::OpGroupNonUniformBallotBitCount:
+		case spv::OpGroupNonUniformBallotFindLSB:
+		case spv::OpGroupNonUniformBallotFindMSB:
+		case spv::OpGroupNonUniformShuffle:
+		case spv::OpGroupNonUniformShuffleXor:
+		case spv::OpGroupNonUniformShuffleUp:
+		case spv::OpGroupNonUniformShuffleDown:
+		case spv::OpGroupNonUniformIAdd:
+		case spv::OpGroupNonUniformFAdd:
+		case spv::OpGroupNonUniformIMul:
+		case spv::OpGroupNonUniformFMul:
+		case spv::OpGroupNonUniformSMin:
+		case spv::OpGroupNonUniformUMin:
+		case spv::OpGroupNonUniformFMin:
+		case spv::OpGroupNonUniformSMax:
+		case spv::OpGroupNonUniformUMax:
+		case spv::OpGroupNonUniformFMax:
+		case spv::OpGroupNonUniformBitwiseAnd:
+		case spv::OpGroupNonUniformBitwiseOr:
+		case spv::OpGroupNonUniformBitwiseXor:
+		case spv::OpGroupNonUniformLogicalAnd:
+		case spv::OpGroupNonUniformLogicalOr:
+		case spv::OpGroupNonUniformLogicalXor:
+		case spv::OpCopyObject:
+		case spv::OpCopyLogical:
+		case spv::OpArrayLength:
+			// Instructions that yield an intermediate value or divergent pointer
+			DefineResult(insn);
+			break;
+
+		case spv::OpExtInst:
+			switch(getExtension(insn.word(3)).name)
+			{
+			case Extension::GLSLstd450:
 				DefineResult(insn);
 				break;
-
-			case spv::OpExtInst:
-				switch(getExtension(insn.word(3)).name)
-				{
-					case Extension::GLSLstd450:
-						DefineResult(insn);
-						break;
-					case Extension::OpenCLDebugInfo100:
-						DefineOpenCLDebugInfo100(insn);
-						break;
-					default:
-						UNREACHABLE("Unexpected Extension name %d", int(getExtension(insn.word(3)).name));
-						break;
-				}
+			case Extension::OpenCLDebugInfo100:
+				DefineOpenCLDebugInfo100(insn);
 				break;
-
-			case spv::OpStore:
-			case spv::OpAtomicStore:
-			case spv::OpImageWrite:
-			case spv::OpCopyMemory:
-			case spv::OpMemoryBarrier:
-				// Don't need to do anything during analysis pass
+			default:
+				UNREACHABLE("Unexpected Extension name %d", int(getExtension(insn.word(3)).name));
 				break;
+			}
+			break;
 
-			case spv::OpControlBarrier:
-				modes.ContainsControlBarriers = true;
-				break;
+		case spv::OpStore:
+		case spv::OpAtomicStore:
+		case spv::OpImageWrite:
+		case spv::OpCopyMemory:
+		case spv::OpMemoryBarrier:
+			// Don't need to do anything during analysis pass
+			break;
 
-			case spv::OpExtension:
+		case spv::OpControlBarrier:
+			modes.ContainsControlBarriers = true;
+			break;
+
+		case spv::OpExtension:
 			{
 				auto ext = insn.string(1);
 				// Part of core SPIR-V 1.3. Vulkan 1.1 implementations must also accept the pre-1.3
@@ -744,11 +747,11 @@
 				if(!strcmp(ext, "SPV_EXT_shader_stencil_export")) break;
 				if(!strcmp(ext, "SPV_KHR_float_controls")) break;
 				UNSUPPORTED("SPIR-V Extension: %s", ext);
-				break;
 			}
+			break;
 
-			default:
-				UNSUPPORTED("%s", OpcodeName(opcode));
+		default:
+			UNSUPPORTED("%s", OpcodeName(opcode));
 		}
 	}
 
@@ -786,7 +789,7 @@
 	// member. All members of such a structure are builtins.
 	switch(insn.opcode())
 	{
-		case spv::OpTypeStruct:
+	case spv::OpTypeStruct:
 		{
 			auto d = memberDecorations.find(resultId);
 			if(d != memberDecorations.end())
@@ -800,27 +803,27 @@
 					}
 				}
 			}
-			break;
 		}
-		case spv::OpTypePointer:
+		break;
+	case spv::OpTypePointer:
 		{
 			Type::ID elementTypeId = insn.word(3);
 			type.element = elementTypeId;
 			type.isBuiltInBlock = getType(elementTypeId).isBuiltInBlock;
 			type.storageClass = static_cast<spv::StorageClass>(insn.word(2));
-			break;
 		}
-		case spv::OpTypeVector:
-		case spv::OpTypeMatrix:
-		case spv::OpTypeArray:
-		case spv::OpTypeRuntimeArray:
+		break;
+	case spv::OpTypeVector:
+	case spv::OpTypeMatrix:
+	case spv::OpTypeArray:
+	case spv::OpTypeRuntimeArray:
 		{
 			Type::ID elementTypeId = insn.word(2);
 			type.element = elementTypeId;
-			break;
 		}
-		default:
-			break;
+		break;
+	default:
+		break;
 	}
 }
 
@@ -930,34 +933,34 @@
 	auto mode = static_cast<spv::ExecutionMode>(insn.word(2));
 	switch(mode)
 	{
-		case spv::ExecutionModeEarlyFragmentTests:
-			modes.EarlyFragmentTests = true;
-			break;
-		case spv::ExecutionModeDepthReplacing:
-			modes.DepthReplacing = true;
-			break;
-		case spv::ExecutionModeDepthGreater:
-			// TODO(b/177915067): Can be used to optimize depth test, currently unused.
-			modes.DepthGreater = true;
-			break;
-		case spv::ExecutionModeDepthLess:
-			// TODO(b/177915067): Can be used to optimize depth test, currently unused.
-			modes.DepthLess = true;
-			break;
-		case spv::ExecutionModeDepthUnchanged:
-			// TODO(b/177915067): Can be used to optimize depth test, currently unused.
-			modes.DepthUnchanged = true;
-			break;
-		case spv::ExecutionModeLocalSize:
-			modes.WorkgroupSizeX = insn.word(3);
-			modes.WorkgroupSizeY = insn.word(4);
-			modes.WorkgroupSizeZ = insn.word(5);
-			break;
-		case spv::ExecutionModeOriginUpperLeft:
-			// This is always the case for a Vulkan shader. Do nothing.
-			break;
-		default:
-			UNREACHABLE("Execution mode: %d", int(mode));
+	case spv::ExecutionModeEarlyFragmentTests:
+		modes.EarlyFragmentTests = true;
+		break;
+	case spv::ExecutionModeDepthReplacing:
+		modes.DepthReplacing = true;
+		break;
+	case spv::ExecutionModeDepthGreater:
+		// TODO(b/177915067): Can be used to optimize depth test, currently unused.
+		modes.DepthGreater = true;
+		break;
+	case spv::ExecutionModeDepthLess:
+		// TODO(b/177915067): Can be used to optimize depth test, currently unused.
+		modes.DepthLess = true;
+		break;
+	case spv::ExecutionModeDepthUnchanged:
+		// TODO(b/177915067): Can be used to optimize depth test, currently unused.
+		modes.DepthUnchanged = true;
+		break;
+	case spv::ExecutionModeLocalSize:
+		modes.WorkgroupSizeX = insn.word(3);
+		modes.WorkgroupSizeY = insn.word(4);
+		modes.WorkgroupSizeZ = insn.word(5);
+		break;
+	case spv::ExecutionModeOriginUpperLeft:
+		// This is always the case for a Vulkan shader. Do nothing.
+		break;
+	default:
+		UNREACHABLE("Execution mode: %d", int(mode));
 	}
 }
 
@@ -968,37 +971,37 @@
 	// already been described (and so their sizes determined)
 	switch(insn.opcode())
 	{
-		case spv::OpTypeVoid:
-		case spv::OpTypeSampler:
-		case spv::OpTypeImage:
-		case spv::OpTypeSampledImage:
-		case spv::OpTypeFunction:
-		case spv::OpTypeRuntimeArray:
-			// Objects that don't consume any space.
-			// Descriptor-backed objects currently only need exist at compile-time.
-			// Runtime arrays don't appear in places where their size would be interesting
-			return 0;
+	case spv::OpTypeVoid:
+	case spv::OpTypeSampler:
+	case spv::OpTypeImage:
+	case spv::OpTypeSampledImage:
+	case spv::OpTypeFunction:
+	case spv::OpTypeRuntimeArray:
+		// Objects that don't consume any space.
+		// Descriptor-backed objects currently only need exist at compile-time.
+		// Runtime arrays don't appear in places where their size would be interesting
+		return 0;
 
-		case spv::OpTypeBool:
-		case spv::OpTypeFloat:
-		case spv::OpTypeInt:
-			// All the fundamental types are 1 component. If we ever add support for 8/16/64-bit components,
-			// we might need to change this, but only 32 bit components are required for Vulkan 1.1.
-			return 1;
+	case spv::OpTypeBool:
+	case spv::OpTypeFloat:
+	case spv::OpTypeInt:
+		// All the fundamental types are 1 component. If we ever add support for 8/16/64-bit components,
+		// we might need to change this, but only 32 bit components are required for Vulkan 1.1.
+		return 1;
 
-		case spv::OpTypeVector:
-		case spv::OpTypeMatrix:
-			// Vectors and matrices both consume element count * element size.
-			return getType(insn.word(2)).componentCount * insn.word(3);
+	case spv::OpTypeVector:
+	case spv::OpTypeMatrix:
+		// Vectors and matrices both consume element count * element size.
+		return getType(insn.word(2)).componentCount * insn.word(3);
 
-		case spv::OpTypeArray:
+	case spv::OpTypeArray:
 		{
 			// Element count * element size. Array sizes come from constant ids.
 			auto arraySize = GetConstScalarInt(insn.word(3));
 			return getType(insn.word(2)).componentCount * arraySize;
 		}
 
-		case spv::OpTypeStruct:
+	case spv::OpTypeStruct:
 		{
 			uint32_t size = 0;
 			for(uint32_t i = 2u; i < insn.wordCount(); i++)
@@ -1008,14 +1011,14 @@
 			return size;
 		}
 
-		case spv::OpTypePointer:
-			// Runtime representation of a pointer is a per-lane index.
-			// Note: clients are expected to look through the pointer if they want the pointee size instead.
-			return 1;
+	case spv::OpTypePointer:
+		// Runtime representation of a pointer is a per-lane index.
+		// Note: clients are expected to look through the pointer if they want the pointee size instead.
+		return 1;
 
-		default:
-			UNREACHABLE("%s", OpcodeName(insn.opcode()));
-			return 0;
+	default:
+		UNREACHABLE("%s", OpcodeName(insn.opcode()));
+		return 0;
 	}
 }
 
@@ -1038,32 +1041,32 @@
 	auto const &obj = getType(id);
 	switch(obj.opcode())
 	{
-		case spv::OpTypePointer:
-			return VisitInterfaceInner(obj.definition.word(3), d, f);
-		case spv::OpTypeMatrix:
-			for(auto i = 0u; i < obj.definition.word(3); i++, d.Location++)
-			{
-				// consumes same components of N consecutive locations
-				VisitInterfaceInner(obj.definition.word(2), d, f);
-			}
-			return d.Location;
-		case spv::OpTypeVector:
-			for(auto i = 0u; i < obj.definition.word(3); i++, d.Component++)
-			{
-				// consumes N consecutive components in the same location
-				VisitInterfaceInner(obj.definition.word(2), d, f);
-			}
-			return d.Location + 1;
-		case spv::OpTypeFloat:
-			f(d, ATTRIBTYPE_FLOAT);
-			return d.Location + 1;
-		case spv::OpTypeInt:
-			f(d, obj.definition.word(3) ? ATTRIBTYPE_INT : ATTRIBTYPE_UINT);
-			return d.Location + 1;
-		case spv::OpTypeBool:
-			f(d, ATTRIBTYPE_UINT);
-			return d.Location + 1;
-		case spv::OpTypeStruct:
+	case spv::OpTypePointer:
+		return VisitInterfaceInner(obj.definition.word(3), d, f);
+	case spv::OpTypeMatrix:
+		for(auto i = 0u; i < obj.definition.word(3); i++, d.Location++)
+		{
+			// consumes same components of N consecutive locations
+			VisitInterfaceInner(obj.definition.word(2), d, f);
+		}
+		return d.Location;
+	case spv::OpTypeVector:
+		for(auto i = 0u; i < obj.definition.word(3); i++, d.Component++)
+		{
+			// consumes N consecutive components in the same location
+			VisitInterfaceInner(obj.definition.word(2), d, f);
+		}
+		return d.Location + 1;
+	case spv::OpTypeFloat:
+		f(d, ATTRIBTYPE_FLOAT);
+		return d.Location + 1;
+	case spv::OpTypeInt:
+		f(d, obj.definition.word(3) ? ATTRIBTYPE_INT : ATTRIBTYPE_UINT);
+		return d.Location + 1;
+	case spv::OpTypeBool:
+		f(d, ATTRIBTYPE_UINT);
+		return d.Location + 1;
+	case spv::OpTypeStruct:
 		{
 			// iterate over members, which may themselves have Location/Component decorations
 			for(auto i = 0u; i < obj.definition.wordCount() - 2; i++)
@@ -1075,7 +1078,7 @@
 			}
 			return d.Location;
 		}
-		case spv::OpTypeArray:
+	case spv::OpTypeArray:
 		{
 			auto arraySize = GetConstScalarInt(obj.definition.word(3));
 			for(auto i = 0u; i < arraySize; i++)
@@ -1084,9 +1087,9 @@
 			}
 			return d.Location;
 		}
-		default:
-			// Intentionally partial; most opcodes do not participate in type hierarchies
-			return 0;
+	default:
+		// Intentionally partial; most opcodes do not participate in type hierarchies
+		return 0;
 	}
 }
 
@@ -1114,30 +1117,30 @@
 		auto &type = getType(typeId);
 		switch(type.opcode())
 		{
-			case spv::OpTypeStruct:
+		case spv::OpTypeStruct:
 			{
 				int memberIndex = GetConstScalarInt(indexIds[i]);
 				ApplyDecorationsForIdMember(d, typeId, memberIndex);
 				typeId = type.definition.word(2u + memberIndex);
-				break;
 			}
-			case spv::OpTypeArray:
-			case spv::OpTypeRuntimeArray:
-				if(dd->InputAttachmentIndex >= 0)
-				{
-					dd->InputAttachmentIndex += GetConstScalarInt(indexIds[i]);
-				}
-				typeId = type.element;
-				break;
-			case spv::OpTypeVector:
-				typeId = type.element;
-				break;
-			case spv::OpTypeMatrix:
-				typeId = type.element;
-				d->InsideMatrix = true;
-				break;
-			default:
-				UNREACHABLE("%s", OpcodeName(type.definition.opcode()));
+			break;
+		case spv::OpTypeArray:
+		case spv::OpTypeRuntimeArray:
+			if(dd->InputAttachmentIndex >= 0)
+			{
+				dd->InputAttachmentIndex += GetConstScalarInt(indexIds[i]);
+			}
+			typeId = type.element;
+			break;
+		case spv::OpTypeVector:
+			typeId = type.element;
+			break;
+		case spv::OpTypeMatrix:
+			typeId = type.element;
+			d->InsideMatrix = true;
+			break;
+		default:
+			UNREACHABLE("%s", OpcodeName(type.definition.opcode()));
 		}
 	}
 }
@@ -1186,17 +1189,17 @@
 
 		switch(type.definition.opcode())
 		{
-			case spv::OpTypeStruct:
+		case spv::OpTypeStruct:
 			{
 				int memberIndex = GetConstScalarInt(indexIds[i]);
 				ApplyDecorationsForIdMember(&d, typeId, memberIndex);
 				ASSERT(d.HasOffset);
 				constantOffset += d.Offset;
 				typeId = type.definition.word(2u + memberIndex);
-				break;
 			}
-			case spv::OpTypeArray:
-			case spv::OpTypeRuntimeArray:
+			break;
+		case spv::OpTypeArray:
+		case spv::OpTypeRuntimeArray:
 			{
 				// TODO: b/127950082: Check bounds.
 				ASSERT(d.HasArrayStride);
@@ -1210,9 +1213,9 @@
 					ptr += SIMD::Int(d.ArrayStride) * state->getIntermediate(indexIds[i]).Int(0);
 				}
 				typeId = type.element;
-				break;
 			}
-			case spv::OpTypeMatrix:
+			break;
+		case spv::OpTypeMatrix:
 			{
 				// TODO: b/127950082: Check bounds.
 				ASSERT(d.HasMatrixStride);
@@ -1228,9 +1231,9 @@
 					ptr += SIMD::Int(columnStride) * state->getIntermediate(indexIds[i]).Int(0);
 				}
 				typeId = type.element;
-				break;
 			}
-			case spv::OpTypeVector:
+			break;
+		case spv::OpTypeVector:
 			{
 				auto elemStride = (d.InsideMatrix && d.HasRowMajor && d.RowMajor) ? d.MatrixStride : static_cast<int32_t>(sizeof(float));
 				auto &obj = getObject(indexIds[i]);
@@ -1243,10 +1246,10 @@
 					ptr += SIMD::Int(elemStride) * state->getIntermediate(indexIds[i]).Int(0);
 				}
 				typeId = type.element;
-				break;
 			}
-			default:
-				UNREACHABLE("%s", OpcodeName(type.definition.opcode()));
+			break;
+		default:
+			UNREACHABLE("%s", OpcodeName(type.definition.opcode()));
 		}
 	}
 
@@ -1270,7 +1273,7 @@
 		auto &type = getType(typeId);
 		switch(type.opcode())
 		{
-			case spv::OpTypeStruct:
+		case spv::OpTypeStruct:
 			{
 				int memberIndex = GetConstScalarInt(indexIds[i]);
 				int offsetIntoStruct = 0;
@@ -1281,13 +1284,13 @@
 				}
 				constantOffset += offsetIntoStruct;
 				typeId = type.definition.word(2u + memberIndex);
-				break;
 			}
+			break;
 
-			case spv::OpTypeVector:
-			case spv::OpTypeMatrix:
-			case spv::OpTypeArray:
-			case spv::OpTypeRuntimeArray:
+		case spv::OpTypeVector:
+		case spv::OpTypeMatrix:
+		case spv::OpTypeArray:
+		case spv::OpTypeRuntimeArray:
 			{
 				// TODO(b/127950082): Check bounds.
 				if(getType(baseObject).storageClass == spv::StorageClassUniformConstant)
@@ -1323,11 +1326,11 @@
 					}
 				}
 				typeId = type.element;
-				break;
 			}
+			break;
 
-			default:
-				UNREACHABLE("%s", OpcodeName(type.opcode()));
+		default:
+			UNREACHABLE("%s", OpcodeName(type.opcode()));
 		}
 	}
 
@@ -1347,7 +1350,7 @@
 		auto &type = getType(typeId);
 		switch(type.opcode())
 		{
-			case spv::OpTypeStruct:
+		case spv::OpTypeStruct:
 			{
 				int memberIndex = indexes[i];
 				int offsetIntoStruct = 0;
@@ -1358,22 +1361,22 @@
 				}
 				componentOffset += offsetIntoStruct;
 				typeId = type.definition.word(2u + memberIndex);
-				break;
 			}
+			break;
 
-			case spv::OpTypeVector:
-			case spv::OpTypeMatrix:
-			case spv::OpTypeArray:
+		case spv::OpTypeVector:
+		case spv::OpTypeMatrix:
+		case spv::OpTypeArray:
 			{
 				auto elementType = type.definition.word(2);
 				auto stride = getType(elementType).componentCount;
 				componentOffset += stride * indexes[i];
 				typeId = elementType;
-				break;
 			}
+			break;
 
-			default:
-				UNREACHABLE("%s", OpcodeName(type.opcode()));
+		default:
+			UNREACHABLE("%s", OpcodeName(type.opcode()));
 		}
 	}
 
@@ -1384,58 +1387,58 @@
 {
 	switch(decoration)
 	{
-		case spv::DecorationLocation:
-			HasLocation = true;
-			Location = static_cast<int32_t>(arg);
-			break;
-		case spv::DecorationComponent:
-			HasComponent = true;
-			Component = arg;
-			break;
-		case spv::DecorationBuiltIn:
-			HasBuiltIn = true;
-			BuiltIn = static_cast<spv::BuiltIn>(arg);
-			break;
-		case spv::DecorationFlat:
-			Flat = true;
-			break;
-		case spv::DecorationNoPerspective:
-			NoPerspective = true;
-			break;
-		case spv::DecorationCentroid:
-			Centroid = true;
-			break;
-		case spv::DecorationBlock:
-			Block = true;
-			break;
-		case spv::DecorationBufferBlock:
-			BufferBlock = true;
-			break;
-		case spv::DecorationOffset:
-			HasOffset = true;
-			Offset = static_cast<int32_t>(arg);
-			break;
-		case spv::DecorationArrayStride:
-			HasArrayStride = true;
-			ArrayStride = static_cast<int32_t>(arg);
-			break;
-		case spv::DecorationMatrixStride:
-			HasMatrixStride = true;
-			MatrixStride = static_cast<int32_t>(arg);
-			break;
-		case spv::DecorationRelaxedPrecision:
-			RelaxedPrecision = true;
-			break;
-		case spv::DecorationRowMajor:
-			HasRowMajor = true;
-			RowMajor = true;
-			break;
-		case spv::DecorationColMajor:
-			HasRowMajor = true;
-			RowMajor = false;
-		default:
-			// Intentionally partial, there are many decorations we just don't care about.
-			break;
+	case spv::DecorationLocation:
+		HasLocation = true;
+		Location = static_cast<int32_t>(arg);
+		break;
+	case spv::DecorationComponent:
+		HasComponent = true;
+		Component = arg;
+		break;
+	case spv::DecorationBuiltIn:
+		HasBuiltIn = true;
+		BuiltIn = static_cast<spv::BuiltIn>(arg);
+		break;
+	case spv::DecorationFlat:
+		Flat = true;
+		break;
+	case spv::DecorationNoPerspective:
+		NoPerspective = true;
+		break;
+	case spv::DecorationCentroid:
+		Centroid = true;
+		break;
+	case spv::DecorationBlock:
+		Block = true;
+		break;
+	case spv::DecorationBufferBlock:
+		BufferBlock = true;
+		break;
+	case spv::DecorationOffset:
+		HasOffset = true;
+		Offset = static_cast<int32_t>(arg);
+		break;
+	case spv::DecorationArrayStride:
+		HasArrayStride = true;
+		ArrayStride = static_cast<int32_t>(arg);
+		break;
+	case spv::DecorationMatrixStride:
+		HasMatrixStride = true;
+		MatrixStride = static_cast<int32_t>(arg);
+		break;
+	case spv::DecorationRelaxedPrecision:
+		RelaxedPrecision = true;
+		break;
+	case spv::DecorationRowMajor:
+		HasRowMajor = true;
+		RowMajor = true;
+		break;
+	case spv::DecorationColMajor:
+		HasRowMajor = true;
+		RowMajor = false;
+	default:
+		// Intentionally partial, there are many decorations we just don't care about.
+		break;
 	}
 }
 
@@ -1535,15 +1538,15 @@
 
 	switch(getType(typeId).opcode())
 	{
-		case spv::OpTypePointer:
-		case spv::OpTypeImage:
-		case spv::OpTypeSampledImage:
-		case spv::OpTypeSampler:
-			object.kind = Object::Kind::Pointer;
-			break;
+	case spv::OpTypePointer:
+	case spv::OpTypeImage:
+	case spv::OpTypeSampledImage:
+	case spv::OpTypeSampler:
+		object.kind = Object::Kind::Pointer;
+		break;
 
-		default:
-			object.kind = Object::Kind::Intermediate;
+	default:
+		object.kind = Object::Kind::Intermediate;
 	}
 
 	object.definition = insn;
@@ -1554,29 +1557,29 @@
 {
 	switch(storageClass)
 	{
-		case spv::StorageClassUniform:
-		case spv::StorageClassStorageBuffer:
-			// Buffer resource access. robustBufferAccess feature applies.
+	case spv::StorageClassUniform:
+	case spv::StorageClassStorageBuffer:
+		// Buffer resource access. robustBufferAccess feature applies.
+		return robustBufferAccess ? OutOfBoundsBehavior::RobustBufferAccess
+		                          : OutOfBoundsBehavior::UndefinedBehavior;
+
+	case spv::StorageClassImage:
+		// VK_EXT_image_robustness requires nullifying out-of-bounds accesses.
+		// TODO(b/162327166): Only perform bounds checks when VK_EXT_image_robustness is enabled.
+		return OutOfBoundsBehavior::Nullify;
+
+	case spv::StorageClassInput:
+		if(executionModel == spv::ExecutionModelVertex)
+		{
+			// Vertex attributes follow robustBufferAccess rules.
 			return robustBufferAccess ? OutOfBoundsBehavior::RobustBufferAccess
 			                          : OutOfBoundsBehavior::UndefinedBehavior;
-
-		case spv::StorageClassImage:
-			// VK_EXT_image_robustness requires nullifying out-of-bounds accesses.
-			// TODO(b/162327166): Only perform bounds checks when VK_EXT_image_robustness is enabled.
-			return OutOfBoundsBehavior::Nullify;
-
-		case spv::StorageClassInput:
-			if(executionModel == spv::ExecutionModelVertex)
-			{
-				// Vertex attributes follow robustBufferAccess rules.
-				return robustBufferAccess ? OutOfBoundsBehavior::RobustBufferAccess
-				                          : OutOfBoundsBehavior::UndefinedBehavior;
-			}
-			// Fall through to default case.
-		default:
-			// TODO(b/137183137): Optimize if the pointer resulted from OpInBoundsAccessChain.
-			// TODO(b/131224163): Optimize cases statically known to be within bounds.
-			return OutOfBoundsBehavior::UndefinedValue;
+		}
+		// Fall through to default case.
+	default:
+		// TODO(b/137183137): Optimize if the pointer resulted from OpInBoundsAccessChain.
+		// TODO(b/131224163): Optimize cases statically known to be within bounds.
+		return OutOfBoundsBehavior::UndefinedValue;
 	}
 
 	return OutOfBoundsBehavior::Nullify;
@@ -1590,7 +1593,7 @@
 	{
 		switch(insn.opcode())
 		{
-			case spv::OpVariable:
+		case spv::OpVariable:
 			{
 				auto resultPointerType = getType(insn.resultTypeId());
 				auto pointeeType = getType(resultPointerType.element);
@@ -1599,33 +1602,34 @@
 				{
 					routine->createVariable(insn.resultId(), pointeeType.componentCount);
 				}
-				break;
 			}
-			case spv::OpPhi:
+			break;
+
+		case spv::OpPhi:
 			{
 				auto type = getType(insn.resultTypeId());
 				routine->phis.emplace(insn.resultId(), SpirvRoutine::Variable(type.componentCount));
-				break;
 			}
+			break;
 
-			case spv::OpImageDrefGather:
-			case spv::OpImageFetch:
-			case spv::OpImageGather:
-			case spv::OpImageQueryLod:
-			case spv::OpImageSampleDrefExplicitLod:
-			case spv::OpImageSampleDrefImplicitLod:
-			case spv::OpImageSampleExplicitLod:
-			case spv::OpImageSampleImplicitLod:
-			case spv::OpImageSampleProjDrefExplicitLod:
-			case spv::OpImageSampleProjDrefImplicitLod:
-			case spv::OpImageSampleProjExplicitLod:
-			case spv::OpImageSampleProjImplicitLod:
-				routine->samplerCache.emplace(insn.resultId(), SpirvRoutine::SamplerCache{});
-				break;
+		case spv::OpImageDrefGather:
+		case spv::OpImageFetch:
+		case spv::OpImageGather:
+		case spv::OpImageQueryLod:
+		case spv::OpImageSampleDrefExplicitLod:
+		case spv::OpImageSampleDrefImplicitLod:
+		case spv::OpImageSampleExplicitLod:
+		case spv::OpImageSampleImplicitLod:
+		case spv::OpImageSampleProjDrefExplicitLod:
+		case spv::OpImageSampleProjDrefImplicitLod:
+		case spv::OpImageSampleProjExplicitLod:
+		case spv::OpImageSampleProjImplicitLod:
+			routine->samplerCache.emplace(insn.resultId(), SpirvRoutine::SamplerCache{});
+			break;
 
-			default:
-				// Nothing else produces interface variables, so can all be safely ignored.
-				break;
+		default:
+			// Nothing else produces interface variables, so can all be safely ignored.
+			break;
 		}
 	}
 }
@@ -1659,13 +1663,13 @@
 		auto res = EmitInstruction(insn, state);
 		switch(res)
 		{
-			case EmitResult::Continue:
-				continue;
-			case EmitResult::Terminator:
-				break;
-			default:
-				UNREACHABLE("Unexpected EmitResult %d", int(res));
-				break;
+		case EmitResult::Continue:
+			continue;
+		case EmitResult::Terminator:
+			break;
+		default:
+			UNREACHABLE("Unexpected EmitResult %d", int(res));
+			break;
 		}
 	}
 }
@@ -1692,371 +1696,371 @@
 
 	switch(opcode)
 	{
-		case spv::OpTypeVoid:
-		case spv::OpTypeInt:
-		case spv::OpTypeFloat:
-		case spv::OpTypeBool:
-		case spv::OpTypeVector:
-		case spv::OpTypeArray:
-		case spv::OpTypeRuntimeArray:
-		case spv::OpTypeMatrix:
-		case spv::OpTypeStruct:
-		case spv::OpTypePointer:
-		case spv::OpTypeFunction:
-		case spv::OpTypeImage:
-		case spv::OpTypeSampledImage:
-		case spv::OpTypeSampler:
-		case spv::OpExecutionMode:
-		case spv::OpMemoryModel:
-		case spv::OpFunction:
-		case spv::OpFunctionEnd:
-		case spv::OpConstant:
-		case spv::OpConstantNull:
-		case spv::OpConstantTrue:
-		case spv::OpConstantFalse:
-		case spv::OpConstantComposite:
-		case spv::OpSpecConstant:
-		case spv::OpSpecConstantTrue:
-		case spv::OpSpecConstantFalse:
-		case spv::OpSpecConstantComposite:
-		case spv::OpSpecConstantOp:
-		case spv::OpUndef:
-		case spv::OpExtension:
-		case spv::OpCapability:
-		case spv::OpEntryPoint:
-		case spv::OpExtInstImport:
-		case spv::OpDecorate:
-		case spv::OpMemberDecorate:
-		case spv::OpGroupDecorate:
-		case spv::OpGroupMemberDecorate:
-		case spv::OpDecorationGroup:
-		case spv::OpDecorateId:
-		case spv::OpDecorateString:
-		case spv::OpMemberDecorateString:
-		case spv::OpName:
-		case spv::OpMemberName:
-		case spv::OpSource:
-		case spv::OpSourceContinued:
-		case spv::OpSourceExtension:
-		case spv::OpNoLine:
-		case spv::OpModuleProcessed:
-		case spv::OpString:
-			// Nothing to do at emit time. These are either fully handled at analysis time,
-			// or don't require any work at all.
-			return EmitResult::Continue;
+	case spv::OpTypeVoid:
+	case spv::OpTypeInt:
+	case spv::OpTypeFloat:
+	case spv::OpTypeBool:
+	case spv::OpTypeVector:
+	case spv::OpTypeArray:
+	case spv::OpTypeRuntimeArray:
+	case spv::OpTypeMatrix:
+	case spv::OpTypeStruct:
+	case spv::OpTypePointer:
+	case spv::OpTypeFunction:
+	case spv::OpTypeImage:
+	case spv::OpTypeSampledImage:
+	case spv::OpTypeSampler:
+	case spv::OpExecutionMode:
+	case spv::OpMemoryModel:
+	case spv::OpFunction:
+	case spv::OpFunctionEnd:
+	case spv::OpConstant:
+	case spv::OpConstantNull:
+	case spv::OpConstantTrue:
+	case spv::OpConstantFalse:
+	case spv::OpConstantComposite:
+	case spv::OpSpecConstant:
+	case spv::OpSpecConstantTrue:
+	case spv::OpSpecConstantFalse:
+	case spv::OpSpecConstantComposite:
+	case spv::OpSpecConstantOp:
+	case spv::OpUndef:
+	case spv::OpExtension:
+	case spv::OpCapability:
+	case spv::OpEntryPoint:
+	case spv::OpExtInstImport:
+	case spv::OpDecorate:
+	case spv::OpMemberDecorate:
+	case spv::OpGroupDecorate:
+	case spv::OpGroupMemberDecorate:
+	case spv::OpDecorationGroup:
+	case spv::OpDecorateId:
+	case spv::OpDecorateString:
+	case spv::OpMemberDecorateString:
+	case spv::OpName:
+	case spv::OpMemberName:
+	case spv::OpSource:
+	case spv::OpSourceContinued:
+	case spv::OpSourceExtension:
+	case spv::OpNoLine:
+	case spv::OpModuleProcessed:
+	case spv::OpString:
+		// Nothing to do at emit time. These are either fully handled at analysis time,
+		// or don't require any work at all.
+		return EmitResult::Continue;
 
-		case spv::OpLine:
-			return EmitLine(insn, state);
+	case spv::OpLine:
+		return EmitLine(insn, state);
 
-		case spv::OpLabel:
-			return EmitResult::Continue;
+	case spv::OpLabel:
+		return EmitResult::Continue;
 
-		case spv::OpVariable:
-			return EmitVariable(insn, state);
+	case spv::OpVariable:
+		return EmitVariable(insn, state);
 
-		case spv::OpLoad:
-		case spv::OpAtomicLoad:
-			return EmitLoad(insn, state);
+	case spv::OpLoad:
+	case spv::OpAtomicLoad:
+		return EmitLoad(insn, state);
 
-		case spv::OpStore:
-		case spv::OpAtomicStore:
-			return EmitStore(insn, state);
+	case spv::OpStore:
+	case spv::OpAtomicStore:
+		return EmitStore(insn, state);
 
-		case spv::OpAtomicIAdd:
-		case spv::OpAtomicISub:
-		case spv::OpAtomicSMin:
-		case spv::OpAtomicSMax:
-		case spv::OpAtomicUMin:
-		case spv::OpAtomicUMax:
-		case spv::OpAtomicAnd:
-		case spv::OpAtomicOr:
-		case spv::OpAtomicXor:
-		case spv::OpAtomicIIncrement:
-		case spv::OpAtomicIDecrement:
-		case spv::OpAtomicExchange:
-			return EmitAtomicOp(insn, state);
+	case spv::OpAtomicIAdd:
+	case spv::OpAtomicISub:
+	case spv::OpAtomicSMin:
+	case spv::OpAtomicSMax:
+	case spv::OpAtomicUMin:
+	case spv::OpAtomicUMax:
+	case spv::OpAtomicAnd:
+	case spv::OpAtomicOr:
+	case spv::OpAtomicXor:
+	case spv::OpAtomicIIncrement:
+	case spv::OpAtomicIDecrement:
+	case spv::OpAtomicExchange:
+		return EmitAtomicOp(insn, state);
 
-		case spv::OpAtomicCompareExchange:
-			return EmitAtomicCompareExchange(insn, state);
+	case spv::OpAtomicCompareExchange:
+		return EmitAtomicCompareExchange(insn, state);
 
-		case spv::OpAccessChain:
-		case spv::OpInBoundsAccessChain:
-			return EmitAccessChain(insn, state);
+	case spv::OpAccessChain:
+	case spv::OpInBoundsAccessChain:
+		return EmitAccessChain(insn, state);
 
-		case spv::OpCompositeConstruct:
-			return EmitCompositeConstruct(insn, state);
+	case spv::OpCompositeConstruct:
+		return EmitCompositeConstruct(insn, state);
 
-		case spv::OpCompositeInsert:
-			return EmitCompositeInsert(insn, state);
+	case spv::OpCompositeInsert:
+		return EmitCompositeInsert(insn, state);
 
-		case spv::OpCompositeExtract:
-			return EmitCompositeExtract(insn, state);
+	case spv::OpCompositeExtract:
+		return EmitCompositeExtract(insn, state);
 
-		case spv::OpVectorShuffle:
-			return EmitVectorShuffle(insn, state);
+	case spv::OpVectorShuffle:
+		return EmitVectorShuffle(insn, state);
 
-		case spv::OpVectorExtractDynamic:
-			return EmitVectorExtractDynamic(insn, state);
+	case spv::OpVectorExtractDynamic:
+		return EmitVectorExtractDynamic(insn, state);
 
-		case spv::OpVectorInsertDynamic:
-			return EmitVectorInsertDynamic(insn, state);
+	case spv::OpVectorInsertDynamic:
+		return EmitVectorInsertDynamic(insn, state);
 
-		case spv::OpVectorTimesScalar:
-		case spv::OpMatrixTimesScalar:
-			return EmitVectorTimesScalar(insn, state);
+	case spv::OpVectorTimesScalar:
+	case spv::OpMatrixTimesScalar:
+		return EmitVectorTimesScalar(insn, state);
 
-		case spv::OpMatrixTimesVector:
-			return EmitMatrixTimesVector(insn, state);
+	case spv::OpMatrixTimesVector:
+		return EmitMatrixTimesVector(insn, state);
 
-		case spv::OpVectorTimesMatrix:
-			return EmitVectorTimesMatrix(insn, state);
+	case spv::OpVectorTimesMatrix:
+		return EmitVectorTimesMatrix(insn, state);
 
-		case spv::OpMatrixTimesMatrix:
-			return EmitMatrixTimesMatrix(insn, state);
+	case spv::OpMatrixTimesMatrix:
+		return EmitMatrixTimesMatrix(insn, state);
 
-		case spv::OpOuterProduct:
-			return EmitOuterProduct(insn, state);
+	case spv::OpOuterProduct:
+		return EmitOuterProduct(insn, state);
 
-		case spv::OpTranspose:
-			return EmitTranspose(insn, state);
+	case spv::OpTranspose:
+		return EmitTranspose(insn, state);
 
-		case spv::OpNot:
-		case spv::OpBitFieldInsert:
-		case spv::OpBitFieldSExtract:
-		case spv::OpBitFieldUExtract:
-		case spv::OpBitReverse:
-		case spv::OpBitCount:
-		case spv::OpSNegate:
-		case spv::OpFNegate:
-		case spv::OpLogicalNot:
-		case spv::OpConvertFToU:
-		case spv::OpConvertFToS:
-		case spv::OpConvertSToF:
-		case spv::OpConvertUToF:
-		case spv::OpBitcast:
-		case spv::OpIsInf:
-		case spv::OpIsNan:
-		case spv::OpDPdx:
-		case spv::OpDPdxCoarse:
-		case spv::OpDPdy:
-		case spv::OpDPdyCoarse:
-		case spv::OpFwidth:
-		case spv::OpFwidthCoarse:
-		case spv::OpDPdxFine:
-		case spv::OpDPdyFine:
-		case spv::OpFwidthFine:
-		case spv::OpQuantizeToF16:
-			return EmitUnaryOp(insn, state);
+	case spv::OpNot:
+	case spv::OpBitFieldInsert:
+	case spv::OpBitFieldSExtract:
+	case spv::OpBitFieldUExtract:
+	case spv::OpBitReverse:
+	case spv::OpBitCount:
+	case spv::OpSNegate:
+	case spv::OpFNegate:
+	case spv::OpLogicalNot:
+	case spv::OpConvertFToU:
+	case spv::OpConvertFToS:
+	case spv::OpConvertSToF:
+	case spv::OpConvertUToF:
+	case spv::OpBitcast:
+	case spv::OpIsInf:
+	case spv::OpIsNan:
+	case spv::OpDPdx:
+	case spv::OpDPdxCoarse:
+	case spv::OpDPdy:
+	case spv::OpDPdyCoarse:
+	case spv::OpFwidth:
+	case spv::OpFwidthCoarse:
+	case spv::OpDPdxFine:
+	case spv::OpDPdyFine:
+	case spv::OpFwidthFine:
+	case spv::OpQuantizeToF16:
+		return EmitUnaryOp(insn, state);
 
-		case spv::OpIAdd:
-		case spv::OpISub:
-		case spv::OpIMul:
-		case spv::OpSDiv:
-		case spv::OpUDiv:
-		case spv::OpFAdd:
-		case spv::OpFSub:
-		case spv::OpFMul:
-		case spv::OpFDiv:
-		case spv::OpFMod:
-		case spv::OpFRem:
-		case spv::OpFOrdEqual:
-		case spv::OpFUnordEqual:
-		case spv::OpFOrdNotEqual:
-		case spv::OpFUnordNotEqual:
-		case spv::OpFOrdLessThan:
-		case spv::OpFUnordLessThan:
-		case spv::OpFOrdGreaterThan:
-		case spv::OpFUnordGreaterThan:
-		case spv::OpFOrdLessThanEqual:
-		case spv::OpFUnordLessThanEqual:
-		case spv::OpFOrdGreaterThanEqual:
-		case spv::OpFUnordGreaterThanEqual:
-		case spv::OpSMod:
-		case spv::OpSRem:
-		case spv::OpUMod:
-		case spv::OpIEqual:
-		case spv::OpINotEqual:
-		case spv::OpUGreaterThan:
-		case spv::OpSGreaterThan:
-		case spv::OpUGreaterThanEqual:
-		case spv::OpSGreaterThanEqual:
-		case spv::OpULessThan:
-		case spv::OpSLessThan:
-		case spv::OpULessThanEqual:
-		case spv::OpSLessThanEqual:
-		case spv::OpShiftRightLogical:
-		case spv::OpShiftRightArithmetic:
-		case spv::OpShiftLeftLogical:
-		case spv::OpBitwiseOr:
-		case spv::OpBitwiseXor:
-		case spv::OpBitwiseAnd:
-		case spv::OpLogicalOr:
-		case spv::OpLogicalAnd:
-		case spv::OpLogicalEqual:
-		case spv::OpLogicalNotEqual:
-		case spv::OpUMulExtended:
-		case spv::OpSMulExtended:
-		case spv::OpIAddCarry:
-		case spv::OpISubBorrow:
-			return EmitBinaryOp(insn, state);
+	case spv::OpIAdd:
+	case spv::OpISub:
+	case spv::OpIMul:
+	case spv::OpSDiv:
+	case spv::OpUDiv:
+	case spv::OpFAdd:
+	case spv::OpFSub:
+	case spv::OpFMul:
+	case spv::OpFDiv:
+	case spv::OpFMod:
+	case spv::OpFRem:
+	case spv::OpFOrdEqual:
+	case spv::OpFUnordEqual:
+	case spv::OpFOrdNotEqual:
+	case spv::OpFUnordNotEqual:
+	case spv::OpFOrdLessThan:
+	case spv::OpFUnordLessThan:
+	case spv::OpFOrdGreaterThan:
+	case spv::OpFUnordGreaterThan:
+	case spv::OpFOrdLessThanEqual:
+	case spv::OpFUnordLessThanEqual:
+	case spv::OpFOrdGreaterThanEqual:
+	case spv::OpFUnordGreaterThanEqual:
+	case spv::OpSMod:
+	case spv::OpSRem:
+	case spv::OpUMod:
+	case spv::OpIEqual:
+	case spv::OpINotEqual:
+	case spv::OpUGreaterThan:
+	case spv::OpSGreaterThan:
+	case spv::OpUGreaterThanEqual:
+	case spv::OpSGreaterThanEqual:
+	case spv::OpULessThan:
+	case spv::OpSLessThan:
+	case spv::OpULessThanEqual:
+	case spv::OpSLessThanEqual:
+	case spv::OpShiftRightLogical:
+	case spv::OpShiftRightArithmetic:
+	case spv::OpShiftLeftLogical:
+	case spv::OpBitwiseOr:
+	case spv::OpBitwiseXor:
+	case spv::OpBitwiseAnd:
+	case spv::OpLogicalOr:
+	case spv::OpLogicalAnd:
+	case spv::OpLogicalEqual:
+	case spv::OpLogicalNotEqual:
+	case spv::OpUMulExtended:
+	case spv::OpSMulExtended:
+	case spv::OpIAddCarry:
+	case spv::OpISubBorrow:
+		return EmitBinaryOp(insn, state);
 
-		case spv::OpDot:
-			return EmitDot(insn, state);
+	case spv::OpDot:
+		return EmitDot(insn, state);
 
-		case spv::OpSelect:
-			return EmitSelect(insn, state);
+	case spv::OpSelect:
+		return EmitSelect(insn, state);
 
-		case spv::OpExtInst:
-			return EmitExtendedInstruction(insn, state);
+	case spv::OpExtInst:
+		return EmitExtendedInstruction(insn, state);
 
-		case spv::OpAny:
-			return EmitAny(insn, state);
+	case spv::OpAny:
+		return EmitAny(insn, state);
 
-		case spv::OpAll:
-			return EmitAll(insn, state);
+	case spv::OpAll:
+		return EmitAll(insn, state);
 
-		case spv::OpBranch:
-			return EmitBranch(insn, state);
+	case spv::OpBranch:
+		return EmitBranch(insn, state);
 
-		case spv::OpPhi:
-			return EmitPhi(insn, state);
+	case spv::OpPhi:
+		return EmitPhi(insn, state);
 
-		case spv::OpSelectionMerge:
-		case spv::OpLoopMerge:
-			return EmitResult::Continue;
+	case spv::OpSelectionMerge:
+	case spv::OpLoopMerge:
+		return EmitResult::Continue;
 
-		case spv::OpBranchConditional:
-			return EmitBranchConditional(insn, state);
+	case spv::OpBranchConditional:
+		return EmitBranchConditional(insn, state);
 
-		case spv::OpSwitch:
-			return EmitSwitch(insn, state);
+	case spv::OpSwitch:
+		return EmitSwitch(insn, state);
 
-		case spv::OpUnreachable:
-			return EmitUnreachable(insn, state);
+	case spv::OpUnreachable:
+		return EmitUnreachable(insn, state);
 
-		case spv::OpReturn:
-			return EmitReturn(insn, state);
+	case spv::OpReturn:
+		return EmitReturn(insn, state);
 
-		case spv::OpFunctionCall:
-			return EmitFunctionCall(insn, state);
+	case spv::OpFunctionCall:
+		return EmitFunctionCall(insn, state);
 
-		case spv::OpKill:
-			return EmitKill(insn, state);
+	case spv::OpKill:
+		return EmitKill(insn, state);
 
-		case spv::OpImageSampleImplicitLod:
-			return EmitImageSampleImplicitLod(None, insn, state);
+	case spv::OpImageSampleImplicitLod:
+		return EmitImageSampleImplicitLod(None, insn, state);
 
-		case spv::OpImageSampleExplicitLod:
-			return EmitImageSampleExplicitLod(None, insn, state);
+	case spv::OpImageSampleExplicitLod:
+		return EmitImageSampleExplicitLod(None, insn, state);
 
-		case spv::OpImageSampleDrefImplicitLod:
-			return EmitImageSampleImplicitLod(Dref, insn, state);
+	case spv::OpImageSampleDrefImplicitLod:
+		return EmitImageSampleImplicitLod(Dref, insn, state);
 
-		case spv::OpImageSampleDrefExplicitLod:
-			return EmitImageSampleExplicitLod(Dref, insn, state);
+	case spv::OpImageSampleDrefExplicitLod:
+		return EmitImageSampleExplicitLod(Dref, insn, state);
 
-		case spv::OpImageSampleProjImplicitLod:
-			return EmitImageSampleImplicitLod(Proj, insn, state);
+	case spv::OpImageSampleProjImplicitLod:
+		return EmitImageSampleImplicitLod(Proj, insn, state);
 
-		case spv::OpImageSampleProjExplicitLod:
-			return EmitImageSampleExplicitLod(Proj, insn, state);
+	case spv::OpImageSampleProjExplicitLod:
+		return EmitImageSampleExplicitLod(Proj, insn, state);
 
-		case spv::OpImageSampleProjDrefImplicitLod:
-			return EmitImageSampleImplicitLod(ProjDref, insn, state);
+	case spv::OpImageSampleProjDrefImplicitLod:
+		return EmitImageSampleImplicitLod(ProjDref, insn, state);
 
-		case spv::OpImageSampleProjDrefExplicitLod:
-			return EmitImageSampleExplicitLod(ProjDref, insn, state);
+	case spv::OpImageSampleProjDrefExplicitLod:
+		return EmitImageSampleExplicitLod(ProjDref, insn, state);
 
-		case spv::OpImageGather:
-			return EmitImageGather(None, insn, state);
+	case spv::OpImageGather:
+		return EmitImageGather(None, insn, state);
 
-		case spv::OpImageDrefGather:
-			return EmitImageGather(Dref, insn, state);
+	case spv::OpImageDrefGather:
+		return EmitImageGather(Dref, insn, state);
 
-		case spv::OpImageFetch:
-			return EmitImageFetch(insn, state);
+	case spv::OpImageFetch:
+		return EmitImageFetch(insn, state);
 
-		case spv::OpImageQuerySizeLod:
-			return EmitImageQuerySizeLod(insn, state);
+	case spv::OpImageQuerySizeLod:
+		return EmitImageQuerySizeLod(insn, state);
 
-		case spv::OpImageQuerySize:
-			return EmitImageQuerySize(insn, state);
+	case spv::OpImageQuerySize:
+		return EmitImageQuerySize(insn, state);
 
-		case spv::OpImageQueryLod:
-			return EmitImageQueryLod(insn, state);
+	case spv::OpImageQueryLod:
+		return EmitImageQueryLod(insn, state);
 
-		case spv::OpImageQueryLevels:
-			return EmitImageQueryLevels(insn, state);
+	case spv::OpImageQueryLevels:
+		return EmitImageQueryLevels(insn, state);
 
-		case spv::OpImageQuerySamples:
-			return EmitImageQuerySamples(insn, state);
+	case spv::OpImageQuerySamples:
+		return EmitImageQuerySamples(insn, state);
 
-		case spv::OpImageRead:
-			return EmitImageRead(insn, state);
+	case spv::OpImageRead:
+		return EmitImageRead(insn, state);
 
-		case spv::OpImageWrite:
-			return EmitImageWrite(insn, state);
+	case spv::OpImageWrite:
+		return EmitImageWrite(insn, state);
 
-		case spv::OpImageTexelPointer:
-			return EmitImageTexelPointer(insn, state);
+	case spv::OpImageTexelPointer:
+		return EmitImageTexelPointer(insn, state);
 
-		case spv::OpSampledImage:
-		case spv::OpImage:
-			return EmitSampledImageCombineOrSplit(insn, state);
+	case spv::OpSampledImage:
+	case spv::OpImage:
+		return EmitSampledImageCombineOrSplit(insn, state);
 
-		case spv::OpCopyObject:
-		case spv::OpCopyLogical:
-			return EmitCopyObject(insn, state);
+	case spv::OpCopyObject:
+	case spv::OpCopyLogical:
+		return EmitCopyObject(insn, state);
 
-		case spv::OpCopyMemory:
-			return EmitCopyMemory(insn, state);
+	case spv::OpCopyMemory:
+		return EmitCopyMemory(insn, state);
 
-		case spv::OpControlBarrier:
-			return EmitControlBarrier(insn, state);
+	case spv::OpControlBarrier:
+		return EmitControlBarrier(insn, state);
 
-		case spv::OpMemoryBarrier:
-			return EmitMemoryBarrier(insn, state);
+	case spv::OpMemoryBarrier:
+		return EmitMemoryBarrier(insn, state);
 
-		case spv::OpGroupNonUniformElect:
-		case spv::OpGroupNonUniformAll:
-		case spv::OpGroupNonUniformAny:
-		case spv::OpGroupNonUniformAllEqual:
-		case spv::OpGroupNonUniformBroadcast:
-		case spv::OpGroupNonUniformBroadcastFirst:
-		case spv::OpGroupNonUniformBallot:
-		case spv::OpGroupNonUniformInverseBallot:
-		case spv::OpGroupNonUniformBallotBitExtract:
-		case spv::OpGroupNonUniformBallotBitCount:
-		case spv::OpGroupNonUniformBallotFindLSB:
-		case spv::OpGroupNonUniformBallotFindMSB:
-		case spv::OpGroupNonUniformShuffle:
-		case spv::OpGroupNonUniformShuffleXor:
-		case spv::OpGroupNonUniformShuffleUp:
-		case spv::OpGroupNonUniformShuffleDown:
-		case spv::OpGroupNonUniformIAdd:
-		case spv::OpGroupNonUniformFAdd:
-		case spv::OpGroupNonUniformIMul:
-		case spv::OpGroupNonUniformFMul:
-		case spv::OpGroupNonUniformSMin:
-		case spv::OpGroupNonUniformUMin:
-		case spv::OpGroupNonUniformFMin:
-		case spv::OpGroupNonUniformSMax:
-		case spv::OpGroupNonUniformUMax:
-		case spv::OpGroupNonUniformFMax:
-		case spv::OpGroupNonUniformBitwiseAnd:
-		case spv::OpGroupNonUniformBitwiseOr:
-		case spv::OpGroupNonUniformBitwiseXor:
-		case spv::OpGroupNonUniformLogicalAnd:
-		case spv::OpGroupNonUniformLogicalOr:
-		case spv::OpGroupNonUniformLogicalXor:
-			return EmitGroupNonUniform(insn, state);
+	case spv::OpGroupNonUniformElect:
+	case spv::OpGroupNonUniformAll:
+	case spv::OpGroupNonUniformAny:
+	case spv::OpGroupNonUniformAllEqual:
+	case spv::OpGroupNonUniformBroadcast:
+	case spv::OpGroupNonUniformBroadcastFirst:
+	case spv::OpGroupNonUniformBallot:
+	case spv::OpGroupNonUniformInverseBallot:
+	case spv::OpGroupNonUniformBallotBitExtract:
+	case spv::OpGroupNonUniformBallotBitCount:
+	case spv::OpGroupNonUniformBallotFindLSB:
+	case spv::OpGroupNonUniformBallotFindMSB:
+	case spv::OpGroupNonUniformShuffle:
+	case spv::OpGroupNonUniformShuffleXor:
+	case spv::OpGroupNonUniformShuffleUp:
+	case spv::OpGroupNonUniformShuffleDown:
+	case spv::OpGroupNonUniformIAdd:
+	case spv::OpGroupNonUniformFAdd:
+	case spv::OpGroupNonUniformIMul:
+	case spv::OpGroupNonUniformFMul:
+	case spv::OpGroupNonUniformSMin:
+	case spv::OpGroupNonUniformUMin:
+	case spv::OpGroupNonUniformFMin:
+	case spv::OpGroupNonUniformSMax:
+	case spv::OpGroupNonUniformUMax:
+	case spv::OpGroupNonUniformFMax:
+	case spv::OpGroupNonUniformBitwiseAnd:
+	case spv::OpGroupNonUniformBitwiseOr:
+	case spv::OpGroupNonUniformBitwiseXor:
+	case spv::OpGroupNonUniformLogicalAnd:
+	case spv::OpGroupNonUniformLogicalOr:
+	case spv::OpGroupNonUniformLogicalXor:
+		return EmitGroupNonUniform(insn, state);
 
-		case spv::OpArrayLength:
-			return EmitArrayLength(insn, state);
+	case spv::OpArrayLength:
+		return EmitArrayLength(insn, state);
 
-		default:
-			UNREACHABLE("%s", OpcodeName(opcode));
-			break;
+	default:
+		UNREACHABLE("%s", OpcodeName(opcode));
+		break;
 	}
 
 	return EmitResult::Continue;
@@ -2322,41 +2326,41 @@
 			UInt v;
 			switch(insn.opcode())
 			{
-				case spv::OpAtomicIAdd:
-				case spv::OpAtomicIIncrement:
-					v = AddAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicISub:
-				case spv::OpAtomicIDecrement:
-					v = SubAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicAnd:
-					v = AndAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicOr:
-					v = OrAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicXor:
-					v = XorAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicSMin:
-					v = As<UInt>(MinAtomic(Pointer<Int>(&ptr.base[offset]), As<Int>(laneValue), memoryOrder));
-					break;
-				case spv::OpAtomicSMax:
-					v = As<UInt>(MaxAtomic(Pointer<Int>(&ptr.base[offset]), As<Int>(laneValue), memoryOrder));
-					break;
-				case spv::OpAtomicUMin:
-					v = MinAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicUMax:
-					v = MaxAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				case spv::OpAtomicExchange:
-					v = ExchangeAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
-					break;
-				default:
-					UNREACHABLE("%s", OpcodeName(insn.opcode()));
-					break;
+			case spv::OpAtomicIAdd:
+			case spv::OpAtomicIIncrement:
+				v = AddAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicISub:
+			case spv::OpAtomicIDecrement:
+				v = SubAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicAnd:
+				v = AndAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicOr:
+				v = OrAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicXor:
+				v = XorAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicSMin:
+				v = As<UInt>(MinAtomic(Pointer<Int>(&ptr.base[offset]), As<Int>(laneValue), memoryOrder));
+				break;
+			case spv::OpAtomicSMax:
+				v = As<UInt>(MaxAtomic(Pointer<Int>(&ptr.base[offset]), As<Int>(laneValue), memoryOrder));
+				break;
+			case spv::OpAtomicUMin:
+				v = MinAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicUMax:
+				v = MaxAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			case spv::OpAtomicExchange:
+				v = ExchangeAtomic(Pointer<UInt>(&ptr.base[offset]), laneValue, memoryOrder);
+				break;
+			default:
+				UNREACHABLE("%s", OpcodeName(insn.opcode()));
+				break;
 			}
 			result = Insert(result, v, j);
 		}
@@ -2451,12 +2455,12 @@
 	auto ext = getExtension(insn.word(3));
 	switch(ext.name)
 	{
-		case Extension::GLSLstd450:
-			return EmitExtGLSLstd450(insn, state);
-		case Extension::OpenCLDebugInfo100:
-			return EmitOpenCLDebugInfo100(insn, state);
-		default:
-			UNREACHABLE("Unknown Extension::Name<%d>", int(ext.name));
+	case Extension::GLSLstd450:
+		return EmitExtGLSLstd450(insn, state);
+	case Extension::OpenCLDebugInfo100:
+		return EmitOpenCLDebugInfo100(insn, state);
+	default:
+		UNREACHABLE("Unknown Extension::Name<%d>", int(ext.name));
 	}
 	return EmitResult::Continue;
 }
@@ -2475,7 +2479,7 @@
 	{
 		switch(insn.opcode())
 		{
-			case spv::OpVariable:
+		case spv::OpVariable:
 			{
 				auto &object = getObject(insn.resultId());
 				auto &objectTy = getType(object);
@@ -2489,10 +2493,10 @@
 						               routine->outputs[scalarSlot] = dst[offset++];
 					               });
 				}
-				break;
 			}
-			default:
-				break;
+			break;
+		default:
+			break;
 		}
 	}
 }
@@ -2510,24 +2514,24 @@
 {
 	switch(model)
 	{
-		case spv::ExecutionModelVertex: return VK_SHADER_STAGE_VERTEX_BIT;
-		// case spv::ExecutionModelTessellationControl:    return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
-		// case spv::ExecutionModelTessellationEvaluation: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
-		// case spv::ExecutionModelGeometry:               return VK_SHADER_STAGE_GEOMETRY_BIT;
-		case spv::ExecutionModelFragment: return VK_SHADER_STAGE_FRAGMENT_BIT;
-		case spv::ExecutionModelGLCompute: return VK_SHADER_STAGE_COMPUTE_BIT;
-		// case spv::ExecutionModelKernel:                 return VkShaderStageFlagBits(0); // Not supported by vulkan.
-		// case spv::ExecutionModelTaskNV:                 return VK_SHADER_STAGE_TASK_BIT_NV;
-		// case spv::ExecutionModelMeshNV:                 return VK_SHADER_STAGE_MESH_BIT_NV;
-		// case spv::ExecutionModelRayGenerationNV:        return VK_SHADER_STAGE_RAYGEN_BIT_NV;
-		// case spv::ExecutionModelIntersectionNV:         return VK_SHADER_STAGE_INTERSECTION_BIT_NV;
-		// case spv::ExecutionModelAnyHitNV:               return VK_SHADER_STAGE_ANY_HIT_BIT_NV;
-		// case spv::ExecutionModelClosestHitNV:           return VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV;
-		// case spv::ExecutionModelMissNV:                 return VK_SHADER_STAGE_MISS_BIT_NV;
-		// case spv::ExecutionModelCallableNV:             return VK_SHADER_STAGE_CALLABLE_BIT_NV;
-		default:
-			UNSUPPORTED("ExecutionModel: %d", int(model));
-			return VkShaderStageFlagBits(0);
+	case spv::ExecutionModelVertex: return VK_SHADER_STAGE_VERTEX_BIT;
+	// case spv::ExecutionModelTessellationControl:    return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
+	// case spv::ExecutionModelTessellationEvaluation: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
+	// case spv::ExecutionModelGeometry:               return VK_SHADER_STAGE_GEOMETRY_BIT;
+	case spv::ExecutionModelFragment: return VK_SHADER_STAGE_FRAGMENT_BIT;
+	case spv::ExecutionModelGLCompute: return VK_SHADER_STAGE_COMPUTE_BIT;
+	// case spv::ExecutionModelKernel:                 return VkShaderStageFlagBits(0); // Not supported by vulkan.
+	// case spv::ExecutionModelTaskNV:                 return VK_SHADER_STAGE_TASK_BIT_NV;
+	// case spv::ExecutionModelMeshNV:                 return VK_SHADER_STAGE_MESH_BIT_NV;
+	// case spv::ExecutionModelRayGenerationNV:        return VK_SHADER_STAGE_RAYGEN_BIT_NV;
+	// case spv::ExecutionModelIntersectionNV:         return VK_SHADER_STAGE_INTERSECTION_BIT_NV;
+	// case spv::ExecutionModelAnyHitNV:               return VK_SHADER_STAGE_ANY_HIT_BIT_NV;
+	// case spv::ExecutionModelClosestHitNV:           return VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV;
+	// case spv::ExecutionModelMissNV:                 return VK_SHADER_STAGE_MISS_BIT_NV;
+	// case spv::ExecutionModelCallableNV:             return VK_SHADER_STAGE_CALLABLE_BIT_NV;
+	default:
+		UNSUPPORTED("ExecutionModel: %d", int(model));
+		return VkShaderStageFlagBits(0);
 	}
 }
 
diff --git a/src/Pipeline/SpirvShaderArithmetic.cpp b/src/Pipeline/SpirvShaderArithmetic.cpp
index 61d7bcc..c2924d3 100644
--- a/src/Pipeline/SpirvShaderArithmetic.cpp
+++ b/src/Pipeline/SpirvShaderArithmetic.cpp
@@ -154,11 +154,11 @@
 	{
 		switch(insn.opcode())
 		{
-			case spv::OpNot:
-			case spv::OpLogicalNot:  // logical not == bitwise not due to all-bits boolean representation
-				dst.move(i, ~src.UInt(i));
-				break;
-			case spv::OpBitFieldInsert:
+		case spv::OpNot:
+		case spv::OpLogicalNot:  // logical not == bitwise not due to all-bits boolean representation
+			dst.move(i, ~src.UInt(i));
+			break;
+		case spv::OpBitFieldInsert:
 			{
 				auto insert = Operand(this, state, insn.word(4)).UInt(i);
 				auto offset = Operand(this, state, insn.word(5)).UInt(0);
@@ -167,10 +167,10 @@
 				auto v = src.UInt(i);
 				auto mask = Bitmask32(offset + count) ^ Bitmask32(offset);
 				dst.move(i, (v & ~mask) | ((insert << offset) & mask));
-				break;
 			}
-			case spv::OpBitFieldSExtract:
-			case spv::OpBitFieldUExtract:
+			break;
+		case spv::OpBitFieldSExtract:
+		case spv::OpBitFieldUExtract:
 			{
 				auto offset = Operand(this, state, insn.word(4)).UInt(0);
 				auto count = Operand(this, state, insn.word(5)).UInt(0);
@@ -184,9 +184,9 @@
 					out |= sext;
 				}
 				dst.move(i, out);
-				break;
 			}
-			case spv::OpBitReverse:
+			break;
+		case spv::OpBitReverse:
 			{
 				// TODO: Add an intrinsic to reactor. Even if there isn't a
 				// single vector instruction, there may be target-dependent
@@ -199,55 +199,55 @@
 				v = ((v >> 8) & SIMD::UInt(0x00FF00FF)) | ((v & SIMD::UInt(0x00FF00FF)) << 8);
 				v = (v >> 16) | (v << 16);
 				dst.move(i, v);
-				break;
 			}
-			case spv::OpBitCount:
-				dst.move(i, CountBits(src.UInt(i)));
-				break;
-			case spv::OpSNegate:
-				dst.move(i, -src.Int(i));
-				break;
-			case spv::OpFNegate:
-				dst.move(i, -src.Float(i));
-				break;
-			case spv::OpConvertFToU:
-				dst.move(i, SIMD::UInt(src.Float(i)));
-				break;
-			case spv::OpConvertFToS:
-				dst.move(i, SIMD::Int(src.Float(i)));
-				break;
-			case spv::OpConvertSToF:
-				dst.move(i, SIMD::Float(src.Int(i)));
-				break;
-			case spv::OpConvertUToF:
-				dst.move(i, SIMD::Float(src.UInt(i)));
-				break;
-			case spv::OpBitcast:
-				dst.move(i, src.Float(i));
-				break;
-			case spv::OpIsInf:
-				dst.move(i, IsInf(src.Float(i)));
-				break;
-			case spv::OpIsNan:
-				dst.move(i, IsNan(src.Float(i)));
-				break;
-			case spv::OpDPdx:
-			case spv::OpDPdxCoarse:
-				// Derivative instructions: FS invocations are laid out like so:
-				//    0 1
-				//    2 3
-				static_assert(SIMD::Width == 4, "All cross-lane instructions will need care when using a different width");
-				dst.move(i, SIMD::Float(Extract(src.Float(i), 1) - Extract(src.Float(i), 0)));
-				break;
-			case spv::OpDPdy:
-			case spv::OpDPdyCoarse:
-				dst.move(i, SIMD::Float(Extract(src.Float(i), 2) - Extract(src.Float(i), 0)));
-				break;
-			case spv::OpFwidth:
-			case spv::OpFwidthCoarse:
-				dst.move(i, SIMD::Float(Abs(Extract(src.Float(i), 1) - Extract(src.Float(i), 0)) + Abs(Extract(src.Float(i), 2) - Extract(src.Float(i), 0))));
-				break;
-			case spv::OpDPdxFine:
+			break;
+		case spv::OpBitCount:
+			dst.move(i, CountBits(src.UInt(i)));
+			break;
+		case spv::OpSNegate:
+			dst.move(i, -src.Int(i));
+			break;
+		case spv::OpFNegate:
+			dst.move(i, -src.Float(i));
+			break;
+		case spv::OpConvertFToU:
+			dst.move(i, SIMD::UInt(src.Float(i)));
+			break;
+		case spv::OpConvertFToS:
+			dst.move(i, SIMD::Int(src.Float(i)));
+			break;
+		case spv::OpConvertSToF:
+			dst.move(i, SIMD::Float(src.Int(i)));
+			break;
+		case spv::OpConvertUToF:
+			dst.move(i, SIMD::Float(src.UInt(i)));
+			break;
+		case spv::OpBitcast:
+			dst.move(i, src.Float(i));
+			break;
+		case spv::OpIsInf:
+			dst.move(i, IsInf(src.Float(i)));
+			break;
+		case spv::OpIsNan:
+			dst.move(i, IsNan(src.Float(i)));
+			break;
+		case spv::OpDPdx:
+		case spv::OpDPdxCoarse:
+			// Derivative instructions: FS invocations are laid out like so:
+			//    0 1
+			//    2 3
+			static_assert(SIMD::Width == 4, "All cross-lane instructions will need care when using a different width");
+			dst.move(i, SIMD::Float(Extract(src.Float(i), 1) - Extract(src.Float(i), 0)));
+			break;
+		case spv::OpDPdy:
+		case spv::OpDPdyCoarse:
+			dst.move(i, SIMD::Float(Extract(src.Float(i), 2) - Extract(src.Float(i), 0)));
+			break;
+		case spv::OpFwidth:
+		case spv::OpFwidthCoarse:
+			dst.move(i, SIMD::Float(Abs(Extract(src.Float(i), 1) - Extract(src.Float(i), 0)) + Abs(Extract(src.Float(i), 2) - Extract(src.Float(i), 0))));
+			break;
+		case spv::OpDPdxFine:
 			{
 				auto firstRow = Extract(src.Float(i), 1) - Extract(src.Float(i), 0);
 				auto secondRow = Extract(src.Float(i), 3) - Extract(src.Float(i), 2);
@@ -255,9 +255,9 @@
 				v = Insert(v, secondRow, 2);
 				v = Insert(v, secondRow, 3);
 				dst.move(i, v);
-				break;
 			}
-			case spv::OpDPdyFine:
+			break;
+		case spv::OpDPdyFine:
 			{
 				auto firstColumn = Extract(src.Float(i), 2) - Extract(src.Float(i), 0);
 				auto secondColumn = Extract(src.Float(i), 3) - Extract(src.Float(i), 1);
@@ -265,9 +265,9 @@
 				v = Insert(v, secondColumn, 1);
 				v = Insert(v, secondColumn, 3);
 				dst.move(i, v);
-				break;
 			}
-			case spv::OpFwidthFine:
+			break;
+		case spv::OpFwidthFine:
 			{
 				auto firstRow = Extract(src.Float(i), 1) - Extract(src.Float(i), 0);
 				auto secondRow = Extract(src.Float(i), 3) - Extract(src.Float(i), 2);
@@ -280,9 +280,9 @@
 				dpdy = Insert(dpdy, secondColumn, 1);
 				dpdy = Insert(dpdy, secondColumn, 3);
 				dst.move(i, Abs(dpdx) + Abs(dpdy));
-				break;
 			}
-			case spv::OpQuantizeToF16:
+			break;
+		case spv::OpQuantizeToF16:
 			{
 				// Note: keep in sync with the specialization constant version in EvalSpecConstantUnaryOp
 				auto abs = Abs(src.Float(i));
@@ -296,10 +296,10 @@
 				v = sign | (isInfOrNan & SIMD::Int(0x7F800000)) | (~isInfOrNan & v);
 				v |= isNaN & SIMD::Int(0x400000);
 				dst.move(i, v);
-				break;
 			}
-			default:
-				UNREACHABLE("%s", OpcodeName(insn.opcode()));
+			break;
+		default:
+			UNREACHABLE("%s", OpcodeName(insn.opcode()));
 		}
 	}
 
@@ -318,40 +318,40 @@
 	{
 		switch(insn.opcode())
 		{
-			case spv::OpIAdd:
-				dst.move(i, lhs.Int(i) + rhs.Int(i));
-				break;
-			case spv::OpISub:
-				dst.move(i, lhs.Int(i) - rhs.Int(i));
-				break;
-			case spv::OpIMul:
-				dst.move(i, lhs.Int(i) * rhs.Int(i));
-				break;
-			case spv::OpSDiv:
+		case spv::OpIAdd:
+			dst.move(i, lhs.Int(i) + rhs.Int(i));
+			break;
+		case spv::OpISub:
+			dst.move(i, lhs.Int(i) - rhs.Int(i));
+			break;
+		case spv::OpIMul:
+			dst.move(i, lhs.Int(i) * rhs.Int(i));
+			break;
+		case spv::OpSDiv:
 			{
 				SIMD::Int a = lhs.Int(i);
 				SIMD::Int b = rhs.Int(i);
 				b = b | CmpEQ(b, SIMD::Int(0));                                       // prevent divide-by-zero
 				a = a | (CmpEQ(a, SIMD::Int(0x80000000)) & CmpEQ(b, SIMD::Int(-1)));  // prevent integer overflow
 				dst.move(i, a / b);
-				break;
 			}
-			case spv::OpUDiv:
+			break;
+		case spv::OpUDiv:
 			{
 				auto zeroMask = As<SIMD::UInt>(CmpEQ(rhs.Int(i), SIMD::Int(0)));
 				dst.move(i, lhs.UInt(i) / (rhs.UInt(i) | zeroMask));
-				break;
 			}
-			case spv::OpSRem:
+			break;
+		case spv::OpSRem:
 			{
 				SIMD::Int a = lhs.Int(i);
 				SIMD::Int b = rhs.Int(i);
 				b = b | CmpEQ(b, SIMD::Int(0));                                       // prevent divide-by-zero
 				a = a | (CmpEQ(a, SIMD::Int(0x80000000)) & CmpEQ(b, SIMD::Int(-1)));  // prevent integer overflow
 				dst.move(i, a % b);
-				break;
 			}
-			case spv::OpSMod:
+			break;
+		case spv::OpSMod:
 			{
 				SIMD::Int a = lhs.Int(i);
 				SIMD::Int b = rhs.Int(i);
@@ -367,142 +367,142 @@
 				auto signDiff = CmpNEQ(CmpGE(a, SIMD::Int(0)), CmpGE(b, SIMD::Int(0)));
 				auto fixedMod = mod + (b & CmpNEQ(mod, SIMD::Int(0)) & signDiff);
 				dst.move(i, As<SIMD::Float>(fixedMod));
-				break;
 			}
-			case spv::OpUMod:
+			break;
+		case spv::OpUMod:
 			{
 				auto zeroMask = As<SIMD::UInt>(CmpEQ(rhs.Int(i), SIMD::Int(0)));
 				dst.move(i, lhs.UInt(i) % (rhs.UInt(i) | zeroMask));
-				break;
 			}
-			case spv::OpIEqual:
-			case spv::OpLogicalEqual:
-				dst.move(i, CmpEQ(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpINotEqual:
-			case spv::OpLogicalNotEqual:
-				dst.move(i, CmpNEQ(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpUGreaterThan:
-				dst.move(i, CmpGT(lhs.UInt(i), rhs.UInt(i)));
-				break;
-			case spv::OpSGreaterThan:
-				dst.move(i, CmpGT(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpUGreaterThanEqual:
-				dst.move(i, CmpGE(lhs.UInt(i), rhs.UInt(i)));
-				break;
-			case spv::OpSGreaterThanEqual:
-				dst.move(i, CmpGE(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpULessThan:
-				dst.move(i, CmpLT(lhs.UInt(i), rhs.UInt(i)));
-				break;
-			case spv::OpSLessThan:
-				dst.move(i, CmpLT(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpULessThanEqual:
-				dst.move(i, CmpLE(lhs.UInt(i), rhs.UInt(i)));
-				break;
-			case spv::OpSLessThanEqual:
-				dst.move(i, CmpLE(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpFAdd:
-				dst.move(i, lhs.Float(i) + rhs.Float(i));
-				break;
-			case spv::OpFSub:
-				dst.move(i, lhs.Float(i) - rhs.Float(i));
-				break;
-			case spv::OpFMul:
-				dst.move(i, lhs.Float(i) * rhs.Float(i));
-				break;
-			case spv::OpFDiv:
-				dst.move(i, lhs.Float(i) / rhs.Float(i));
-				break;
-			case spv::OpFMod:
-				// TODO(b/126873455): inaccurate for values greater than 2^24
-				dst.move(i, lhs.Float(i) - rhs.Float(i) * Floor(lhs.Float(i) / rhs.Float(i)));
-				break;
-			case spv::OpFRem:
-				dst.move(i, lhs.Float(i) % rhs.Float(i));
-				break;
-			case spv::OpFOrdEqual:
-				dst.move(i, CmpEQ(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordEqual:
-				dst.move(i, CmpUEQ(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFOrdNotEqual:
-				dst.move(i, CmpNEQ(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordNotEqual:
-				dst.move(i, CmpUNEQ(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFOrdLessThan:
-				dst.move(i, CmpLT(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordLessThan:
-				dst.move(i, CmpULT(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFOrdGreaterThan:
-				dst.move(i, CmpGT(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordGreaterThan:
-				dst.move(i, CmpUGT(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFOrdLessThanEqual:
-				dst.move(i, CmpLE(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordLessThanEqual:
-				dst.move(i, CmpULE(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFOrdGreaterThanEqual:
-				dst.move(i, CmpGE(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpFUnordGreaterThanEqual:
-				dst.move(i, CmpUGE(lhs.Float(i), rhs.Float(i)));
-				break;
-			case spv::OpShiftRightLogical:
-				dst.move(i, lhs.UInt(i) >> rhs.UInt(i));
-				break;
-			case spv::OpShiftRightArithmetic:
-				dst.move(i, lhs.Int(i) >> rhs.Int(i));
-				break;
-			case spv::OpShiftLeftLogical:
-				dst.move(i, lhs.UInt(i) << rhs.UInt(i));
-				break;
-			case spv::OpBitwiseOr:
-			case spv::OpLogicalOr:
-				dst.move(i, lhs.UInt(i) | rhs.UInt(i));
-				break;
-			case spv::OpBitwiseXor:
-				dst.move(i, lhs.UInt(i) ^ rhs.UInt(i));
-				break;
-			case spv::OpBitwiseAnd:
-			case spv::OpLogicalAnd:
-				dst.move(i, lhs.UInt(i) & rhs.UInt(i));
-				break;
-			case spv::OpSMulExtended:
-				// Extended ops: result is a structure containing two members of the same type as lhs & rhs.
-				// In our flat view then, component i is the i'th component of the first member;
-				// component i + N is the i'th component of the second member.
-				dst.move(i, lhs.Int(i) * rhs.Int(i));
-				dst.move(i + lhsType.componentCount, MulHigh(lhs.Int(i), rhs.Int(i)));
-				break;
-			case spv::OpUMulExtended:
-				dst.move(i, lhs.UInt(i) * rhs.UInt(i));
-				dst.move(i + lhsType.componentCount, MulHigh(lhs.UInt(i), rhs.UInt(i)));
-				break;
-			case spv::OpIAddCarry:
-				dst.move(i, lhs.UInt(i) + rhs.UInt(i));
-				dst.move(i + lhsType.componentCount, CmpLT(dst.UInt(i), lhs.UInt(i)) >> 31);
-				break;
-			case spv::OpISubBorrow:
-				dst.move(i, lhs.UInt(i) - rhs.UInt(i));
-				dst.move(i + lhsType.componentCount, CmpLT(lhs.UInt(i), rhs.UInt(i)) >> 31);
-				break;
-			default:
-				UNREACHABLE("%s", OpcodeName(insn.opcode()));
+			break;
+		case spv::OpIEqual:
+		case spv::OpLogicalEqual:
+			dst.move(i, CmpEQ(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpINotEqual:
+		case spv::OpLogicalNotEqual:
+			dst.move(i, CmpNEQ(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpUGreaterThan:
+			dst.move(i, CmpGT(lhs.UInt(i), rhs.UInt(i)));
+			break;
+		case spv::OpSGreaterThan:
+			dst.move(i, CmpGT(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpUGreaterThanEqual:
+			dst.move(i, CmpGE(lhs.UInt(i), rhs.UInt(i)));
+			break;
+		case spv::OpSGreaterThanEqual:
+			dst.move(i, CmpGE(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpULessThan:
+			dst.move(i, CmpLT(lhs.UInt(i), rhs.UInt(i)));
+			break;
+		case spv::OpSLessThan:
+			dst.move(i, CmpLT(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpULessThanEqual:
+			dst.move(i, CmpLE(lhs.UInt(i), rhs.UInt(i)));
+			break;
+		case spv::OpSLessThanEqual:
+			dst.move(i, CmpLE(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpFAdd:
+			dst.move(i, lhs.Float(i) + rhs.Float(i));
+			break;
+		case spv::OpFSub:
+			dst.move(i, lhs.Float(i) - rhs.Float(i));
+			break;
+		case spv::OpFMul:
+			dst.move(i, lhs.Float(i) * rhs.Float(i));
+			break;
+		case spv::OpFDiv:
+			dst.move(i, lhs.Float(i) / rhs.Float(i));
+			break;
+		case spv::OpFMod:
+			// TODO(b/126873455): inaccurate for values greater than 2^24
+			dst.move(i, lhs.Float(i) - rhs.Float(i) * Floor(lhs.Float(i) / rhs.Float(i)));
+			break;
+		case spv::OpFRem:
+			dst.move(i, lhs.Float(i) % rhs.Float(i));
+			break;
+		case spv::OpFOrdEqual:
+			dst.move(i, CmpEQ(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordEqual:
+			dst.move(i, CmpUEQ(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFOrdNotEqual:
+			dst.move(i, CmpNEQ(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordNotEqual:
+			dst.move(i, CmpUNEQ(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFOrdLessThan:
+			dst.move(i, CmpLT(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordLessThan:
+			dst.move(i, CmpULT(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFOrdGreaterThan:
+			dst.move(i, CmpGT(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordGreaterThan:
+			dst.move(i, CmpUGT(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFOrdLessThanEqual:
+			dst.move(i, CmpLE(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordLessThanEqual:
+			dst.move(i, CmpULE(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFOrdGreaterThanEqual:
+			dst.move(i, CmpGE(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpFUnordGreaterThanEqual:
+			dst.move(i, CmpUGE(lhs.Float(i), rhs.Float(i)));
+			break;
+		case spv::OpShiftRightLogical:
+			dst.move(i, lhs.UInt(i) >> rhs.UInt(i));
+			break;
+		case spv::OpShiftRightArithmetic:
+			dst.move(i, lhs.Int(i) >> rhs.Int(i));
+			break;
+		case spv::OpShiftLeftLogical:
+			dst.move(i, lhs.UInt(i) << rhs.UInt(i));
+			break;
+		case spv::OpBitwiseOr:
+		case spv::OpLogicalOr:
+			dst.move(i, lhs.UInt(i) | rhs.UInt(i));
+			break;
+		case spv::OpBitwiseXor:
+			dst.move(i, lhs.UInt(i) ^ rhs.UInt(i));
+			break;
+		case spv::OpBitwiseAnd:
+		case spv::OpLogicalAnd:
+			dst.move(i, lhs.UInt(i) & rhs.UInt(i));
+			break;
+		case spv::OpSMulExtended:
+			// Extended ops: result is a structure containing two members of the same type as lhs & rhs.
+			// In our flat view then, component i is the i'th component of the first member;
+			// component i + N is the i'th component of the second member.
+			dst.move(i, lhs.Int(i) * rhs.Int(i));
+			dst.move(i + lhsType.componentCount, MulHigh(lhs.Int(i), rhs.Int(i)));
+			break;
+		case spv::OpUMulExtended:
+			dst.move(i, lhs.UInt(i) * rhs.UInt(i));
+			dst.move(i + lhsType.componentCount, MulHigh(lhs.UInt(i), rhs.UInt(i)));
+			break;
+		case spv::OpIAddCarry:
+			dst.move(i, lhs.UInt(i) + rhs.UInt(i));
+			dst.move(i + lhsType.componentCount, CmpLT(dst.UInt(i), lhs.UInt(i)) >> 31);
+			break;
+		case spv::OpISubBorrow:
+			dst.move(i, lhs.UInt(i) - rhs.UInt(i));
+			dst.move(i + lhsType.componentCount, CmpLT(lhs.UInt(i), rhs.UInt(i)) >> 31);
+			break;
+		default:
+			UNREACHABLE("%s", OpcodeName(insn.opcode()));
 		}
 	}
 
diff --git a/src/Pipeline/SpirvShaderControlFlow.cpp b/src/Pipeline/SpirvShaderControlFlow.cpp
index 826d9ff..68375be 100644
--- a/src/Pipeline/SpirvShaderControlFlow.cpp
+++ b/src/Pipeline/SpirvShaderControlFlow.cpp
@@ -45,75 +45,75 @@
 
 	switch(insns[1].opcode())
 	{
-		case spv::OpBranch:
-			branchInstruction = insns[1];
-			outs.emplace(Block::ID(branchInstruction.word(1)));
+	case spv::OpBranch:
+		branchInstruction = insns[1];
+		outs.emplace(Block::ID(branchInstruction.word(1)));
 
-			switch(insns[0].opcode())
-			{
-				case spv::OpLoopMerge:
-					kind = Loop;
-					mergeInstruction = insns[0];
-					mergeBlock = Block::ID(mergeInstruction.word(1));
-					continueTarget = Block::ID(mergeInstruction.word(2));
-					break;
-
-				default:
-					kind = Block::Simple;
-					break;
-			}
-			break;
-
-		case spv::OpBranchConditional:
-			branchInstruction = insns[1];
-			outs.emplace(Block::ID(branchInstruction.word(2)));
-			outs.emplace(Block::ID(branchInstruction.word(3)));
-
-			switch(insns[0].opcode())
-			{
-				case spv::OpSelectionMerge:
-					kind = StructuredBranchConditional;
-					mergeInstruction = insns[0];
-					mergeBlock = Block::ID(mergeInstruction.word(1));
-					break;
-
-				case spv::OpLoopMerge:
-					kind = Loop;
-					mergeInstruction = insns[0];
-					mergeBlock = Block::ID(mergeInstruction.word(1));
-					continueTarget = Block::ID(mergeInstruction.word(2));
-					break;
-
-				default:
-					kind = UnstructuredBranchConditional;
-					break;
-			}
-			break;
-
-		case spv::OpSwitch:
-			branchInstruction = insns[1];
-			outs.emplace(Block::ID(branchInstruction.word(2)));
-			for(uint32_t w = 4; w < branchInstruction.wordCount(); w += 2)
-			{
-				outs.emplace(Block::ID(branchInstruction.word(w)));
-			}
-
-			switch(insns[0].opcode())
-			{
-				case spv::OpSelectionMerge:
-					kind = StructuredSwitch;
-					mergeInstruction = insns[0];
-					mergeBlock = Block::ID(mergeInstruction.word(1));
-					break;
-
-				default:
-					kind = UnstructuredSwitch;
-					break;
-			}
+		switch(insns[0].opcode())
+		{
+		case spv::OpLoopMerge:
+			kind = Loop;
+			mergeInstruction = insns[0];
+			mergeBlock = Block::ID(mergeInstruction.word(1));
+			continueTarget = Block::ID(mergeInstruction.word(2));
 			break;
 
 		default:
+			kind = Block::Simple;
 			break;
+		}
+		break;
+
+	case spv::OpBranchConditional:
+		branchInstruction = insns[1];
+		outs.emplace(Block::ID(branchInstruction.word(2)));
+		outs.emplace(Block::ID(branchInstruction.word(3)));
+
+		switch(insns[0].opcode())
+		{
+		case spv::OpSelectionMerge:
+			kind = StructuredBranchConditional;
+			mergeInstruction = insns[0];
+			mergeBlock = Block::ID(mergeInstruction.word(1));
+			break;
+
+		case spv::OpLoopMerge:
+			kind = Loop;
+			mergeInstruction = insns[0];
+			mergeBlock = Block::ID(mergeInstruction.word(1));
+			continueTarget = Block::ID(mergeInstruction.word(2));
+			break;
+
+		default:
+			kind = UnstructuredBranchConditional;
+			break;
+		}
+		break;
+
+	case spv::OpSwitch:
+		branchInstruction = insns[1];
+		outs.emplace(Block::ID(branchInstruction.word(2)));
+		for(uint32_t w = 4; w < branchInstruction.wordCount(); w += 2)
+		{
+			outs.emplace(Block::ID(branchInstruction.word(w)));
+		}
+
+		switch(insns[0].opcode())
+		{
+		case spv::OpSelectionMerge:
+			kind = StructuredSwitch;
+			mergeInstruction = insns[0];
+			mergeBlock = Block::ID(mergeInstruction.word(1));
+			break;
+
+		default:
+			kind = UnstructuredSwitch;
+			break;
+		}
+		break;
+
+	default:
+		break;
 	}
 }
 
@@ -264,20 +264,20 @@
 
 		switch(block.kind)
 		{
-			case Block::Simple:
-			case Block::StructuredBranchConditional:
-			case Block::UnstructuredBranchConditional:
-			case Block::StructuredSwitch:
-			case Block::UnstructuredSwitch:
-				EmitNonLoop(state);
-				break;
+		case Block::Simple:
+		case Block::StructuredBranchConditional:
+		case Block::UnstructuredBranchConditional:
+		case Block::StructuredSwitch:
+		case Block::UnstructuredSwitch:
+			EmitNonLoop(state);
+			break;
 
-			case Block::Loop:
-				EmitLoop(state);
-				break;
+		case Block::Loop:
+			EmitLoop(state);
+			break;
 
-			default:
-				UNREACHABLE("Unexpected Block Kind: %d", int(block.kind));
+		default:
+			UNREACHABLE("Unexpected Block Kind: %d", int(block.kind));
 		}
 	}
 
@@ -629,15 +629,15 @@
 
 	switch(executionScope)
 	{
-		case spv::ScopeWorkgroup:
-			Yield(YieldResult::ControlBarrier);
-			break;
-		case spv::ScopeSubgroup:
-			break;
-		default:
-			// See Vulkan 1.1 spec, Appendix A, Validation Rules within a Module.
-			UNREACHABLE("Scope for execution must be limited to Workgroup or Subgroup");
-			break;
+	case spv::ScopeWorkgroup:
+		Yield(YieldResult::ControlBarrier);
+		break;
+	case spv::ScopeSubgroup:
+		break;
+	default:
+		// See Vulkan 1.1 spec, Appendix A, Validation Rules within a Module.
+		UNREACHABLE("Scope for execution must be limited to Workgroup or Subgroup");
+		break;
 	}
 
 	return EmitResult::Continue;
diff --git a/src/Pipeline/SpirvShaderDebug.hpp b/src/Pipeline/SpirvShaderDebug.hpp
index 6aa0c7c..5418a8b 100644
--- a/src/Pipeline/SpirvShaderDebug.hpp
+++ b/src/Pipeline/SpirvShaderDebug.hpp
@@ -75,12 +75,12 @@
 	{
 		switch(v.typeHint)
 		{
-			case sw::Intermediate::TypeHint::Float:
-				return PrintValue::Ty<sw::SIMD::Float>::fmt(v.Float(i));
-			case sw::Intermediate::TypeHint::Int:
-				return PrintValue::Ty<sw::SIMD::Int>::fmt(v.Int(i));
-			case sw::Intermediate::TypeHint::UInt:
-				return PrintValue::Ty<sw::SIMD::UInt>::fmt(v.UInt(i));
+		case sw::Intermediate::TypeHint::Float:
+			return PrintValue::Ty<sw::SIMD::Float>::fmt(v.Float(i));
+		case sw::Intermediate::TypeHint::Int:
+			return PrintValue::Ty<sw::SIMD::Int>::fmt(v.Int(i));
+		case sw::Intermediate::TypeHint::UInt:
+			return PrintValue::Ty<sw::SIMD::UInt>::fmt(v.UInt(i));
 		}
 		return "";
 	}
@@ -89,12 +89,12 @@
 	{
 		switch(v.typeHint)
 		{
-			case sw::Intermediate::TypeHint::Float:
-				return PrintValue::Ty<sw::SIMD::Float>::val(v.Float(i));
-			case sw::Intermediate::TypeHint::Int:
-				return PrintValue::Ty<sw::SIMD::Int>::val(v.Int(i));
-			case sw::Intermediate::TypeHint::UInt:
-				return PrintValue::Ty<sw::SIMD::UInt>::val(v.UInt(i));
+		case sw::Intermediate::TypeHint::Float:
+			return PrintValue::Ty<sw::SIMD::Float>::val(v.Float(i));
+		case sw::Intermediate::TypeHint::Int:
+			return PrintValue::Ty<sw::SIMD::Int>::val(v.Int(i));
+		case sw::Intermediate::TypeHint::UInt:
+			return PrintValue::Ty<sw::SIMD::UInt>::val(v.UInt(i));
 		}
 		return {};
 	}
diff --git a/src/Pipeline/SpirvShaderDebugger.cpp b/src/Pipeline/SpirvShaderDebugger.cpp
index 4120b1f..0d3704b 100644
--- a/src/Pipeline/SpirvShaderDebugger.cpp
+++ b/src/Pipeline/SpirvShaderDebugger.cpp
@@ -120,10 +120,10 @@
 {
 	switch(type)
 	{
-		case spv::ExecutionModelGLCompute: return name == "ComputeShader";
-		case spv::ExecutionModelFragment: return name == "FragmentShader";
-		case spv::ExecutionModelVertex: return name == "VertexShader";
-		default: return false;
+	case spv::ExecutionModelGLCompute: return name == "ComputeShader";
+	case spv::ExecutionModelFragment: return name == "FragmentShader";
+	case spv::ExecutionModelVertex: return name == "VertexShader";
+	default: return false;
 	}
 }
 
@@ -382,27 +382,27 @@
 {
 	switch(k)
 	{
-		case Object::Kind::Object: return "Object";
-		case Object::Kind::Declare: return "Declare";
-		case Object::Kind::Expression: return "Expression";
-		case Object::Kind::Function: return "Function";
-		case Object::Kind::InlinedAt: return "InlinedAt";
-		case Object::Kind::GlobalVariable: return "GlobalVariable";
-		case Object::Kind::LocalVariable: return "LocalVariable";
-		case Object::Kind::Member: return "Member";
-		case Object::Kind::Operation: return "Operation";
-		case Object::Kind::Source: return "Source";
-		case Object::Kind::SourceScope: return "SourceScope";
-		case Object::Kind::Value: return "Value";
-		case Object::Kind::TemplateParameter: return "TemplateParameter";
-		case Object::Kind::CompilationUnit: return "CompilationUnit";
-		case Object::Kind::LexicalBlock: return "LexicalBlock";
-		case Object::Kind::BasicType: return "BasicType";
-		case Object::Kind::ArrayType: return "ArrayType";
-		case Object::Kind::VectorType: return "VectorType";
-		case Object::Kind::FunctionType: return "FunctionType";
-		case Object::Kind::CompositeType: return "CompositeType";
-		case Object::Kind::TemplateType: return "TemplateType";
+	case Object::Kind::Object: return "Object";
+	case Object::Kind::Declare: return "Declare";
+	case Object::Kind::Expression: return "Expression";
+	case Object::Kind::Function: return "Function";
+	case Object::Kind::InlinedAt: return "InlinedAt";
+	case Object::Kind::GlobalVariable: return "GlobalVariable";
+	case Object::Kind::LocalVariable: return "LocalVariable";
+	case Object::Kind::Member: return "Member";
+	case Object::Kind::Operation: return "Operation";
+	case Object::Kind::Source: return "Source";
+	case Object::Kind::SourceScope: return "SourceScope";
+	case Object::Kind::Value: return "Value";
+	case Object::Kind::TemplateParameter: return "TemplateParameter";
+	case Object::Kind::CompilationUnit: return "CompilationUnit";
+	case Object::Kind::LexicalBlock: return "LexicalBlock";
+	case Object::Kind::BasicType: return "BasicType";
+	case Object::Kind::ArrayType: return "ArrayType";
+	case Object::Kind::VectorType: return "VectorType";
+	case Object::Kind::FunctionType: return "FunctionType";
+	case Object::Kind::CompositeType: return "CompositeType";
+	case Object::Kind::TemplateType: return "TemplateType";
 	}
 	return "<unknown>";
 }
@@ -563,25 +563,25 @@
 
 		switch(encoding)
 		{
-			case OpenCLDebugInfo100Address:
-				// return vk::dbg::make_reference(*static_cast<void **>(ptr));
-				UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 OpenCLDebugInfo100Address BasicType");
-				return nullptr;
-			case OpenCLDebugInfo100Boolean:
-				return vk::dbg::make_reference(*static_cast<bool *>(ptr));
-			case OpenCLDebugInfo100Float:
-				return vk::dbg::make_reference(*static_cast<float *>(ptr));
-			case OpenCLDebugInfo100Signed:
-				return vk::dbg::make_reference(*static_cast<int32_t *>(ptr));
-			case OpenCLDebugInfo100SignedChar:
-				return vk::dbg::make_reference(*static_cast<int8_t *>(ptr));
-			case OpenCLDebugInfo100Unsigned:
-				return vk::dbg::make_reference(*static_cast<uint32_t *>(ptr));
-			case OpenCLDebugInfo100UnsignedChar:
-				return vk::dbg::make_reference(*static_cast<uint8_t *>(ptr));
-			default:
-				UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 encoding %d", int(encoding));
-				return nullptr;
+		case OpenCLDebugInfo100Address:
+			// return vk::dbg::make_reference(*static_cast<void **>(ptr));
+			UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 OpenCLDebugInfo100Address BasicType");
+			return nullptr;
+		case OpenCLDebugInfo100Boolean:
+			return vk::dbg::make_reference(*static_cast<bool *>(ptr));
+		case OpenCLDebugInfo100Float:
+			return vk::dbg::make_reference(*static_cast<float *>(ptr));
+		case OpenCLDebugInfo100Signed:
+			return vk::dbg::make_reference(*static_cast<int32_t *>(ptr));
+		case OpenCLDebugInfo100SignedChar:
+			return vk::dbg::make_reference(*static_cast<int8_t *>(ptr));
+		case OpenCLDebugInfo100Unsigned:
+			return vk::dbg::make_reference(*static_cast<uint32_t *>(ptr));
+		case OpenCLDebugInfo100UnsignedChar:
+			return vk::dbg::make_reference(*static_cast<uint8_t *>(ptr));
+		default:
+			UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 encoding %d", int(encoding));
+			return nullptr;
 		}
 	}
 };
@@ -917,10 +917,10 @@
 {
 	switch(def)
 	{
-		case LocalVariable::Definition::Undefined: return "Undefined";
-		case LocalVariable::Definition::Declaration: return "Declaration";
-		case LocalVariable::Definition::Values: return "Values";
-		default: return "<unknown>";
+	case LocalVariable::Definition::Undefined: return "Undefined";
+	case LocalVariable::Definition::Declaration: return "Declaration";
+	case LocalVariable::Definition::Values: return "Values";
+	default: return "<unknown>";
 	}
 }
 
@@ -1562,12 +1562,12 @@
 	auto id = SpirvID<T>(insn.word(2));
 	switch(pass)
 	{
-		case Pass::Define:
-			add(id, std::unique_ptr<debug::Object>(new T()));
-			break;
-		case Pass::Emit:
-			emit(get<T>(id));
-			break;
+	case Pass::Define:
+		add(id, std::unique_ptr<debug::Object>(new T()));
+		break;
+	case Pass::Emit:
+		emit(get<T>(id));
+		break;
 	}
 }
 
@@ -1576,320 +1576,320 @@
 	auto extInstIndex = insn.word(4);
 	switch(extInstIndex)
 	{
-		case OpenCLDebugInfo100DebugInfoNone:
-			if(pass == Pass::Define)
+	case OpenCLDebugInfo100DebugInfoNone:
+		if(pass == Pass::Define)
+		{
+			addNone(debug::Object::ID(insn.word(2)));
+		}
+		break;
+	case OpenCLDebugInfo100DebugCompilationUnit:
+		defineOrEmit(insn, pass, [&](debug::CompilationUnit *cu) {
+			cu->source = get(debug::Source::ID(insn.word(7)));
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeBasic:
+		defineOrEmit(insn, pass, [&](debug::BasicType *type) {
+			type->name_ = shader->getString(insn.word(5));
+			type->size = shader->GetConstScalarInt(insn.word(6));
+			type->encoding = static_cast<OpenCLDebugInfo100DebugBaseTypeAttributeEncoding>(insn.word(7));
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeArray:
+		defineOrEmit(insn, pass, [&](debug::ArrayType *type) {
+			type->base = get(debug::Type::ID(insn.word(5)));
+			type->size = shader->GetConstScalarInt(insn.word(6));
+			for(uint32_t i = 7; i < insn.wordCount(); i++)
 			{
-				addNone(debug::Object::ID(insn.word(2)));
+				// Decompose multi-dimentional into nested single
+				// dimensional arrays. Greatly simplifies logic.
+				auto inner = new debug::ArrayType();
+				inner->base = type->base;
+				type->size = shader->GetConstScalarInt(insn.word(i));
+				type->base = inner;
+				type->ownsBase = true;
+				type = inner;
 			}
-			break;
-		case OpenCLDebugInfo100DebugCompilationUnit:
-			defineOrEmit(insn, pass, [&](debug::CompilationUnit *cu) {
-				cu->source = get(debug::Source::ID(insn.word(7)));
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeBasic:
-			defineOrEmit(insn, pass, [&](debug::BasicType *type) {
-				type->name_ = shader->getString(insn.word(5));
-				type->size = shader->GetConstScalarInt(insn.word(6));
-				type->encoding = static_cast<OpenCLDebugInfo100DebugBaseTypeAttributeEncoding>(insn.word(7));
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeArray:
-			defineOrEmit(insn, pass, [&](debug::ArrayType *type) {
-				type->base = get(debug::Type::ID(insn.word(5)));
-				type->size = shader->GetConstScalarInt(insn.word(6));
-				for(uint32_t i = 7; i < insn.wordCount(); i++)
-				{
-					// Decompose multi-dimentional into nested single
-					// dimensional arrays. Greatly simplifies logic.
-					auto inner = new debug::ArrayType();
-					inner->base = type->base;
-					type->size = shader->GetConstScalarInt(insn.word(i));
-					type->base = inner;
-					type->ownsBase = true;
-					type = inner;
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeVector:
-			defineOrEmit(insn, pass, [&](debug::VectorType *type) {
-				type->base = get(debug::Type::ID(insn.word(5)));
-				type->components = insn.word(6);
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeFunction:
-			defineOrEmit(insn, pass, [&](debug::FunctionType *type) {
-				type->flags = insn.word(5);
-				type->returnTy = getOrNull(debug::Type::ID(insn.word(6)));
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeVector:
+		defineOrEmit(insn, pass, [&](debug::VectorType *type) {
+			type->base = get(debug::Type::ID(insn.word(5)));
+			type->components = insn.word(6);
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeFunction:
+		defineOrEmit(insn, pass, [&](debug::FunctionType *type) {
+			type->flags = insn.word(5);
+			type->returnTy = getOrNull(debug::Type::ID(insn.word(6)));
 
-				// 'Return Type' operand must be a debug type or OpTypeVoid. See
-				// https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.DebugInfo.100.html#DebugTypeFunction
-				ASSERT_MSG(type->returnTy != nullptr || shader->getType(insn.word(6)).opcode() == spv::Op::OpTypeVoid, "Invalid return type of DebugTypeFunction: %d", insn.word(6));
+			// 'Return Type' operand must be a debug type or OpTypeVoid. See
+			// https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.DebugInfo.100.html#DebugTypeFunction
+			ASSERT_MSG(type->returnTy != nullptr || shader->getType(insn.word(6)).opcode() == spv::Op::OpTypeVoid, "Invalid return type of DebugTypeFunction: %d", insn.word(6));
 
-				for(uint32_t i = 7; i < insn.wordCount(); i++)
+			for(uint32_t i = 7; i < insn.wordCount(); i++)
+			{
+				type->paramTys.push_back(get(debug::Type::ID(insn.word(i))));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeComposite:
+		defineOrEmit(insn, pass, [&](debug::CompositeType *type) {
+			type->name_ = shader->getString(insn.word(5));
+			type->tag = static_cast<OpenCLDebugInfo100DebugCompositeType>(insn.word(6));
+			type->source = get(debug::Source::ID(insn.word(7)));
+			type->line = insn.word(8);
+			type->column = insn.word(9);
+			type->parent = get(debug::Object::ID(insn.word(10)));
+			type->linkage = shader->getString(insn.word(11));
+			type->size = isNone(insn.word(12)) ? 0 : shader->GetConstScalarInt(insn.word(12));
+			type->flags = insn.word(13);
+			for(uint32_t i = 14; i < insn.wordCount(); i++)
+			{
+				auto obj = get(debug::Object::ID(insn.word(i)));
+				if(auto member = debug::cast<debug::Member>(obj))  // Can also be Function or TypeInheritance, which we don't care about.
 				{
-					type->paramTys.push_back(get(debug::Type::ID(insn.word(i))));
+					type->members_.push_back(member);
 				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeComposite:
-			defineOrEmit(insn, pass, [&](debug::CompositeType *type) {
-				type->name_ = shader->getString(insn.word(5));
-				type->tag = static_cast<OpenCLDebugInfo100DebugCompositeType>(insn.word(6));
-				type->source = get(debug::Source::ID(insn.word(7)));
-				type->line = insn.word(8);
-				type->column = insn.word(9);
-				type->parent = get(debug::Object::ID(insn.word(10)));
-				type->linkage = shader->getString(insn.word(11));
-				type->size = isNone(insn.word(12)) ? 0 : shader->GetConstScalarInt(insn.word(12));
-				type->flags = insn.word(13);
-				for(uint32_t i = 14; i < insn.wordCount(); i++)
-				{
-					auto obj = get(debug::Object::ID(insn.word(i)));
-					if(auto member = debug::cast<debug::Member>(obj))  // Can also be Function or TypeInheritance, which we don't care about.
-					{
-						type->members_.push_back(member);
-					}
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeMember:
-			defineOrEmit(insn, pass, [&](debug::Member *member) {
-				member->name = shader->getString(insn.word(5));
-				member->type = get(debug::Type::ID(insn.word(6)));
-				member->source = get(debug::Source::ID(insn.word(7)));
-				member->line = insn.word(8);
-				member->column = insn.word(9);
-				member->parent = get(debug::CompositeType::ID(insn.word(10)));
-				member->offset = shader->GetConstScalarInt(insn.word(11));
-				member->size = shader->GetConstScalarInt(insn.word(12));
-				member->flags = insn.word(13);
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeTemplate:
-			defineOrEmit(insn, pass, [&](debug::TemplateType *tpl) {
-				tpl->target = get(debug::Type::ID(insn.word(5)));
-				for(size_t i = 6, c = insn.wordCount(); i < c; i++)
-				{
-					tpl->parameters.emplace_back(get(debug::TemplateParameter::ID(insn.word(i))));
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugTypeTemplateParameter:
-			defineOrEmit(insn, pass, [&](debug::TemplateParameter *param) {
-				param->name = shader->getString(insn.word(5));
-				param->type = get(debug::Type::ID(insn.word(6)));
-				param->value = 0;  // TODO: Get value from OpConstant if "a template value parameter".
-				param->source = get(debug::Source::ID(insn.word(8)));
-				param->line = insn.word(9);
-				param->column = insn.word(10);
-			});
-			break;
-		case OpenCLDebugInfo100DebugGlobalVariable:
-			defineOrEmit(insn, pass, [&](debug::GlobalVariable *var) {
-				var->name = shader->getString(insn.word(5));
-				var->type = get(debug::Type::ID(insn.word(6)));
-				var->source = get(debug::Source::ID(insn.word(7)));
-				var->line = insn.word(8);
-				var->column = insn.word(9);
-				var->parent = get(debug::Scope::ID(insn.word(10)));
-				var->linkage = shader->getString(insn.word(11));
-				var->variable = isNone(insn.word(12)) ? 0 : insn.word(12);
-				var->flags = insn.word(13);
-				// static member declaration: word(14)
-			});
-			break;
-		case OpenCLDebugInfo100DebugFunction:
-			defineOrEmit(insn, pass, [&](debug::Function *func) {
-				func->name = shader->getString(insn.word(5));
-				func->type = get(debug::FunctionType::ID(insn.word(6)));
-				func->source = get(debug::Source::ID(insn.word(7)));
-				func->declLine = insn.word(8);
-				func->declColumn = insn.word(9);
-				func->parent = get(debug::Scope::ID(insn.word(10)));
-				func->linkage = shader->getString(insn.word(11));
-				func->flags = insn.word(12);
-				func->line = insn.word(13);
-				func->function = Function::ID(insn.word(14));
-				// declaration: word(13)
-			});
-			break;
-		case OpenCLDebugInfo100DebugLexicalBlock:
-			defineOrEmit(insn, pass, [&](debug::LexicalBlock *scope) {
-				scope->source = get(debug::Source::ID(insn.word(5)));
-				scope->line = insn.word(6);
-				scope->column = insn.word(7);
-				scope->parent = get(debug::Scope::ID(insn.word(8)));
-				if(insn.wordCount() > 9)
-				{
-					scope->name = shader->getString(insn.word(9));
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugScope:
-			defineOrEmit(insn, pass, [&](debug::SourceScope *ss) {
-				ss->scope = get(debug::Scope::ID(insn.word(5)));
-				if(insn.wordCount() > 6)
-				{
-					ss->inlinedAt = get(debug::InlinedAt::ID(insn.word(6)));
-				}
-				setScope(ss);
-			});
-			break;
-		case OpenCLDebugInfo100DebugNoScope:
-			break;
-		case OpenCLDebugInfo100DebugInlinedAt:
-			defineOrEmit(insn, pass, [&](debug::InlinedAt *ia) {
-				ia->line = insn.word(5);
-				ia->scope = get(debug::Scope::ID(insn.word(6)));
-				if(insn.wordCount() > 7)
-				{
-					ia->inlined = get(debug::InlinedAt::ID(insn.word(7)));
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugLocalVariable:
-			defineOrEmit(insn, pass, [&](debug::LocalVariable *var) {
-				var->name = shader->getString(insn.word(5));
-				var->type = get(debug::Type::ID(insn.word(6)));
-				var->source = get(debug::Source::ID(insn.word(7)));
-				var->line = insn.word(8);
-				var->column = insn.word(9);
-				var->parent = get(debug::Scope::ID(insn.word(10)));
-				if(insn.wordCount() > 11)
-				{
-					var->arg = insn.word(11);
-				}
-				if(auto block = debug::find<debug::LexicalBlock>(var->parent))
-				{
-					block->variables.emplace_back(var);
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugDeclare:
-			defineOrEmit(insn, pass, [&](debug::Declare *decl) {
-				decl->local = get(debug::LocalVariable::ID(insn.word(5)));
-				decl->variable = Object::ID(insn.word(6));
-				decl->expression = get(debug::Expression::ID(insn.word(7)));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeMember:
+		defineOrEmit(insn, pass, [&](debug::Member *member) {
+			member->name = shader->getString(insn.word(5));
+			member->type = get(debug::Type::ID(insn.word(6)));
+			member->source = get(debug::Source::ID(insn.word(7)));
+			member->line = insn.word(8);
+			member->column = insn.word(9);
+			member->parent = get(debug::CompositeType::ID(insn.word(10)));
+			member->offset = shader->GetConstScalarInt(insn.word(11));
+			member->size = shader->GetConstScalarInt(insn.word(12));
+			member->flags = insn.word(13);
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeTemplate:
+		defineOrEmit(insn, pass, [&](debug::TemplateType *tpl) {
+			tpl->target = get(debug::Type::ID(insn.word(5)));
+			for(size_t i = 6, c = insn.wordCount(); i < c; i++)
+			{
+				tpl->parameters.emplace_back(get(debug::TemplateParameter::ID(insn.word(i))));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugTypeTemplateParameter:
+		defineOrEmit(insn, pass, [&](debug::TemplateParameter *param) {
+			param->name = shader->getString(insn.word(5));
+			param->type = get(debug::Type::ID(insn.word(6)));
+			param->value = 0;  // TODO: Get value from OpConstant if "a template value parameter".
+			param->source = get(debug::Source::ID(insn.word(8)));
+			param->line = insn.word(9);
+			param->column = insn.word(10);
+		});
+		break;
+	case OpenCLDebugInfo100DebugGlobalVariable:
+		defineOrEmit(insn, pass, [&](debug::GlobalVariable *var) {
+			var->name = shader->getString(insn.word(5));
+			var->type = get(debug::Type::ID(insn.word(6)));
+			var->source = get(debug::Source::ID(insn.word(7)));
+			var->line = insn.word(8);
+			var->column = insn.word(9);
+			var->parent = get(debug::Scope::ID(insn.word(10)));
+			var->linkage = shader->getString(insn.word(11));
+			var->variable = isNone(insn.word(12)) ? 0 : insn.word(12);
+			var->flags = insn.word(13);
+			// static member declaration: word(14)
+		});
+		break;
+	case OpenCLDebugInfo100DebugFunction:
+		defineOrEmit(insn, pass, [&](debug::Function *func) {
+			func->name = shader->getString(insn.word(5));
+			func->type = get(debug::FunctionType::ID(insn.word(6)));
+			func->source = get(debug::Source::ID(insn.word(7)));
+			func->declLine = insn.word(8);
+			func->declColumn = insn.word(9);
+			func->parent = get(debug::Scope::ID(insn.word(10)));
+			func->linkage = shader->getString(insn.word(11));
+			func->flags = insn.word(12);
+			func->line = insn.word(13);
+			func->function = Function::ID(insn.word(14));
+			// declaration: word(13)
+		});
+		break;
+	case OpenCLDebugInfo100DebugLexicalBlock:
+		defineOrEmit(insn, pass, [&](debug::LexicalBlock *scope) {
+			scope->source = get(debug::Source::ID(insn.word(5)));
+			scope->line = insn.word(6);
+			scope->column = insn.word(7);
+			scope->parent = get(debug::Scope::ID(insn.word(8)));
+			if(insn.wordCount() > 9)
+			{
+				scope->name = shader->getString(insn.word(9));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugScope:
+		defineOrEmit(insn, pass, [&](debug::SourceScope *ss) {
+			ss->scope = get(debug::Scope::ID(insn.word(5)));
+			if(insn.wordCount() > 6)
+			{
+				ss->inlinedAt = get(debug::InlinedAt::ID(insn.word(6)));
+			}
+			setScope(ss);
+		});
+		break;
+	case OpenCLDebugInfo100DebugNoScope:
+		break;
+	case OpenCLDebugInfo100DebugInlinedAt:
+		defineOrEmit(insn, pass, [&](debug::InlinedAt *ia) {
+			ia->line = insn.word(5);
+			ia->scope = get(debug::Scope::ID(insn.word(6)));
+			if(insn.wordCount() > 7)
+			{
+				ia->inlined = get(debug::InlinedAt::ID(insn.word(7)));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugLocalVariable:
+		defineOrEmit(insn, pass, [&](debug::LocalVariable *var) {
+			var->name = shader->getString(insn.word(5));
+			var->type = get(debug::Type::ID(insn.word(6)));
+			var->source = get(debug::Source::ID(insn.word(7)));
+			var->line = insn.word(8);
+			var->column = insn.word(9);
+			var->parent = get(debug::Scope::ID(insn.word(10)));
+			if(insn.wordCount() > 11)
+			{
+				var->arg = insn.word(11);
+			}
+			if(auto block = debug::find<debug::LexicalBlock>(var->parent))
+			{
+				block->variables.emplace_back(var);
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugDeclare:
+		defineOrEmit(insn, pass, [&](debug::Declare *decl) {
+			decl->local = get(debug::LocalVariable::ID(insn.word(5)));
+			decl->variable = Object::ID(insn.word(6));
+			decl->expression = get(debug::Expression::ID(insn.word(7)));
 
-				decl->local->declaration = decl;
+			decl->local->declaration = decl;
 
-				ASSERT_MSG(decl->local->definition == debug::LocalVariable::Definition::Undefined,
+			ASSERT_MSG(decl->local->definition == debug::LocalVariable::Definition::Undefined,
+			           "DebugLocalVariable '%s' declared at %s:%d was previously defined as %s, now again as %s",
+			           decl->local->name.c_str(),
+			           decl->local->source ? decl->local->source->file.c_str() : "<unknown>",
+			           (int)decl->local->line,
+			           tostring(decl->local->definition),
+			           tostring(debug::LocalVariable::Definition::Declaration));
+			decl->local->definition = debug::LocalVariable::Definition::Declaration;
+		});
+		break;
+	case OpenCLDebugInfo100DebugValue:
+		defineOrEmit(insn, pass, [&](debug::Value *value) {
+			value->local = get(debug::LocalVariable::ID(insn.word(5)));
+			value->value = insn.word(6);
+			value->expression = get(debug::Expression::ID(insn.word(7)));
+
+			if(value->local->definition == debug::LocalVariable::Definition::Undefined)
+			{
+				value->local->definition = debug::LocalVariable::Definition::Values;
+			}
+			else
+			{
+				ASSERT_MSG(value->local->definition == debug::LocalVariable::Definition::Values,
 				           "DebugLocalVariable '%s' declared at %s:%d was previously defined as %s, now again as %s",
-				           decl->local->name.c_str(),
-				           decl->local->source ? decl->local->source->file.c_str() : "<unknown>",
-				           (int)decl->local->line,
-				           tostring(decl->local->definition),
-				           tostring(debug::LocalVariable::Definition::Declaration));
-				decl->local->definition = debug::LocalVariable::Definition::Declaration;
-			});
-			break;
-		case OpenCLDebugInfo100DebugValue:
-			defineOrEmit(insn, pass, [&](debug::Value *value) {
-				value->local = get(debug::LocalVariable::ID(insn.word(5)));
-				value->value = insn.word(6);
-				value->expression = get(debug::Expression::ID(insn.word(7)));
+				           value->local->name.c_str(),
+				           value->local->source ? value->local->source->file.c_str() : "<unknown>",
+				           (int)value->local->line,
+				           tostring(value->local->definition),
+				           tostring(debug::LocalVariable::Definition::Values));
+			}
 
-				if(value->local->definition == debug::LocalVariable::Definition::Undefined)
+			auto node = &value->local->values;
+			for(uint32_t i = 8; i < insn.wordCount(); i++)
+			{
+				auto idx = shader->GetConstScalarInt(insn.word(i));
+				value->indexes.push_back(idx);
+
+				auto it = node->children.find(idx);
+				if(it != node->children.end())
 				{
-					value->local->definition = debug::LocalVariable::Definition::Values;
+					node = it->second.get();
 				}
 				else
 				{
-					ASSERT_MSG(value->local->definition == debug::LocalVariable::Definition::Values,
-					           "DebugLocalVariable '%s' declared at %s:%d was previously defined as %s, now again as %s",
-					           value->local->name.c_str(),
-					           value->local->source ? value->local->source->file.c_str() : "<unknown>",
-					           (int)value->local->line,
-					           tostring(value->local->definition),
-					           tostring(debug::LocalVariable::Definition::Values));
+					auto parent = node;
+					auto child = std::make_unique<debug::LocalVariable::ValueNode>();
+					node = child.get();
+					parent->children.emplace(idx, std::move(child));
 				}
+			}
 
-				auto node = &value->local->values;
-				for(uint32_t i = 8; i < insn.wordCount(); i++)
-				{
-					auto idx = shader->GetConstScalarInt(insn.word(i));
-					value->indexes.push_back(idx);
+			if(node->debugValueIndex == debug::LocalVariable::ValueNode::NoDebugValueIndex)
+			{
+				node->debugValueIndex = numDebugValueSlots++;
+			}
 
-					auto it = node->children.find(idx);
-					if(it != node->children.end())
-					{
-						node = it->second.get();
-					}
-					else
-					{
-						auto parent = node;
-						auto child = std::make_unique<debug::LocalVariable::ValueNode>();
-						node = child.get();
-						parent->children.emplace(idx, std::move(child));
-					}
-				}
+			rr::Pointer<rr::Pointer<Byte>> lastReachedArray = *rr::Pointer<rr::Pointer<rr::Pointer<Byte>>>(
+			    state->routine->dbgState + OFFSET(Impl::Debugger::State, lastReachedDebugValues));
+			rr::Pointer<rr::Pointer<Byte>> lastReached = &lastReachedArray[node->debugValueIndex];
+			*lastReached = rr::ConstantPointer(value);
+		});
+		break;
+	case OpenCLDebugInfo100DebugExpression:
+		defineOrEmit(insn, pass, [&](debug::Expression *expr) {
+			for(uint32_t i = 5; i < insn.wordCount(); i++)
+			{
+				expr->operations.push_back(get(debug::Operation::ID(insn.word(i))));
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugSource:
+		defineOrEmit(insn, pass, [&](debug::Source *source) {
+			source->file = shader->getString(insn.word(5));
+			if(insn.wordCount() > 6)
+			{
+				source->source = shader->getString(insn.word(6));
+				auto file = ctx->lock().createVirtualFile(source->file.c_str(), source->source.c_str());
+				source->dbgFile = file;
+				files.emplace(source->file.c_str(), file);
+			}
+			else
+			{
+				auto file = ctx->lock().createPhysicalFile(source->file.c_str());
+				source->dbgFile = file;
+				files.emplace(source->file.c_str(), file);
+			}
+		});
+		break;
+	case OpenCLDebugInfo100DebugOperation:
+		defineOrEmit(insn, pass, [&](debug::Operation *operation) {
+			operation->opcode = insn.word(5);
+			for(uint32_t i = 6; i < insn.wordCount(); i++)
+			{
+				operation->operands.push_back(insn.word(i));
+			}
+		});
+		break;
 
-				if(node->debugValueIndex == debug::LocalVariable::ValueNode::NoDebugValueIndex)
-				{
-					node->debugValueIndex = numDebugValueSlots++;
-				}
-
-				rr::Pointer<rr::Pointer<Byte>> lastReachedArray = *rr::Pointer<rr::Pointer<rr::Pointer<Byte>>>(
-				    state->routine->dbgState + OFFSET(Impl::Debugger::State, lastReachedDebugValues));
-				rr::Pointer<rr::Pointer<Byte>> lastReached = &lastReachedArray[node->debugValueIndex];
-				*lastReached = rr::ConstantPointer(value);
-			});
-			break;
-		case OpenCLDebugInfo100DebugExpression:
-			defineOrEmit(insn, pass, [&](debug::Expression *expr) {
-				for(uint32_t i = 5; i < insn.wordCount(); i++)
-				{
-					expr->operations.push_back(get(debug::Operation::ID(insn.word(i))));
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugSource:
-			defineOrEmit(insn, pass, [&](debug::Source *source) {
-				source->file = shader->getString(insn.word(5));
-				if(insn.wordCount() > 6)
-				{
-					source->source = shader->getString(insn.word(6));
-					auto file = ctx->lock().createVirtualFile(source->file.c_str(), source->source.c_str());
-					source->dbgFile = file;
-					files.emplace(source->file.c_str(), file);
-				}
-				else
-				{
-					auto file = ctx->lock().createPhysicalFile(source->file.c_str());
-					source->dbgFile = file;
-					files.emplace(source->file.c_str(), file);
-				}
-			});
-			break;
-		case OpenCLDebugInfo100DebugOperation:
-			defineOrEmit(insn, pass, [&](debug::Operation *operation) {
-				operation->opcode = insn.word(5);
-				for(uint32_t i = 6; i < insn.wordCount(); i++)
-				{
-					operation->operands.push_back(insn.word(i));
-				}
-			});
-			break;
-
-		case OpenCLDebugInfo100DebugTypePointer:
-		case OpenCLDebugInfo100DebugTypeQualifier:
-		case OpenCLDebugInfo100DebugTypedef:
-		case OpenCLDebugInfo100DebugTypeEnum:
-		case OpenCLDebugInfo100DebugTypeInheritance:
-		case OpenCLDebugInfo100DebugTypePtrToMember:
-		case OpenCLDebugInfo100DebugTypeTemplateTemplateParameter:
-		case OpenCLDebugInfo100DebugTypeTemplateParameterPack:
-		case OpenCLDebugInfo100DebugFunctionDeclaration:
-		case OpenCLDebugInfo100DebugLexicalBlockDiscriminator:
-		case OpenCLDebugInfo100DebugInlinedVariable:
-		case OpenCLDebugInfo100DebugMacroDef:
-		case OpenCLDebugInfo100DebugMacroUndef:
-		case OpenCLDebugInfo100DebugImportedEntity:
-			UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 instruction %d", int(extInstIndex));
-			break;
-		default:
-			UNSUPPORTED("OpenCLDebugInfo100 instruction %d", int(extInstIndex));
+	case OpenCLDebugInfo100DebugTypePointer:
+	case OpenCLDebugInfo100DebugTypeQualifier:
+	case OpenCLDebugInfo100DebugTypedef:
+	case OpenCLDebugInfo100DebugTypeEnum:
+	case OpenCLDebugInfo100DebugTypeInheritance:
+	case OpenCLDebugInfo100DebugTypePtrToMember:
+	case OpenCLDebugInfo100DebugTypeTemplateTemplateParameter:
+	case OpenCLDebugInfo100DebugTypeTemplateParameterPack:
+	case OpenCLDebugInfo100DebugFunctionDeclaration:
+	case OpenCLDebugInfo100DebugLexicalBlockDiscriminator:
+	case OpenCLDebugInfo100DebugInlinedVariable:
+	case OpenCLDebugInfo100DebugMacroDef:
+	case OpenCLDebugInfo100DebugMacroUndef:
+	case OpenCLDebugInfo100DebugImportedEntity:
+		UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100 instruction %d", int(extInstIndex));
+		break;
+	default:
+		UNSUPPORTED("OpenCLDebugInfo100 instruction %d", int(extInstIndex));
 	}
 }
 
@@ -1955,8 +1955,8 @@
 	auto mask = state->activeLaneMask();
 	switch(obj.kind)
 	{
-		case Object::Kind::Constant:
-		case Object::Kind::Intermediate:
+	case Object::Kind::Constant:
+	case Object::Kind::Intermediate:
 		{
 			size += objTy.componentCount * sizeof(uint32_t) * sw::SIMD::Width;
 			auto dst = InterleaveByLane(SIMD::Pointer(base, 0));
@@ -1967,20 +1967,20 @@
 				dst += sizeof(uint32_t) * SIMD::Width;
 			}
 			entry.kind = Entry::Kind::Value;
-			break;
 		}
-		case Object::Kind::Pointer:
-		case Object::Kind::InterfaceVariable:
+		break;
+	case Object::Kind::Pointer:
+	case Object::Kind::InterfaceVariable:
 		{
 			size += sizeof(void *) + sizeof(uint32_t) * SIMD::Width;
 			auto ptr = state->getPointer(objId);
 			store(base, ptr.base);
 			store(base + sizeof(void *), ptr.offsets());
 			entry.kind = Entry::Kind::Pointer;
-			break;
 		}
-		default:
-			break;
+		break;
+	default:
+		break;
 	}
 	entries.emplace(objId, entry);
 }
@@ -2067,12 +2067,12 @@
 		{
 			switch(op->opcode)
 			{
-				case OpenCLDebugInfo100Deref:
-					ptr = ptr.dref(shared->lane);
-					break;
-				default:
-					UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100DebugOperation %d", (int)op->opcode);
-					break;
+			case OpenCLDebugInfo100Deref:
+				ptr = ptr.dref(shared->lane);
+				break;
+			default:
+				UNIMPLEMENTED("b/148401179 OpenCLDebugInfo100DebugOperation %d", (int)op->opcode);
+				break;
 			}
 		}
 		value = ty->value(ptr, true);
@@ -2352,18 +2352,18 @@
 
 				switch(var->definition)
 				{
-					case debug::LocalVariable::Definition::Undefined:
+				case debug::LocalVariable::Definition::Undefined:
 					{
 						vc->put(name, var->type->undefined());
-						break;
 					}
-					case debug::LocalVariable::Definition::Declaration:
+					break;
+				case debug::LocalVariable::Definition::Declaration:
 					{
 						auto data = state->debugger->shadow.get(state, var->declaration->variable);
 						vc->put(name, var->type->value(data.dref(lane), true));
-						break;
 					}
-					case debug::LocalVariable::Definition::Values:
+					break;
+				case debug::LocalVariable::Definition::Values:
 					{
 						vc->put(name, std::make_shared<LocalVariableValue>(var, state, lane));
 						break;
@@ -2446,7 +2446,7 @@
 
 	switch(state->debugger->shader->executionModel)
 	{
-		case spv::ExecutionModelGLCompute:
+	case spv::ExecutionModelGLCompute:
 		{
 			buildGlobal("numWorkgroups", state->globals.compute.numWorkgroups);
 			buildGlobal("workgroupID", state->globals.compute.workgroupID);
@@ -2455,26 +2455,26 @@
 			buildGlobal("subgroupIndex", state->globals.compute.subgroupIndex);
 			buildGlobal("globalInvocationId", state->globals.compute.globalInvocationId);
 			buildGlobal("localInvocationIndex", state->globals.compute.localInvocationIndex);
-			break;
 		}
-		case spv::ExecutionModelFragment:
+		break;
+	case spv::ExecutionModelFragment:
 		{
 			buildGlobal("viewIndex", state->globals.fragment.viewIndex);
 			buildGlobal("fragCoord", state->globals.fragment.fragCoord);
 			buildGlobal("pointCoord", state->globals.fragment.pointCoord);
 			buildGlobal("windowSpacePosition", state->globals.fragment.windowSpacePosition);
 			buildGlobal("helperInvocation", state->globals.fragment.helperInvocation);
-			break;
 		}
-		case spv::ExecutionModelVertex:
+		break;
+	case spv::ExecutionModelVertex:
 		{
 			buildGlobal("viewIndex", state->globals.vertex.viewIndex);
 			buildGlobal("instanceIndex", state->globals.vertex.instanceIndex);
 			buildGlobal("vertexIndex", state->globals.vertex.vertexIndex);
-			break;
 		}
-		default:
-			break;
+		break;
+	default:
+		break;
 	}
 }
 
@@ -2499,15 +2499,15 @@
 			auto memory = debugger->shadow.get(state, id);
 			switch(obj.kind)
 			{
-				case Object::Kind::Intermediate:
-				case Object::Kind::Constant:
-					if(auto val = buildSpirvValue(state, memory, objTy, lane))
-					{
-						vc->put(name, val);
-					}
-					break;
-				default:
-					break;  // Not handled yet.
+			case Object::Kind::Intermediate:
+			case Object::Kind::Constant:
+				if(auto val = buildSpirvValue(state, memory, objTy, lane))
+				{
+					vc->put(name, val);
+				}
+				break;
+			default:
+				break;  // Not handled yet.
 			}
 		}
 	});
@@ -2521,11 +2521,11 @@
 
 	switch(type.definition.opcode())
 	{
-		case spv::OpTypeInt:
-			return vk::dbg::make_reference(reinterpret_cast<uint32_t *>(memory.addr)[lane]);
-		case spv::OpTypeFloat:
-			return vk::dbg::make_reference(reinterpret_cast<float *>(memory.addr)[lane]);
-		case spv::OpTypeVector:
+	case spv::OpTypeInt:
+		return vk::dbg::make_reference(reinterpret_cast<uint32_t *>(memory.addr)[lane]);
+	case spv::OpTypeFloat:
+		return vk::dbg::make_reference(reinterpret_cast<float *>(memory.addr)[lane]);
+	case spv::OpTypeVector:
 		{
 			auto elTy = shader->getType(type.element);
 			return vk::dbg::Struct::create("vector", [&](auto &fields) {
@@ -2539,8 +2539,8 @@
 				}
 			});
 		}
-		default:
-			return nullptr;  // Not handled yet
+	default:
+		return nullptr;  // Not handled yet
 	}
 }
 
@@ -2584,10 +2584,10 @@
 	std::string name;
 	switch(executionModel)
 	{
-		case spv::ExecutionModelVertex: name = "VertexShader"; break;
-		case spv::ExecutionModelFragment: name = "FragmentShader"; break;
-		case spv::ExecutionModelGLCompute: name = "ComputeShader"; break;
-		default: name = "SPIR-V Shader"; break;
+	case spv::ExecutionModelVertex: name = "VertexShader"; break;
+	case spv::ExecutionModelFragment: name = "FragmentShader"; break;
+	case spv::ExecutionModelGLCompute: name = "ComputeShader"; break;
+	default: name = "SPIR-V Shader"; break;
 	}
 	static std::atomic<int> id = { 0 };
 	name += std::to_string(id++) + ".spvasm";
@@ -2618,7 +2618,7 @@
 
 		switch(executionModel)
 		{
-			case spv::ExecutionModelGLCompute:
+		case spv::ExecutionModelGLCompute:
 			{
 				auto compute = globals + OFFSET(Globals, compute);
 				store(compute + OFFSET(Globals::Compute, numWorkgroups), routine->numWorkgroups);
@@ -2628,9 +2628,9 @@
 				store(compute + OFFSET(Globals::Compute, subgroupIndex), routine->subgroupIndex);
 				store(compute + OFFSET(Globals::Compute, globalInvocationId), routine->globalInvocationID);
 				store(compute + OFFSET(Globals::Compute, localInvocationIndex), routine->localInvocationIndex);
-				break;
 			}
-			case spv::ExecutionModelFragment:
+			break;
+		case spv::ExecutionModelFragment:
 			{
 				auto fragment = globals + OFFSET(Globals, fragment);
 				store(fragment + OFFSET(Globals::Fragment, viewIndex), routine->viewID);
@@ -2638,18 +2638,18 @@
 				store(fragment + OFFSET(Globals::Fragment, pointCoord), routine->pointCoord);
 				store(fragment + OFFSET(Globals::Fragment, windowSpacePosition), routine->windowSpacePosition);
 				store(fragment + OFFSET(Globals::Fragment, helperInvocation), routine->helperInvocation);
-				break;
 			}
-			case spv::ExecutionModelVertex:
+			break;
+		case spv::ExecutionModelVertex:
 			{
 				auto vertex = globals + OFFSET(Globals, vertex);
 				store(vertex + OFFSET(Globals::Vertex, viewIndex), routine->viewID);
 				store(vertex + OFFSET(Globals::Vertex, instanceIndex), routine->instanceID);
 				store(vertex + OFFSET(Globals::Vertex, vertexIndex), routine->vertexIndex);
-				break;
 			}
-			default:
-				break;
+			break;
+		default:
+			break;
 		}
 	}
 }
@@ -2725,15 +2725,15 @@
 
 	switch(insn.opcode())
 	{
-		case spv::OpVariable:
-		case spv::OpConstant:  // TODO: Move constants out of shadow memory.
-		case spv::OpConstantNull:
-		case spv::OpConstantTrue:
-		case spv::OpConstantFalse:
-		case spv::OpConstantComposite:
-			dbg->shadow.create(this, state, insn.resultId());
-			break;
-		default:
+	case spv::OpVariable:
+	case spv::OpConstant:  // TODO: Move constants out of shadow memory.
+	case spv::OpConstantNull:
+	case spv::OpConstantTrue:
+	case spv::OpConstantFalse:
+	case spv::OpConstantComposite:
+		dbg->shadow.create(this, state, insn.resultId());
+		break;
+	default:
 		{
 			auto resIt = dbg->results.find(insn.wordPointer(0));
 			if(resIt != dbg->results.end())
diff --git a/src/Pipeline/SpirvShaderGLSLstd450.cpp b/src/Pipeline/SpirvShaderGLSLstd450.cpp
index f1644a5..c57fdde 100644
--- a/src/Pipeline/SpirvShaderGLSLstd450.cpp
+++ b/src/Pipeline/SpirvShaderGLSLstd450.cpp
@@ -76,79 +76,79 @@
 
 	switch(extInstIndex)
 	{
-		case GLSLstd450FAbs:
+	case GLSLstd450FAbs:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Abs(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450SAbs:
+		break;
+	case GLSLstd450SAbs:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Abs(src.Int(i)));
 			}
-			break;
 		}
-		case GLSLstd450Cross:
+		break;
+	case GLSLstd450Cross:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
 			dst.move(0, lhs.Float(1) * rhs.Float(2) - rhs.Float(1) * lhs.Float(2));
 			dst.move(1, lhs.Float(2) * rhs.Float(0) - rhs.Float(2) * lhs.Float(0));
 			dst.move(2, lhs.Float(0) * rhs.Float(1) - rhs.Float(0) * lhs.Float(1));
-			break;
 		}
-		case GLSLstd450Floor:
+		break;
+	case GLSLstd450Floor:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Floor(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Trunc:
+		break;
+	case GLSLstd450Trunc:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Trunc(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Ceil:
+		break;
+	case GLSLstd450Ceil:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Ceil(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Fract:
+		break;
+	case GLSLstd450Fract:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Frac(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Round:
+		break;
+	case GLSLstd450Round:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Round(src.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450RoundEven:
+		break;
+	case GLSLstd450RoundEven:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
@@ -158,9 +158,9 @@
 				dst.move(i, x + ((SIMD::Float(CmpLT(x, src.Float(i)) & SIMD::Int(1)) * SIMD::Float(2.0f)) - SIMD::Float(1.0f)) *
 				                    SIMD::Float(CmpEQ(Frac(src.Float(i)), SIMD::Float(0.5f)) & SIMD::Int(1)) * SIMD::Float(Int4(x) & SIMD::Int(1)));
 			}
-			break;
 		}
-		case GLSLstd450FMin:
+		break;
+	case GLSLstd450FMin:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -168,9 +168,9 @@
 			{
 				dst.move(i, Min(lhs.Float(i), rhs.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450FMax:
+		break;
+	case GLSLstd450FMax:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -178,9 +178,9 @@
 			{
 				dst.move(i, Max(lhs.Float(i), rhs.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450SMin:
+		break;
+	case GLSLstd450SMin:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -188,9 +188,9 @@
 			{
 				dst.move(i, Min(lhs.Int(i), rhs.Int(i)));
 			}
-			break;
 		}
-		case GLSLstd450SMax:
+		break;
+	case GLSLstd450SMax:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -198,9 +198,9 @@
 			{
 				dst.move(i, Max(lhs.Int(i), rhs.Int(i)));
 			}
-			break;
 		}
-		case GLSLstd450UMin:
+		break;
+	case GLSLstd450UMin:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -208,9 +208,9 @@
 			{
 				dst.move(i, Min(lhs.UInt(i), rhs.UInt(i)));
 			}
-			break;
 		}
-		case GLSLstd450UMax:
+		break;
+	case GLSLstd450UMax:
 		{
 			auto lhs = Operand(this, state, insn.word(5));
 			auto rhs = Operand(this, state, insn.word(6));
@@ -218,9 +218,9 @@
 			{
 				dst.move(i, Max(lhs.UInt(i), rhs.UInt(i)));
 			}
-			break;
 		}
-		case GLSLstd450Step:
+		break;
+	case GLSLstd450Step:
 		{
 			auto edge = Operand(this, state, insn.word(5));
 			auto x = Operand(this, state, insn.word(6));
@@ -228,9 +228,9 @@
 			{
 				dst.move(i, CmpNLT(x.Float(i), edge.Float(i)) & As<SIMD::Int>(SIMD::Float(1.0f)));
 			}
-			break;
 		}
-		case GLSLstd450SmoothStep:
+		break;
+	case GLSLstd450SmoothStep:
 		{
 			auto edge0 = Operand(this, state, insn.word(5));
 			auto edge1 = Operand(this, state, insn.word(6));
@@ -243,9 +243,9 @@
 				              SIMD::Float(1.0f));
 				dst.move(i, tx * tx * (Float4(3.0f) - Float4(2.0f) * tx));
 			}
-			break;
 		}
-		case GLSLstd450FMix:
+		break;
+	case GLSLstd450FMix:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto y = Operand(this, state, insn.word(6));
@@ -254,9 +254,9 @@
 			{
 				dst.move(i, a.Float(i) * (y.Float(i) - x.Float(i)) + x.Float(i));
 			}
-			break;
 		}
-		case GLSLstd450FClamp:
+		break;
+	case GLSLstd450FClamp:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto minVal = Operand(this, state, insn.word(6));
@@ -265,9 +265,9 @@
 			{
 				dst.move(i, Min(Max(x.Float(i), minVal.Float(i)), maxVal.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450SClamp:
+		break;
+	case GLSLstd450SClamp:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto minVal = Operand(this, state, insn.word(6));
@@ -276,9 +276,9 @@
 			{
 				dst.move(i, Min(Max(x.Int(i), minVal.Int(i)), maxVal.Int(i)));
 			}
-			break;
 		}
-		case GLSLstd450UClamp:
+		break;
+	case GLSLstd450UClamp:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto minVal = Operand(this, state, insn.word(6));
@@ -287,9 +287,9 @@
 			{
 				dst.move(i, Min(Max(x.UInt(i), minVal.UInt(i)), maxVal.UInt(i)));
 			}
-			break;
 		}
-		case GLSLstd450FSign:
+		break;
+	case GLSLstd450FSign:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
@@ -298,9 +298,9 @@
 				auto pos = As<SIMD::Int>(CmpNLE(src.Float(i), SIMD::Float(+0.0f))) & As<SIMD::Int>(SIMD::Float(1.0f));
 				dst.move(i, neg | pos);
 			}
-			break;
 		}
-		case GLSLstd450SSign:
+		break;
+	case GLSLstd450SSign:
 		{
 			auto src = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
@@ -309,9 +309,9 @@
 				auto pos = CmpNLE(src.Int(i), SIMD::Int(0)) & SIMD::Int(1);
 				dst.move(i, neg | pos);
 			}
-			break;
 		}
-		case GLSLstd450Reflect:
+		break;
+	case GLSLstd450Reflect:
 		{
 			auto I = Operand(this, state, insn.word(5));
 			auto N = Operand(this, state, insn.word(6));
@@ -322,9 +322,9 @@
 			{
 				dst.move(i, I.Float(i) - SIMD::Float(2.0f) * d * N.Float(i));
 			}
-			break;
 		}
-		case GLSLstd450Refract:
+		break;
+	case GLSLstd450Refract:
 		{
 			auto I = Operand(this, state, insn.word(5));
 			auto N = Operand(this, state, insn.word(6));
@@ -339,9 +339,9 @@
 			{
 				dst.move(i, pos & As<SIMD::Int>(eta.Float(0) * I.Float(i) - t * N.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450FaceForward:
+		break;
+	case GLSLstd450FaceForward:
 		{
 			auto N = Operand(this, state, insn.word(5));
 			auto I = Operand(this, state, insn.word(6));
@@ -355,17 +355,17 @@
 				auto n = N.Float(i);
 				dst.move(i, (neg & As<SIMD::Int>(n)) | (~neg & As<SIMD::Int>(-n)));
 			}
-			break;
 		}
-		case GLSLstd450Length:
+		break;
+	case GLSLstd450Length:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			SIMD::Float d = Dot(getType(getObject(insn.word(5))).componentCount, x, x);
 
 			dst.move(0, Sqrt(d));
-			break;
 		}
-		case GLSLstd450Normalize:
+		break;
+	case GLSLstd450Normalize:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			SIMD::Float d = Dot(getType(getObject(insn.word(5))).componentCount, x, x);
@@ -375,9 +375,9 @@
 			{
 				dst.move(i, invLength * x.Float(i));
 			}
-			break;
 		}
-		case GLSLstd450Distance:
+		break;
+	case GLSLstd450Distance:
 		{
 			auto p0 = Operand(this, state, insn.word(5));
 			auto p1 = Operand(this, state, insn.word(6));
@@ -391,9 +391,9 @@
 			}
 
 			dst.move(0, Sqrt(d));
-			break;
 		}
-		case GLSLstd450Modf:
+		break;
+	case GLSLstd450Modf:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			auto ptrId = Object::ID(insn.word(6));
@@ -408,9 +408,9 @@
 			}
 
 			Store(ptrId, whole, false, std::memory_order_relaxed, state);
-			break;
 		}
-		case GLSLstd450ModfStruct:
+		break;
+	case GLSLstd450ModfStruct:
 		{
 			auto val = Operand(this, state, insn.word(5));
 
@@ -420,9 +420,9 @@
 				dst.move(i, wholeAndFrac.second);
 				dst.move(val.componentCount + i, wholeAndFrac.first);
 			}
-			break;
 		}
-		case GLSLstd450PackSnorm4x8:
+		break;
+	case GLSLstd450PackSnorm4x8:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, (SIMD::Int(Round(Min(Max(val.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
@@ -436,18 +436,18 @@
 			                ((SIMD::Int(Round(Min(Max(val.Float(3), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
 			                  SIMD::Int(0xFF))
 			                 << 24));
-			break;
 		}
-		case GLSLstd450PackUnorm4x8:
+		break;
+	case GLSLstd450PackUnorm4x8:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, (SIMD::UInt(Round(Min(Max(val.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) |
 			                ((SIMD::UInt(Round(Min(Max(val.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 8) |
 			                ((SIMD::UInt(Round(Min(Max(val.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 16) |
 			                ((SIMD::UInt(Round(Min(Max(val.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 24));
-			break;
 		}
-		case GLSLstd450PackSnorm2x16:
+		break;
+	case GLSLstd450PackSnorm2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, (SIMD::Int(Round(Min(Max(val.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(32767.0f))) &
@@ -455,9 +455,9 @@
 			                ((SIMD::Int(Round(Min(Max(val.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(32767.0f))) &
 			                  SIMD::Int(0xFFFF))
 			                 << 16));
-			break;
 		}
-		case GLSLstd450PackUnorm2x16:
+		break;
+	case GLSLstd450PackUnorm2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, (SIMD::UInt(Round(Min(Max(val.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(65535.0f))) &
@@ -465,33 +465,33 @@
 			                ((SIMD::UInt(Round(Min(Max(val.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(65535.0f))) &
 			                  SIMD::UInt(0xFFFF))
 			                 << 16));
-			break;
 		}
-		case GLSLstd450PackHalf2x16:
+		break;
+	case GLSLstd450PackHalf2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, floatToHalfBits(val.UInt(0), false) | floatToHalfBits(val.UInt(1), true));
-			break;
 		}
-		case GLSLstd450UnpackSnorm4x8:
+		break;
+	case GLSLstd450UnpackSnorm4x8:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, Min(Max(SIMD::Float(((val.Int(0) << 24) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
 			dst.move(1, Min(Max(SIMD::Float(((val.Int(0) << 16) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
 			dst.move(2, Min(Max(SIMD::Float(((val.Int(0) << 8) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
 			dst.move(3, Min(Max(SIMD::Float(((val.Int(0)) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
-			break;
 		}
-		case GLSLstd450UnpackUnorm4x8:
+		break;
+	case GLSLstd450UnpackUnorm4x8:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, SIMD::Float((val.UInt(0) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
 			dst.move(1, SIMD::Float(((val.UInt(0) >> 8) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
 			dst.move(2, SIMD::Float(((val.UInt(0) >> 16) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
 			dst.move(3, SIMD::Float(((val.UInt(0) >> 24) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
-			break;
 		}
-		case GLSLstd450UnpackSnorm2x16:
+		break;
+	case GLSLstd450UnpackSnorm2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			// clamp(f / 32767.0, -1.0, 1.0)
@@ -502,24 +502,24 @@
 			dst.move(1, Min(Max(SIMD::Float(As<SIMD::Int>(val.UInt(0) & SIMD::UInt(0xFFFF0000))) * SIMD::Float(1.0f / float(0x7FFF0000)),
 			                    SIMD::Float(-1.0f)),
 			                SIMD::Float(1.0f)));
-			break;
 		}
-		case GLSLstd450UnpackUnorm2x16:
+		break;
+	case GLSLstd450UnpackUnorm2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			// f / 65535.0
 			dst.move(0, SIMD::Float((val.UInt(0) & SIMD::UInt(0x0000FFFF)) << 16) * SIMD::Float(1.0f / float(0xFFFF0000)));
 			dst.move(1, SIMD::Float(val.UInt(0) & SIMD::UInt(0xFFFF0000)) * SIMD::Float(1.0f / float(0xFFFF0000)));
-			break;
 		}
-		case GLSLstd450UnpackHalf2x16:
+		break;
+	case GLSLstd450UnpackHalf2x16:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			dst.move(0, halfToFloatBits(val.UInt(0) & SIMD::UInt(0x0000FFFF)));
 			dst.move(1, halfToFloatBits((val.UInt(0) & SIMD::UInt(0xFFFF0000)) >> 16));
-			break;
 		}
-		case GLSLstd450Fma:
+		break;
+	case GLSLstd450Fma:
 		{
 			auto a = Operand(this, state, insn.word(5));
 			auto b = Operand(this, state, insn.word(6));
@@ -528,9 +528,9 @@
 			{
 				dst.move(i, FMA(a.Float(i), b.Float(i), c.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Frexp:
+		break;
+	case GLSLstd450Frexp:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			auto ptrId = Object::ID(insn.word(6));
@@ -545,9 +545,9 @@
 			}
 
 			Store(ptrId, exp, false, std::memory_order_relaxed, state);
-			break;
 		}
-		case GLSLstd450FrexpStruct:
+		break;
+	case GLSLstd450FrexpStruct:
 		{
 			auto val = Operand(this, state, insn.word(5));
 
@@ -557,9 +557,9 @@
 				dst.move(i, significandAndExponent.first);
 				dst.move(val.componentCount + i, significandAndExponent.second);
 			}
-			break;
 		}
-		case GLSLstd450Ldexp:
+		break;
+	case GLSLstd450Ldexp:
 		{
 			auto significand = Operand(this, state, insn.word(5));
 			auto exponent = Operand(this, state, insn.word(6));
@@ -591,54 +591,54 @@
 
 				dst.move(i, As<SIMD::Float>(v));
 			}
-			break;
 		}
-		case GLSLstd450Radians:
+		break;
+	case GLSLstd450Radians:
 		{
 			auto degrees = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, degrees.Float(i) * SIMD::Float(PI / 180.0f));
 			}
-			break;
 		}
-		case GLSLstd450Degrees:
+		break;
+	case GLSLstd450Degrees:
 		{
 			auto radians = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, radians.Float(i) * SIMD::Float(180.0f / PI));
 			}
-			break;
 		}
-		case GLSLstd450Sin:
+		break;
+	case GLSLstd450Sin:
 		{
 			auto radians = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Sin(radians.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Cos:
+		break;
+	case GLSLstd450Cos:
 		{
 			auto radians = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Cos(radians.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Tan:
+		break;
+	case GLSLstd450Tan:
 		{
 			auto radians = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Tan(radians.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Asin:
+		break;
+	case GLSLstd450Asin:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			Decorations d;
@@ -647,9 +647,9 @@
 			{
 				dst.move(i, Asin(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
 			}
-			break;
 		}
-		case GLSLstd450Acos:
+		break;
+	case GLSLstd450Acos:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			Decorations d;
@@ -658,72 +658,72 @@
 			{
 				dst.move(i, Acos(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
 			}
-			break;
 		}
-		case GLSLstd450Atan:
+		break;
+	case GLSLstd450Atan:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Atan(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Sinh:
+		break;
+	case GLSLstd450Sinh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Sinh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Cosh:
+		break;
+	case GLSLstd450Cosh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Cosh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Tanh:
+		break;
+	case GLSLstd450Tanh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Tanh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Asinh:
+		break;
+	case GLSLstd450Asinh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Asinh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Acosh:
+		break;
+	case GLSLstd450Acosh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Acosh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Atanh:
+		break;
+	case GLSLstd450Atanh:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Atanh(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Atan2:
+		break;
+	case GLSLstd450Atan2:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto y = Operand(this, state, insn.word(6));
@@ -731,9 +731,9 @@
 			{
 				dst.move(i, Atan2(x.Float(i), y.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Pow:
+		break;
+	case GLSLstd450Pow:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto y = Operand(this, state, insn.word(6));
@@ -741,54 +741,54 @@
 			{
 				dst.move(i, Pow(x.Float(i), y.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Exp:
+		break;
+	case GLSLstd450Exp:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Exp(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Log:
+		break;
+	case GLSLstd450Log:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Log(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Exp2:
+		break;
+	case GLSLstd450Exp2:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Exp2(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Log2:
+		break;
+	case GLSLstd450Log2:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Log2(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450Sqrt:
+		break;
+	case GLSLstd450Sqrt:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, Sqrt(val.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450InverseSqrt:
+		break;
+	case GLSLstd450InverseSqrt:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			Decorations d;
@@ -798,44 +798,44 @@
 			{
 				dst.move(i, RcpSqrt(val.Float(i), d.RelaxedPrecision ? Precision::Relaxed : Precision::Full));
 			}
-			break;
 		}
-		case GLSLstd450Determinant:
+		break;
+	case GLSLstd450Determinant:
 		{
 			auto mat = Operand(this, state, insn.word(5));
 
 			switch(mat.componentCount)
 			{
-				case 4:  // 2x2
-					dst.move(0, Determinant(
-					                mat.Float(0), mat.Float(1),
-					                mat.Float(2), mat.Float(3)));
-					break;
-				case 9:  // 3x3
-					dst.move(0, Determinant(
-					                mat.Float(0), mat.Float(1), mat.Float(2),
-					                mat.Float(3), mat.Float(4), mat.Float(5),
-					                mat.Float(6), mat.Float(7), mat.Float(8)));
-					break;
-				case 16:  // 4x4
-					dst.move(0, Determinant(
-					                mat.Float(0), mat.Float(1), mat.Float(2), mat.Float(3),
-					                mat.Float(4), mat.Float(5), mat.Float(6), mat.Float(7),
-					                mat.Float(8), mat.Float(9), mat.Float(10), mat.Float(11),
-					                mat.Float(12), mat.Float(13), mat.Float(14), mat.Float(15)));
-					break;
-				default:
-					UNREACHABLE("GLSLstd450Determinant can only operate with square matrices. Got %d elements", int(mat.componentCount));
+			case 4:  // 2x2
+				dst.move(0, Determinant(
+				                mat.Float(0), mat.Float(1),
+				                mat.Float(2), mat.Float(3)));
+				break;
+			case 9:  // 3x3
+				dst.move(0, Determinant(
+				                mat.Float(0), mat.Float(1), mat.Float(2),
+				                mat.Float(3), mat.Float(4), mat.Float(5),
+				                mat.Float(6), mat.Float(7), mat.Float(8)));
+				break;
+			case 16:  // 4x4
+				dst.move(0, Determinant(
+				                mat.Float(0), mat.Float(1), mat.Float(2), mat.Float(3),
+				                mat.Float(4), mat.Float(5), mat.Float(6), mat.Float(7),
+				                mat.Float(8), mat.Float(9), mat.Float(10), mat.Float(11),
+				                mat.Float(12), mat.Float(13), mat.Float(14), mat.Float(15)));
+				break;
+			default:
+				UNREACHABLE("GLSLstd450Determinant can only operate with square matrices. Got %d elements", int(mat.componentCount));
 			}
-			break;
 		}
-		case GLSLstd450MatrixInverse:
+		break;
+	case GLSLstd450MatrixInverse:
 		{
 			auto mat = Operand(this, state, insn.word(5));
 
 			switch(mat.componentCount)
 			{
-				case 4:  // 2x2
+			case 4:  // 2x2
 				{
 					auto inv = MatrixInverse(
 					    mat.Float(0), mat.Float(1),
@@ -844,9 +844,9 @@
 					{
 						dst.move(i, inv[i]);
 					}
-					break;
 				}
-				case 9:  // 3x3
+				break;
+			case 9:  // 3x3
 				{
 					auto inv = MatrixInverse(
 					    mat.Float(0), mat.Float(1), mat.Float(2),
@@ -856,9 +856,9 @@
 					{
 						dst.move(i, inv[i]);
 					}
-					break;
 				}
-				case 16:  // 4x4
+				break;
+			case 16:  // 4x4
 				{
 					auto inv = MatrixInverse(
 					    mat.Float(0), mat.Float(1), mat.Float(2), mat.Float(3),
@@ -869,29 +869,29 @@
 					{
 						dst.move(i, inv[i]);
 					}
-					break;
 				}
-				default:
-					UNREACHABLE("GLSLstd450MatrixInverse can only operate with square matrices. Got %d elements", int(mat.componentCount));
+				break;
+			default:
+				UNREACHABLE("GLSLstd450MatrixInverse can only operate with square matrices. Got %d elements", int(mat.componentCount));
 			}
-			break;
 		}
-		case GLSLstd450IMix:
+		break;
+	case GLSLstd450IMix:
 		{
 			UNREACHABLE("GLSLstd450IMix has been removed from the specification");
-			break;
 		}
-		case GLSLstd450PackDouble2x32:
+		break;
+	case GLSLstd450PackDouble2x32:
 		{
 			UNSUPPORTED("SPIR-V Float64 Capability (GLSLstd450PackDouble2x32)");
-			break;
 		}
-		case GLSLstd450UnpackDouble2x32:
+		break;
+	case GLSLstd450UnpackDouble2x32:
 		{
 			UNSUPPORTED("SPIR-V Float64 Capability (GLSLstd450UnpackDouble2x32)");
-			break;
 		}
-		case GLSLstd450FindILsb:
+		break;
+	case GLSLstd450FindILsb:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
@@ -899,9 +899,9 @@
 				auto v = val.UInt(i);
 				dst.move(i, Cttz(v, true) | CmpEQ(v, SIMD::UInt(0)));
 			}
-			break;
 		}
-		case GLSLstd450FindSMsb:
+		break;
+	case GLSLstd450FindSMsb:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
@@ -909,18 +909,18 @@
 				auto v = val.UInt(i) ^ As<SIMD::UInt>(CmpLT(val.Int(i), SIMD::Int(0)));
 				dst.move(i, SIMD::UInt(31) - Ctlz(v, false));
 			}
-			break;
 		}
-		case GLSLstd450FindUMsb:
+		break;
+	case GLSLstd450FindUMsb:
 		{
 			auto val = Operand(this, state, insn.word(5));
 			for(auto i = 0u; i < type.componentCount; i++)
 			{
 				dst.move(i, SIMD::UInt(31) - Ctlz(val.UInt(i), false));
 			}
-			break;
 		}
-		case GLSLstd450InterpolateAtCentroid:
+		break;
+	case GLSLstd450InterpolateAtCentroid:
 		{
 			Decorations d;
 			ApplyDecorationsForId(&d, insn.word(5));
@@ -929,9 +929,9 @@
 			{
 				dst.move(i, Interpolate(ptr, d.Location, 0, i, type.componentCount, state, SpirvShader::Centroid));
 			}
-			break;
 		}
-		case GLSLstd450InterpolateAtSample:
+		break;
+	case GLSLstd450InterpolateAtSample:
 		{
 			Decorations d;
 			ApplyDecorationsForId(&d, insn.word(5));
@@ -940,9 +940,9 @@
 			{
 				dst.move(i, Interpolate(ptr, d.Location, insn.word(6), i, type.componentCount, state, SpirvShader::AtSample));
 			}
-			break;
 		}
-		case GLSLstd450InterpolateAtOffset:
+		break;
+	case GLSLstd450InterpolateAtOffset:
 		{
 			Decorations d;
 			ApplyDecorationsForId(&d, insn.word(5));
@@ -951,9 +951,9 @@
 			{
 				dst.move(i, Interpolate(ptr, d.Location, insn.word(6), i, type.componentCount, state, SpirvShader::AtOffset));
 			}
-			break;
 		}
-		case GLSLstd450NMin:
+		break;
+	case GLSLstd450NMin:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto y = Operand(this, state, insn.word(6));
@@ -961,9 +961,9 @@
 			{
 				dst.move(i, NMin(x.Float(i), y.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450NMax:
+		break;
+	case GLSLstd450NMax:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto y = Operand(this, state, insn.word(6));
@@ -971,9 +971,9 @@
 			{
 				dst.move(i, NMax(x.Float(i), y.Float(i)));
 			}
-			break;
 		}
-		case GLSLstd450NClamp:
+		break;
+	case GLSLstd450NClamp:
 		{
 			auto x = Operand(this, state, insn.word(5));
 			auto minVal = Operand(this, state, insn.word(6));
@@ -983,11 +983,11 @@
 				auto clamp = NMin(NMax(x.Float(i), minVal.Float(i)), maxVal.Float(i));
 				dst.move(i, clamp);
 			}
-			break;
 		}
-		default:
-			UNREACHABLE("ExtInst %d", int(extInstIndex));
-			break;
+		break;
+	default:
+		UNREACHABLE("ExtInst %d", int(extInstIndex));
+		break;
 	}
 
 	return EmitResult::Continue;
@@ -1017,48 +1017,48 @@
 
 	switch(type)
 	{
-		case Centroid:
-			x = interpolationData.xCentroid;
-			y = interpolationData.yCentroid;
-			rhw = interpolationData.rhwCentroid;
-			break;
-		case AtSample:
-			x = SIMD::Float(0.0f);
-			y = SIMD::Float(0.0f);
+	case Centroid:
+		x = interpolationData.xCentroid;
+		y = interpolationData.yCentroid;
+		rhw = interpolationData.rhwCentroid;
+		break;
+	case AtSample:
+		x = SIMD::Float(0.0f);
+		y = SIMD::Float(0.0f);
 
-			if(state->getMultiSampleCount() > 1)
+		if(state->getMultiSampleCount() > 1)
+		{
+			static constexpr int NUM_SAMPLES = 4;
+			ASSERT(state->getMultiSampleCount() == NUM_SAMPLES);
+
+			Array<Float> sampleX(NUM_SAMPLES);
+			Array<Float> sampleY(NUM_SAMPLES);
+			for(int i = 0; i < NUM_SAMPLES; ++i)
 			{
-				static constexpr int NUM_SAMPLES = 4;
-				ASSERT(state->getMultiSampleCount() == NUM_SAMPLES);
-
-				Array<Float> sampleX(NUM_SAMPLES);
-				Array<Float> sampleY(NUM_SAMPLES);
-				for(int i = 0; i < NUM_SAMPLES; ++i)
-				{
-					sampleX[i] = Constants::SampleLocationsX[i];
-					sampleY[i] = Constants::SampleLocationsY[i];
-				}
-
-				auto sampleOperand = Operand(this, state, paramId);
-				ASSERT(sampleOperand.componentCount == 1);
-
-				// If sample does not exist, the position used to interpolate the
-				// input variable is undefined, so we just clamp to avoid OOB accesses.
-				SIMD::Int samples = sampleOperand.Int(0) & SIMD::Int(NUM_SAMPLES - 1);
-
-				for(int i = 0; i < SIMD::Width; ++i)
-				{
-					Int sample = Extract(samples, i);
-					x = Insert(x, sampleX[sample], i);
-					y = Insert(y, sampleY[sample], i);
-				}
+				sampleX[i] = Constants::SampleLocationsX[i];
+				sampleY[i] = Constants::SampleLocationsY[i];
 			}
 
-			x += interpolationData.x;
-			y += interpolationData.y;
-			rhw = interpolationData.rhw;
-			break;
-		case AtOffset:
+			auto sampleOperand = Operand(this, state, paramId);
+			ASSERT(sampleOperand.componentCount == 1);
+
+			// If sample does not exist, the position used to interpolate the
+			// input variable is undefined, so we just clamp to avoid OOB accesses.
+			SIMD::Int samples = sampleOperand.Int(0) & SIMD::Int(NUM_SAMPLES - 1);
+
+			for(int i = 0; i < SIMD::Width; ++i)
+			{
+				Int sample = Extract(samples, i);
+				x = Insert(x, sampleX[sample], i);
+				y = Insert(y, sampleY[sample], i);
+			}
+		}
+
+		x += interpolationData.x;
+		y += interpolationData.y;
+		rhw = interpolationData.rhw;
+		break;
+	case AtOffset:
 		{
 			//  An offset of (0, 0) identifies the center of the pixel.
 			auto offset = Operand(this, state, paramId);
@@ -1069,9 +1069,9 @@
 			rhw = interpolationData.rhw;
 		}
 		break;
-		default:
-			UNREACHABLE("Unknown interpolation type: %d", (int)type);
-			return SIMD::Float(0.0f);
+	default:
+		UNREACHABLE("Unknown interpolation type: %d", (int)type);
+		return SIMD::Float(0.0f);
 	}
 
 	Pointer<Byte> planeEquation = interpolationData.primitive + OFFSET(Primitive, V[interpolant]);
diff --git a/src/Pipeline/SpirvShaderGroup.cpp b/src/Pipeline/SpirvShaderGroup.cpp
index 3750b38..baa2134 100644
--- a/src/Pipeline/SpirvShaderGroup.cpp
+++ b/src/Pipeline/SpirvShaderGroup.cpp
@@ -44,33 +44,33 @@
 			TYPE v = As<TYPE>(v_uint);
 			switch(spv::GroupOperation(insn.word(4)))
 			{
-				case spv::GroupOperationReduce:
+			case spv::GroupOperationReduce:
 				{
 					// NOTE: floating-point add and multiply are not really commutative so
 					//       ensure that all values in the final lanes are identical
 					TYPE v2 = apply(v.xxzz, v.yyww);    // [xy]   [xy]   [zw]   [zw]
 					TYPE v3 = apply(v2.xxxx, v2.zzzz);  // [xyzw] [xyzw] [xyzw] [xyzw]
 					dst.move(i, v3);
-					break;
 				}
-				case spv::GroupOperationInclusiveScan:
+				break;
+			case spv::GroupOperationInclusiveScan:
 				{
 					TYPE v2 = apply(v, Shuffle(v, identity, 0x4012) /* [id, v.y, v.z, v.w] */);      // [x] [xy] [yz]  [zw]
 					TYPE v3 = apply(v2, Shuffle(v2, identity, 0x4401) /* [id,  id, v2.x, v2.y] */);  // [x] [xy] [xyz] [xyzw]
 					dst.move(i, v3);
-					break;
 				}
-				case spv::GroupOperationExclusiveScan:
+				break;
+			case spv::GroupOperationExclusiveScan:
 				{
 					TYPE v2 = apply(v, Shuffle(v, identity, 0x4012) /* [id, v.y, v.z, v.w] */);      // [x] [xy] [yz]  [zw]
 					TYPE v3 = apply(v2, Shuffle(v2, identity, 0x4401) /* [id,  id, v2.x, v2.y] */);  // [x] [xy] [xyz] [xyzw]
 					auto v4 = Shuffle(v3, identity, 0x4012 /* [id, v3.x, v3.y, v3.z] */);            // [i] [x]  [xy]  [xyz]
 					dst.move(i, v4);
-					break;
 				}
-				default:
-					UNSUPPORTED("EmitGroupNonUniform op: %s Group operation: %d",
-					            SpirvShader::OpcodeName(type.opcode()), insn.word(4));
+				break;
+			default:
+				UNSUPPORTED("EmitGroupNonUniform op: %s Group operation: %d",
+				            SpirvShader::OpcodeName(type.opcode()), insn.word(4));
 			}
 		}
 	}
@@ -89,7 +89,7 @@
 
 	switch(insn.opcode())
 	{
-		case spv::OpGroupNonUniformElect:
+	case spv::OpGroupNonUniformElect:
 		{
 			// Result is true only in the active invocation with the lowest id
 			// in the group, otherwise result is false.
@@ -99,24 +99,24 @@
 			auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
 			auto elect = active & ~(v0111 & (active.xxyz | active.xxxy | active.xxxx));
 			dst.move(0, elect);
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformAll:
+	case spv::OpGroupNonUniformAll:
 		{
 			Operand predicate(this, state, insn.word(4));
 			dst.move(0, AndAll(predicate.UInt(0) | ~As<SIMD::UInt>(state->activeLaneMask())));  // Considers helper invocations active. See b/151137030
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformAny:
+	case spv::OpGroupNonUniformAny:
 		{
 			Operand predicate(this, state, insn.word(4));
 			dst.move(0, OrAll(predicate.UInt(0) & As<SIMD::UInt>(state->activeLaneMask())));  // Considers helper invocations active. See b/151137030
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformAllEqual:
+	case spv::OpGroupNonUniformAllEqual:
 		{
 			Operand value(this, state, insn.word(4));
 			auto res = SIMD::UInt(0xffffffff);
@@ -133,10 +133,10 @@
 				res &= AndAll(CmpEQ(filled.xyzw, filled.yzwx));
 			}
 			dst.move(0, res);
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBroadcast:
+	case spv::OpGroupNonUniformBroadcast:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			auto idId = Object::ID(insn.word(5));
@@ -173,10 +173,10 @@
 					dst.move(i, OrAll(value.UInt(i) & mask));
 				}
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBroadcastFirst:
+	case spv::OpGroupNonUniformBroadcastFirst:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			Operand value(this, state, valueId);
@@ -191,10 +191,10 @@
 			{
 				dst.move(i, OrAll(value.Int(i) & elect));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBallot:
+	case spv::OpGroupNonUniformBallot:
 		{
 			ASSERT(type.componentCount == 4);
 			Operand predicate(this, state, insn.word(4));
@@ -202,10 +202,10 @@
 			dst.move(1, SIMD::Int(0));
 			dst.move(2, SIMD::Int(0));
 			dst.move(3, SIMD::Int(0));
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformInverseBallot:
+	case spv::OpGroupNonUniformInverseBallot:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			ASSERT(type.componentCount == 1);
@@ -213,10 +213,10 @@
 			Operand value(this, state, valueId);
 			auto bit = (value.Int(0) >> SIMD::Int(0, 1, 2, 3)) & SIMD::Int(1);
 			dst.move(0, -bit);
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBallotBitExtract:
+	case spv::OpGroupNonUniformBallotBitExtract:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			auto indexId = Object::ID(insn.word(5));
@@ -232,10 +232,10 @@
 			            (value.Int(2) & CmpEQ(vecIdx, SIMD::Int(2))) |
 			            (value.Int(3) & CmpEQ(vecIdx, SIMD::Int(3)));
 			dst.move(0, -((bits >> bitIdx) & SIMD::Int(1)));
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBallotBitCount:
+	case spv::OpGroupNonUniformBallotBitCount:
 		{
 			auto operation = spv::GroupOperation(insn.word(4));
 			auto valueId = Object::ID(insn.word(5));
@@ -244,42 +244,42 @@
 			Operand value(this, state, valueId);
 			switch(operation)
 			{
-				case spv::GroupOperationReduce:
-					dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(15)));
-					break;
-				case spv::GroupOperationInclusiveScan:
-					dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(1, 3, 7, 15)));
-					break;
-				case spv::GroupOperationExclusiveScan:
-					dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(0, 1, 3, 7)));
-					break;
-				default:
-					UNSUPPORTED("GroupOperation %d", int(operation));
+			case spv::GroupOperationReduce:
+				dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(15)));
+				break;
+			case spv::GroupOperationInclusiveScan:
+				dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(1, 3, 7, 15)));
+				break;
+			case spv::GroupOperationExclusiveScan:
+				dst.move(0, CountBits(value.UInt(0) & SIMD::UInt(0, 1, 3, 7)));
+				break;
+			default:
+				UNSUPPORTED("GroupOperation %d", int(operation));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBallotFindLSB:
+	case spv::OpGroupNonUniformBallotFindLSB:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			ASSERT(type.componentCount == 1);
 			ASSERT(getType(getObject(valueId)).componentCount == 4);
 			Operand value(this, state, valueId);
 			dst.move(0, Cttz(value.UInt(0) & SIMD::UInt(15), true));
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformBallotFindMSB:
+	case spv::OpGroupNonUniformBallotFindMSB:
 		{
 			auto valueId = Object::ID(insn.word(4));
 			ASSERT(type.componentCount == 1);
 			ASSERT(getType(getObject(valueId)).componentCount == 4);
 			Operand value(this, state, valueId);
 			dst.move(0, SIMD::UInt(31) - Ctlz(value.UInt(0) & SIMD::UInt(15), false));
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformShuffle:
+	case spv::OpGroupNonUniformShuffle:
 		{
 			Operand value(this, state, insn.word(4));
 			Operand id(this, state, insn.word(5));
@@ -292,10 +292,10 @@
 				SIMD::Int v = value.Int(i);
 				dst.move(i, (x & v.xxxx) | (y & v.yyyy) | (z & v.zzzz) | (w & v.wwww));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformShuffleXor:
+	case spv::OpGroupNonUniformShuffleXor:
 		{
 			Operand value(this, state, insn.word(4));
 			Operand mask(this, state, insn.word(5));
@@ -308,10 +308,10 @@
 				SIMD::Int v = value.Int(i);
 				dst.move(i, (x & v.xxxx) | (y & v.yyyy) | (z & v.zzzz) | (w & v.wwww));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformShuffleUp:
+	case spv::OpGroupNonUniformShuffleUp:
 		{
 			Operand value(this, state, insn.word(4));
 			Operand delta(this, state, insn.word(5));
@@ -324,10 +324,10 @@
 				SIMD::Int v = value.Int(i);
 				dst.move(i, (d0 & v.xyzw) | (d1 & v.xxyz) | (d2 & v.xxxy) | (d3 & v.xxxx));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformShuffleDown:
+	case spv::OpGroupNonUniformShuffleDown:
 		{
 			Operand value(this, state, insn.word(4));
 			Operand delta(this, state, insn.word(5));
@@ -340,116 +340,116 @@
 				SIMD::Int v = value.Int(i);
 				dst.move(i, (d0 & v.xyzw) | (d1 & v.yzww) | (d2 & v.zwww) | (d3 & v.wwww));
 			}
-			break;
 		}
+		break;
 
-		case spv::OpGroupNonUniformIAdd:
-			Impl::Group::BinaryOperation<SIMD::Int>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) { return a + b; });
-			break;
+	case spv::OpGroupNonUniformIAdd:
+		Impl::Group::BinaryOperation<SIMD::Int>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) { return a + b; });
+		break;
 
-		case spv::OpGroupNonUniformFAdd:
-			Impl::Group::BinaryOperation<SIMD::Float>(
-			    this, insn, state, dst, 0.0f,
-			    [](auto a, auto b) { return a + b; });
-			break;
+	case spv::OpGroupNonUniformFAdd:
+		Impl::Group::BinaryOperation<SIMD::Float>(
+		    this, insn, state, dst, 0.0f,
+		    [](auto a, auto b) { return a + b; });
+		break;
 
-		case spv::OpGroupNonUniformIMul:
-			Impl::Group::BinaryOperation<SIMD::Int>(
-			    this, insn, state, dst, 1,
-			    [](auto a, auto b) { return a * b; });
-			break;
+	case spv::OpGroupNonUniformIMul:
+		Impl::Group::BinaryOperation<SIMD::Int>(
+		    this, insn, state, dst, 1,
+		    [](auto a, auto b) { return a * b; });
+		break;
 
-		case spv::OpGroupNonUniformFMul:
-			Impl::Group::BinaryOperation<SIMD::Float>(
-			    this, insn, state, dst, 1.0f,
-			    [](auto a, auto b) { return a * b; });
-			break;
+	case spv::OpGroupNonUniformFMul:
+		Impl::Group::BinaryOperation<SIMD::Float>(
+		    this, insn, state, dst, 1.0f,
+		    [](auto a, auto b) { return a * b; });
+		break;
 
-		case spv::OpGroupNonUniformBitwiseAnd:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, ~0u,
-			    [](auto a, auto b) { return a & b; });
-			break;
+	case spv::OpGroupNonUniformBitwiseAnd:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, ~0u,
+		    [](auto a, auto b) { return a & b; });
+		break;
 
-		case spv::OpGroupNonUniformBitwiseOr:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) { return a | b; });
-			break;
+	case spv::OpGroupNonUniformBitwiseOr:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) { return a | b; });
+		break;
 
-		case spv::OpGroupNonUniformBitwiseXor:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) { return a ^ b; });
-			break;
+	case spv::OpGroupNonUniformBitwiseXor:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) { return a ^ b; });
+		break;
 
-		case spv::OpGroupNonUniformSMin:
-			Impl::Group::BinaryOperation<SIMD::Int>(
-			    this, insn, state, dst, INT32_MAX,
-			    [](auto a, auto b) { return Min(a, b); });
-			break;
+	case spv::OpGroupNonUniformSMin:
+		Impl::Group::BinaryOperation<SIMD::Int>(
+		    this, insn, state, dst, INT32_MAX,
+		    [](auto a, auto b) { return Min(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformUMin:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, ~0u,
-			    [](auto a, auto b) { return Min(a, b); });
-			break;
+	case spv::OpGroupNonUniformUMin:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, ~0u,
+		    [](auto a, auto b) { return Min(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformFMin:
-			Impl::Group::BinaryOperation<SIMD::Float>(
-			    this, insn, state, dst, SIMD::Float::infinity(),
-			    [](auto a, auto b) { return NMin(a, b); });
-			break;
+	case spv::OpGroupNonUniformFMin:
+		Impl::Group::BinaryOperation<SIMD::Float>(
+		    this, insn, state, dst, SIMD::Float::infinity(),
+		    [](auto a, auto b) { return NMin(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformSMax:
-			Impl::Group::BinaryOperation<SIMD::Int>(
-			    this, insn, state, dst, INT32_MIN,
-			    [](auto a, auto b) { return Max(a, b); });
-			break;
+	case spv::OpGroupNonUniformSMax:
+		Impl::Group::BinaryOperation<SIMD::Int>(
+		    this, insn, state, dst, INT32_MIN,
+		    [](auto a, auto b) { return Max(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformUMax:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) { return Max(a, b); });
-			break;
+	case spv::OpGroupNonUniformUMax:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) { return Max(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformFMax:
-			Impl::Group::BinaryOperation<SIMD::Float>(
-			    this, insn, state, dst, -SIMD::Float::infinity(),
-			    [](auto a, auto b) { return NMax(a, b); });
-			break;
+	case spv::OpGroupNonUniformFMax:
+		Impl::Group::BinaryOperation<SIMD::Float>(
+		    this, insn, state, dst, -SIMD::Float::infinity(),
+		    [](auto a, auto b) { return NMax(a, b); });
+		break;
 
-		case spv::OpGroupNonUniformLogicalAnd:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, ~0u,
-			    [](auto a, auto b) {
-				    SIMD::UInt zero = SIMD::UInt(0);
-				    return CmpNEQ(a, zero) & CmpNEQ(b, zero);
-			    });
-			break;
+	case spv::OpGroupNonUniformLogicalAnd:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, ~0u,
+		    [](auto a, auto b) {
+			    SIMD::UInt zero = SIMD::UInt(0);
+			    return CmpNEQ(a, zero) & CmpNEQ(b, zero);
+		    });
+		break;
 
-		case spv::OpGroupNonUniformLogicalOr:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) {
-				    SIMD::UInt zero = SIMD::UInt(0);
-				    return CmpNEQ(a, zero) | CmpNEQ(b, zero);
-			    });
-			break;
+	case spv::OpGroupNonUniformLogicalOr:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) {
+			    SIMD::UInt zero = SIMD::UInt(0);
+			    return CmpNEQ(a, zero) | CmpNEQ(b, zero);
+		    });
+		break;
 
-		case spv::OpGroupNonUniformLogicalXor:
-			Impl::Group::BinaryOperation<SIMD::UInt>(
-			    this, insn, state, dst, 0,
-			    [](auto a, auto b) {
-				    SIMD::UInt zero = SIMD::UInt(0);
-				    return CmpNEQ(a, zero) ^ CmpNEQ(b, zero);
-			    });
-			break;
+	case spv::OpGroupNonUniformLogicalXor:
+		Impl::Group::BinaryOperation<SIMD::UInt>(
+		    this, insn, state, dst, 0,
+		    [](auto a, auto b) {
+			    SIMD::UInt zero = SIMD::UInt(0);
+			    return CmpNEQ(a, zero) ^ CmpNEQ(b, zero);
+		    });
+		break;
 
-		default:
-			UNSUPPORTED("EmitGroupNonUniform op: %s", OpcodeName(type.opcode()));
+	default:
+		UNSUPPORTED("EmitGroupNonUniform op: %s", OpcodeName(type.opcode()));
 	}
 	return EmitResult::Continue;
 }
diff --git a/src/Pipeline/SpirvShaderImage.cpp b/src/Pipeline/SpirvShaderImage.cpp
index 9da6d01..d0ea81a 100644
--- a/src/Pipeline/SpirvShaderImage.cpp
+++ b/src/Pipeline/SpirvShaderImage.cpp
@@ -27,49 +27,49 @@
 {
 	switch(format)
 	{
-		case spv::ImageFormatRgba32f: return VK_FORMAT_R32G32B32A32_SFLOAT;
-		case spv::ImageFormatRgba16f: return VK_FORMAT_R16G16B16A16_SFLOAT;
-		case spv::ImageFormatR32f: return VK_FORMAT_R32_SFLOAT;
-		case spv::ImageFormatRgba8: return VK_FORMAT_R8G8B8A8_UNORM;
-		case spv::ImageFormatRgba8Snorm: return VK_FORMAT_R8G8B8A8_SNORM;
-		case spv::ImageFormatRg32f: return VK_FORMAT_R32G32_SFLOAT;
-		case spv::ImageFormatRg16f: return VK_FORMAT_R16G16_SFLOAT;
-		case spv::ImageFormatR11fG11fB10f: return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
-		case spv::ImageFormatR16f: return VK_FORMAT_R16_SFLOAT;
-		case spv::ImageFormatRgba16: return VK_FORMAT_R16G16B16A16_UNORM;
-		case spv::ImageFormatRgb10A2: return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
-		case spv::ImageFormatRg16: return VK_FORMAT_R16G16_UNORM;
-		case spv::ImageFormatRg8: return VK_FORMAT_R8G8_UNORM;
-		case spv::ImageFormatR16: return VK_FORMAT_R16_UNORM;
-		case spv::ImageFormatR8: return VK_FORMAT_R8_UNORM;
-		case spv::ImageFormatRgba16Snorm: return VK_FORMAT_R16G16B16A16_SNORM;
-		case spv::ImageFormatRg16Snorm: return VK_FORMAT_R16G16_SNORM;
-		case spv::ImageFormatRg8Snorm: return VK_FORMAT_R8G8_SNORM;
-		case spv::ImageFormatR16Snorm: return VK_FORMAT_R16_SNORM;
-		case spv::ImageFormatR8Snorm: return VK_FORMAT_R8_SNORM;
-		case spv::ImageFormatRgba32i: return VK_FORMAT_R32G32B32A32_SINT;
-		case spv::ImageFormatRgba16i: return VK_FORMAT_R16G16B16A16_SINT;
-		case spv::ImageFormatRgba8i: return VK_FORMAT_R8G8B8A8_SINT;
-		case spv::ImageFormatR32i: return VK_FORMAT_R32_SINT;
-		case spv::ImageFormatRg32i: return VK_FORMAT_R32G32_SINT;
-		case spv::ImageFormatRg16i: return VK_FORMAT_R16G16_SINT;
-		case spv::ImageFormatRg8i: return VK_FORMAT_R8G8_SINT;
-		case spv::ImageFormatR16i: return VK_FORMAT_R16_SINT;
-		case spv::ImageFormatR8i: return VK_FORMAT_R8_SINT;
-		case spv::ImageFormatRgba32ui: return VK_FORMAT_R32G32B32A32_UINT;
-		case spv::ImageFormatRgba16ui: return VK_FORMAT_R16G16B16A16_UINT;
-		case spv::ImageFormatRgba8ui: return VK_FORMAT_R8G8B8A8_UINT;
-		case spv::ImageFormatR32ui: return VK_FORMAT_R32_UINT;
-		case spv::ImageFormatRgb10a2ui: return VK_FORMAT_A2B10G10R10_UINT_PACK32;
-		case spv::ImageFormatRg32ui: return VK_FORMAT_R32G32_UINT;
-		case spv::ImageFormatRg16ui: return VK_FORMAT_R16G16_UINT;
-		case spv::ImageFormatRg8ui: return VK_FORMAT_R8G8_UINT;
-		case spv::ImageFormatR16ui: return VK_FORMAT_R16_UINT;
-		case spv::ImageFormatR8ui: return VK_FORMAT_R8_UINT;
+	case spv::ImageFormatRgba32f: return VK_FORMAT_R32G32B32A32_SFLOAT;
+	case spv::ImageFormatRgba16f: return VK_FORMAT_R16G16B16A16_SFLOAT;
+	case spv::ImageFormatR32f: return VK_FORMAT_R32_SFLOAT;
+	case spv::ImageFormatRgba8: return VK_FORMAT_R8G8B8A8_UNORM;
+	case spv::ImageFormatRgba8Snorm: return VK_FORMAT_R8G8B8A8_SNORM;
+	case spv::ImageFormatRg32f: return VK_FORMAT_R32G32_SFLOAT;
+	case spv::ImageFormatRg16f: return VK_FORMAT_R16G16_SFLOAT;
+	case spv::ImageFormatR11fG11fB10f: return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
+	case spv::ImageFormatR16f: return VK_FORMAT_R16_SFLOAT;
+	case spv::ImageFormatRgba16: return VK_FORMAT_R16G16B16A16_UNORM;
+	case spv::ImageFormatRgb10A2: return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
+	case spv::ImageFormatRg16: return VK_FORMAT_R16G16_UNORM;
+	case spv::ImageFormatRg8: return VK_FORMAT_R8G8_UNORM;
+	case spv::ImageFormatR16: return VK_FORMAT_R16_UNORM;
+	case spv::ImageFormatR8: return VK_FORMAT_R8_UNORM;
+	case spv::ImageFormatRgba16Snorm: return VK_FORMAT_R16G16B16A16_SNORM;
+	case spv::ImageFormatRg16Snorm: return VK_FORMAT_R16G16_SNORM;
+	case spv::ImageFormatRg8Snorm: return VK_FORMAT_R8G8_SNORM;
+	case spv::ImageFormatR16Snorm: return VK_FORMAT_R16_SNORM;
+	case spv::ImageFormatR8Snorm: return VK_FORMAT_R8_SNORM;
+	case spv::ImageFormatRgba32i: return VK_FORMAT_R32G32B32A32_SINT;
+	case spv::ImageFormatRgba16i: return VK_FORMAT_R16G16B16A16_SINT;
+	case spv::ImageFormatRgba8i: return VK_FORMAT_R8G8B8A8_SINT;
+	case spv::ImageFormatR32i: return VK_FORMAT_R32_SINT;
+	case spv::ImageFormatRg32i: return VK_FORMAT_R32G32_SINT;
+	case spv::ImageFormatRg16i: return VK_FORMAT_R16G16_SINT;
+	case spv::ImageFormatRg8i: return VK_FORMAT_R8G8_SINT;
+	case spv::ImageFormatR16i: return VK_FORMAT_R16_SINT;
+	case spv::ImageFormatR8i: return VK_FORMAT_R8_SINT;
+	case spv::ImageFormatRgba32ui: return VK_FORMAT_R32G32B32A32_UINT;
+	case spv::ImageFormatRgba16ui: return VK_FORMAT_R16G16B16A16_UINT;
+	case spv::ImageFormatRgba8ui: return VK_FORMAT_R8G8B8A8_UINT;
+	case spv::ImageFormatR32ui: return VK_FORMAT_R32_UINT;
+	case spv::ImageFormatRgb10a2ui: return VK_FORMAT_A2B10G10R10_UINT_PACK32;
+	case spv::ImageFormatRg32ui: return VK_FORMAT_R32G32_UINT;
+	case spv::ImageFormatRg16ui: return VK_FORMAT_R16G16_UINT;
+	case spv::ImageFormatRg8ui: return VK_FORMAT_R8G8_UINT;
+	case spv::ImageFormatR16ui: return VK_FORMAT_R16_UINT;
+	case spv::ImageFormatR8ui: return VK_FORMAT_R8_UINT;
 
-		default:
-			UNSUPPORTED("SPIR-V ImageFormat %u", format);
-			return VK_FORMAT_UNDEFINED;
+	default:
+		UNSUPPORTED("SPIR-V ImageFormat %u", format);
+		return VK_FORMAT_UNDEFINED;
 	}
 }
 
@@ -387,21 +387,21 @@
 
 	switch(descriptorType)
 	{
-		case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
-		case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
-			width = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, width));
-			height = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, height));
-			depth = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, depth));
-			break;
-		case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-		case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
-		case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
-			width = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, width));
-			height = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, height));
-			depth = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, depth));
-			break;
-		default:
-			UNREACHABLE("Image descriptorType: %d", int(descriptorType));
+	case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
+	case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
+		width = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, width));
+		height = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, height));
+		depth = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, depth));
+		break;
+	case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
+	case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
+	case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
+		width = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, width));
+		height = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, height));
+		depth = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, depth));
+		break;
+	default:
+		UNREACHABLE("Image descriptorType: %d", int(descriptorType));
 	}
 
 	if(lodId != 0)
@@ -442,13 +442,13 @@
 	Int mipLevels = 0;
 	switch(descriptorType)
 	{
-		case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-		case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
-		case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
-			mipLevels = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, mipLevels));  // uint32_t
-			break;
-		default:
-			UNREACHABLE("Image descriptorType: %d", int(descriptorType));
+	case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
+	case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
+	case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
+		mipLevels = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, mipLevels));  // uint32_t
+		break;
+	default:
+		UNREACHABLE("Image descriptorType: %d", int(descriptorType));
 	}
 
 	auto &dst = state->createIntermediate(insn.resultId(), 1);
@@ -474,16 +474,16 @@
 	Int sampleCount = 0;
 	switch(descriptorType)
 	{
-		case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
-			sampleCount = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, sampleCount));  // uint32_t
-			break;
-		case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-		case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
-		case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
-			sampleCount = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, sampleCount));  // uint32_t
-			break;
-		default:
-			UNREACHABLE("Image descriptorType: %d", int(descriptorType));
+	case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
+		sampleCount = *Pointer<Int>(descriptor + OFFSET(vk::StorageImageDescriptor, sampleCount));  // uint32_t
+		break;
+	case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
+	case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
+	case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
+		sampleCount = *Pointer<Int>(descriptor + OFFSET(vk::SampledImageDescriptor, sampleCount));  // uint32_t
+		break;
+	default:
+		UNREACHABLE("Image descriptorType: %d", int(descriptorType));
 	}
 
 	auto &dst = state->createIntermediate(insn.resultId(), 1);
@@ -723,281 +723,281 @@
 	// - Any format supported as a color or depth/stencil attachment, for input attachments
 	switch(vkFormat)
 	{
-		case VK_FORMAT_R32G32B32A32_SFLOAT:
-		case VK_FORMAT_R32G32B32A32_SINT:
-		case VK_FORMAT_R32G32B32A32_UINT:
-			dst.move(0, packed[0]);
-			dst.move(1, packed[1]);
-			dst.move(2, packed[2]);
-			dst.move(3, packed[3]);
-			break;
-		case VK_FORMAT_R32_SINT:
-		case VK_FORMAT_R32_UINT:
-			dst.move(0, packed[0]);
-			// Fill remaining channels with 0,0,1 (of the correct type)
-			dst.move(1, SIMD::Int(0));
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R32_SFLOAT:
-		case VK_FORMAT_D32_SFLOAT:
-		case VK_FORMAT_D32_SFLOAT_S8_UINT:
-			dst.move(0, packed[0]);
-			// Fill remaining channels with 0,0,1 (of the correct type)
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_D16_UNORM:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16G16B16A16_UNORM:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(1, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(2, SIMD::Float(packed[1] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(3, SIMD::Float((packed[1] >> 16) & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			break;
-		case VK_FORMAT_R16G16B16A16_SNORM:
-			dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(1, Max(SIMD::Float(packed[0] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(2, Max(SIMD::Float((packed[1] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(3, Max(SIMD::Float(packed[1] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			break;
-		case VK_FORMAT_R16G16B16A16_SINT:
-			dst.move(0, (packed[0] << 16) >> 16);
-			dst.move(1, packed[0] >> 16);
-			dst.move(2, (packed[1] << 16) >> 16);
-			dst.move(3, packed[1] >> 16);
-			break;
-		case VK_FORMAT_R16G16B16A16_UINT:
-			dst.move(0, packed[0] & SIMD::Int(0xFFFF));
-			dst.move(1, (packed[0] >> 16) & SIMD::Int(0xFFFF));
-			dst.move(2, packed[1] & SIMD::Int(0xFFFF));
-			dst.move(3, (packed[1] >> 16) & SIMD::Int(0xFFFF));
-			break;
-		case VK_FORMAT_R16G16B16A16_SFLOAT:
-			dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
-			dst.move(1, halfToFloatBits((As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFFFF0000)) >> 16));
-			dst.move(2, halfToFloatBits(As<SIMD::UInt>(packed[1]) & SIMD::UInt(0x0000FFFF)));
-			dst.move(3, halfToFloatBits((As<SIMD::UInt>(packed[1]) & SIMD::UInt(0xFFFF0000)) >> 16));
-			break;
-		case VK_FORMAT_R8G8B8A8_SNORM:
-		case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
-			dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(1, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(2, Max(SIMD::Float((packed[0] << 8) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(3, Max(SIMD::Float((packed[0]) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			break;
-		case VK_FORMAT_R8G8B8A8_UNORM:
-		case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(2, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			break;
-		case VK_FORMAT_R8G8B8A8_SRGB:
-		case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
-			dst.move(0, ::sRGBtoLinear(SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(1, ::sRGBtoLinear(SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(2, ::sRGBtoLinear(SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			break;
-		case VK_FORMAT_B8G8R8A8_UNORM:
-			dst.move(0, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(2, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			break;
-		case VK_FORMAT_B8G8R8A8_SRGB:
-			dst.move(0, ::sRGBtoLinear(SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(1, ::sRGBtoLinear(SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(2, ::sRGBtoLinear(SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
-			dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			break;
-		case VK_FORMAT_R8G8B8A8_UINT:
-		case VK_FORMAT_A8B8G8R8_UINT_PACK32:
-			dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
-			dst.move(1, (As<SIMD::UInt>(packed[0]) >> 8) & SIMD::UInt(0xFF));
-			dst.move(2, (As<SIMD::UInt>(packed[0]) >> 16) & SIMD::UInt(0xFF));
-			dst.move(3, (As<SIMD::UInt>(packed[0]) >> 24) & SIMD::UInt(0xFF));
-			break;
-		case VK_FORMAT_R8G8B8A8_SINT:
-		case VK_FORMAT_A8B8G8R8_SINT_PACK32:
-			dst.move(0, (packed[0] << 24) >> 24);
-			dst.move(1, (packed[0] << 16) >> 24);
-			dst.move(2, (packed[0] << 8) >> 24);
-			dst.move(3, packed[0] >> 24);
-			break;
-		case VK_FORMAT_R8_UNORM:
-			dst.move(0, SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 0xFF));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R8_SNORM:
-			dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R8_UINT:
-		case VK_FORMAT_S8_UINT:
-			dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
-			dst.move(1, SIMD::UInt(0));
-			dst.move(2, SIMD::UInt(0));
-			dst.move(3, SIMD::UInt(1));
-			break;
-		case VK_FORMAT_R8_SINT:
-			dst.move(0, (packed[0] << 24) >> 24);
-			dst.move(1, SIMD::Int(0));
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R8G8_UNORM:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R8G8_SNORM:
-			dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(1, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R8G8_UINT:
-			dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
-			dst.move(1, (As<SIMD::UInt>(packed[0]) >> 8) & SIMD::UInt(0xFF));
-			dst.move(2, SIMD::UInt(0));
-			dst.move(3, SIMD::UInt(1));
-			break;
-		case VK_FORMAT_R8G8_SINT:
-			dst.move(0, (packed[0] << 24) >> 24);
-			dst.move(1, (packed[0] << 16) >> 24);
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R16_SFLOAT:
-			dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16_UNORM:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16_SNORM:
-			dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(1, SIMD::Float(0.0f));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16_UINT:
-			dst.move(0, packed[0] & SIMD::Int(0xFFFF));
-			dst.move(1, SIMD::UInt(0));
-			dst.move(2, SIMD::UInt(0));
-			dst.move(3, SIMD::UInt(1));
-			break;
-		case VK_FORMAT_R16_SINT:
-			dst.move(0, (packed[0] << 16) >> 16);
-			dst.move(1, SIMD::Int(0));
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R16G16_SFLOAT:
-			dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
-			dst.move(1, halfToFloatBits((As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFFFF0000)) >> 16));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16G16_UNORM:
-			dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(1, SIMD::Float(As<SIMD::UInt>(packed[0]) >> 16) * SIMD::Float(1.0f / 0xFFFF));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16G16_SNORM:
-			dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(1, Max(SIMD::Float(packed[0] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_R16G16_UINT:
-			dst.move(0, packed[0] & SIMD::Int(0xFFFF));
-			dst.move(1, (packed[0] >> 16) & SIMD::Int(0xFFFF));
-			dst.move(2, SIMD::UInt(0));
-			dst.move(3, SIMD::UInt(1));
-			break;
-		case VK_FORMAT_R16G16_SINT:
-			dst.move(0, (packed[0] << 16) >> 16);
-			dst.move(1, packed[0] >> 16);
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R32G32_SINT:
-		case VK_FORMAT_R32G32_UINT:
-			dst.move(0, packed[0]);
-			dst.move(1, packed[1]);
-			dst.move(2, SIMD::Int(0));
-			dst.move(3, SIMD::Int(1));
-			break;
-		case VK_FORMAT_R32G32_SFLOAT:
-			dst.move(0, packed[0]);
-			dst.move(1, packed[1]);
-			dst.move(2, SIMD::Float(0.0f));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_A2B10G10R10_UINT_PACK32:
-			dst.move(0, packed[0] & SIMD::Int(0x3FF));
-			dst.move(1, (packed[0] >> 10) & SIMD::Int(0x3FF));
-			dst.move(2, (packed[0] >> 20) & SIMD::Int(0x3FF));
-			dst.move(3, (packed[0] >> 30) & SIMD::Int(0x3));
-			break;
-		case VK_FORMAT_A2R10G10B10_UINT_PACK32:
-			dst.move(2, packed[0] & SIMD::Int(0x3FF));
-			dst.move(1, (packed[0] >> 10) & SIMD::Int(0x3FF));
-			dst.move(0, (packed[0] >> 20) & SIMD::Int(0x3FF));
-			dst.move(3, (packed[0] >> 30) & SIMD::Int(0x3));
-			break;
-		case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
-			dst.move(0, SIMD::Float((packed[0]) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(1, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(2, SIMD::Float((packed[0] >> 20) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(3, SIMD::Float((packed[0] >> 30) & SIMD::Int(0x3)) * SIMD::Float(1.0f / 0x3));
-			break;
-		case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
-			dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(1, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(0, SIMD::Float((packed[0] >> 20) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
-			dst.move(3, SIMD::Float((packed[0] >> 30) & SIMD::Int(0x3)) * SIMD::Float(1.0f / 0x3));
-			break;
-		case VK_FORMAT_R5G6B5_UNORM_PACK16:
-			dst.move(0, SIMD::Float((packed[0] >> 11) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
-			dst.move(1, SIMD::Float((packed[0] >> 5) & SIMD::Int(0x3F)) * SIMD::Float(1.0f / 0x3F));
-			dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
-			dst.move(0, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
-			dst.move(1, SIMD::Float((packed[0] >> 5) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
-			dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
-			dst.move(3, SIMD::Float((packed[0] >> 15) & SIMD::Int(0x1)));
-			break;
-		case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
-			dst.move(0, halfToFloatBits((packed[0] << 4) & SIMD::Int(0x7FF0)));
-			dst.move(1, halfToFloatBits((packed[0] >> 7) & SIMD::Int(0x7FF0)));
-			dst.move(2, halfToFloatBits((packed[0] >> 17) & SIMD::Int(0x7FE0)));
-			dst.move(3, SIMD::Float(1.0f));
-			break;
-		default:
-			UNSUPPORTED("VkFormat %d", int(vkFormat));
-			break;
+	case VK_FORMAT_R32G32B32A32_SFLOAT:
+	case VK_FORMAT_R32G32B32A32_SINT:
+	case VK_FORMAT_R32G32B32A32_UINT:
+		dst.move(0, packed[0]);
+		dst.move(1, packed[1]);
+		dst.move(2, packed[2]);
+		dst.move(3, packed[3]);
+		break;
+	case VK_FORMAT_R32_SINT:
+	case VK_FORMAT_R32_UINT:
+		dst.move(0, packed[0]);
+		// Fill remaining channels with 0,0,1 (of the correct type)
+		dst.move(1, SIMD::Int(0));
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R32_SFLOAT:
+	case VK_FORMAT_D32_SFLOAT:
+	case VK_FORMAT_D32_SFLOAT_S8_UINT:
+		dst.move(0, packed[0]);
+		// Fill remaining channels with 0,0,1 (of the correct type)
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_D16_UNORM:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16G16B16A16_UNORM:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(1, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(2, SIMD::Float(packed[1] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(3, SIMD::Float((packed[1] >> 16) & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		break;
+	case VK_FORMAT_R16G16B16A16_SNORM:
+		dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(1, Max(SIMD::Float(packed[0] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(2, Max(SIMD::Float((packed[1] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(3, Max(SIMD::Float(packed[1] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		break;
+	case VK_FORMAT_R16G16B16A16_SINT:
+		dst.move(0, (packed[0] << 16) >> 16);
+		dst.move(1, packed[0] >> 16);
+		dst.move(2, (packed[1] << 16) >> 16);
+		dst.move(3, packed[1] >> 16);
+		break;
+	case VK_FORMAT_R16G16B16A16_UINT:
+		dst.move(0, packed[0] & SIMD::Int(0xFFFF));
+		dst.move(1, (packed[0] >> 16) & SIMD::Int(0xFFFF));
+		dst.move(2, packed[1] & SIMD::Int(0xFFFF));
+		dst.move(3, (packed[1] >> 16) & SIMD::Int(0xFFFF));
+		break;
+	case VK_FORMAT_R16G16B16A16_SFLOAT:
+		dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
+		dst.move(1, halfToFloatBits((As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFFFF0000)) >> 16));
+		dst.move(2, halfToFloatBits(As<SIMD::UInt>(packed[1]) & SIMD::UInt(0x0000FFFF)));
+		dst.move(3, halfToFloatBits((As<SIMD::UInt>(packed[1]) & SIMD::UInt(0xFFFF0000)) >> 16));
+		break;
+	case VK_FORMAT_R8G8B8A8_SNORM:
+	case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
+		dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(1, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(2, Max(SIMD::Float((packed[0] << 8) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(3, Max(SIMD::Float((packed[0]) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		break;
+	case VK_FORMAT_R8G8B8A8_UNORM:
+	case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(2, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		break;
+	case VK_FORMAT_R8G8B8A8_SRGB:
+	case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
+		dst.move(0, ::sRGBtoLinear(SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(1, ::sRGBtoLinear(SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(2, ::sRGBtoLinear(SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		break;
+	case VK_FORMAT_B8G8R8A8_UNORM:
+		dst.move(0, SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(2, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		break;
+	case VK_FORMAT_B8G8R8A8_SRGB:
+		dst.move(0, ::sRGBtoLinear(SIMD::Float((packed[0] >> 16) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(1, ::sRGBtoLinear(SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(2, ::sRGBtoLinear(SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF)));
+		dst.move(3, SIMD::Float((packed[0] >> 24) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		break;
+	case VK_FORMAT_R8G8B8A8_UINT:
+	case VK_FORMAT_A8B8G8R8_UINT_PACK32:
+		dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
+		dst.move(1, (As<SIMD::UInt>(packed[0]) >> 8) & SIMD::UInt(0xFF));
+		dst.move(2, (As<SIMD::UInt>(packed[0]) >> 16) & SIMD::UInt(0xFF));
+		dst.move(3, (As<SIMD::UInt>(packed[0]) >> 24) & SIMD::UInt(0xFF));
+		break;
+	case VK_FORMAT_R8G8B8A8_SINT:
+	case VK_FORMAT_A8B8G8R8_SINT_PACK32:
+		dst.move(0, (packed[0] << 24) >> 24);
+		dst.move(1, (packed[0] << 16) >> 24);
+		dst.move(2, (packed[0] << 8) >> 24);
+		dst.move(3, packed[0] >> 24);
+		break;
+	case VK_FORMAT_R8_UNORM:
+		dst.move(0, SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 0xFF));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R8_SNORM:
+		dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R8_UINT:
+	case VK_FORMAT_S8_UINT:
+		dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
+		dst.move(1, SIMD::UInt(0));
+		dst.move(2, SIMD::UInt(0));
+		dst.move(3, SIMD::UInt(1));
+		break;
+	case VK_FORMAT_R8_SINT:
+		dst.move(0, (packed[0] << 24) >> 24);
+		dst.move(1, SIMD::Int(0));
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R8G8_UNORM:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(1, SIMD::Float((packed[0] >> 8) & SIMD::Int(0xFF)) * SIMD::Float(1.0f / 0xFF));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R8G8_SNORM:
+		dst.move(0, Max(SIMD::Float((packed[0] << 24) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(1, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFF000000)) * SIMD::Float(1.0f / 0x7F000000), SIMD::Float(-1.0f)));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R8G8_UINT:
+		dst.move(0, As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFF));
+		dst.move(1, (As<SIMD::UInt>(packed[0]) >> 8) & SIMD::UInt(0xFF));
+		dst.move(2, SIMD::UInt(0));
+		dst.move(3, SIMD::UInt(1));
+		break;
+	case VK_FORMAT_R8G8_SINT:
+		dst.move(0, (packed[0] << 24) >> 24);
+		dst.move(1, (packed[0] << 16) >> 24);
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R16_SFLOAT:
+		dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16_UNORM:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16_SNORM:
+		dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(1, SIMD::Float(0.0f));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16_UINT:
+		dst.move(0, packed[0] & SIMD::Int(0xFFFF));
+		dst.move(1, SIMD::UInt(0));
+		dst.move(2, SIMD::UInt(0));
+		dst.move(3, SIMD::UInt(1));
+		break;
+	case VK_FORMAT_R16_SINT:
+		dst.move(0, (packed[0] << 16) >> 16);
+		dst.move(1, SIMD::Int(0));
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R16G16_SFLOAT:
+		dst.move(0, halfToFloatBits(As<SIMD::UInt>(packed[0]) & SIMD::UInt(0x0000FFFF)));
+		dst.move(1, halfToFloatBits((As<SIMD::UInt>(packed[0]) & SIMD::UInt(0xFFFF0000)) >> 16));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16G16_UNORM:
+		dst.move(0, SIMD::Float(packed[0] & SIMD::Int(0xFFFF)) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(1, SIMD::Float(As<SIMD::UInt>(packed[0]) >> 16) * SIMD::Float(1.0f / 0xFFFF));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16G16_SNORM:
+		dst.move(0, Max(SIMD::Float((packed[0] << 16) & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(1, Max(SIMD::Float(packed[0] & SIMD::Int(0xFFFF0000)) * SIMD::Float(1.0f / 0x7FFF0000), SIMD::Float(-1.0f)));
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_R16G16_UINT:
+		dst.move(0, packed[0] & SIMD::Int(0xFFFF));
+		dst.move(1, (packed[0] >> 16) & SIMD::Int(0xFFFF));
+		dst.move(2, SIMD::UInt(0));
+		dst.move(3, SIMD::UInt(1));
+		break;
+	case VK_FORMAT_R16G16_SINT:
+		dst.move(0, (packed[0] << 16) >> 16);
+		dst.move(1, packed[0] >> 16);
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R32G32_SINT:
+	case VK_FORMAT_R32G32_UINT:
+		dst.move(0, packed[0]);
+		dst.move(1, packed[1]);
+		dst.move(2, SIMD::Int(0));
+		dst.move(3, SIMD::Int(1));
+		break;
+	case VK_FORMAT_R32G32_SFLOAT:
+		dst.move(0, packed[0]);
+		dst.move(1, packed[1]);
+		dst.move(2, SIMD::Float(0.0f));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+		dst.move(0, packed[0] & SIMD::Int(0x3FF));
+		dst.move(1, (packed[0] >> 10) & SIMD::Int(0x3FF));
+		dst.move(2, (packed[0] >> 20) & SIMD::Int(0x3FF));
+		dst.move(3, (packed[0] >> 30) & SIMD::Int(0x3));
+		break;
+	case VK_FORMAT_A2R10G10B10_UINT_PACK32:
+		dst.move(2, packed[0] & SIMD::Int(0x3FF));
+		dst.move(1, (packed[0] >> 10) & SIMD::Int(0x3FF));
+		dst.move(0, (packed[0] >> 20) & SIMD::Int(0x3FF));
+		dst.move(3, (packed[0] >> 30) & SIMD::Int(0x3));
+		break;
+	case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+		dst.move(0, SIMD::Float((packed[0]) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(1, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(2, SIMD::Float((packed[0] >> 20) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(3, SIMD::Float((packed[0] >> 30) & SIMD::Int(0x3)) * SIMD::Float(1.0f / 0x3));
+		break;
+	case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+		dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(1, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(0, SIMD::Float((packed[0] >> 20) & SIMD::Int(0x3FF)) * SIMD::Float(1.0f / 0x3FF));
+		dst.move(3, SIMD::Float((packed[0] >> 30) & SIMD::Int(0x3)) * SIMD::Float(1.0f / 0x3));
+		break;
+	case VK_FORMAT_R5G6B5_UNORM_PACK16:
+		dst.move(0, SIMD::Float((packed[0] >> 11) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
+		dst.move(1, SIMD::Float((packed[0] >> 5) & SIMD::Int(0x3F)) * SIMD::Float(1.0f / 0x3F));
+		dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
+		dst.move(0, SIMD::Float((packed[0] >> 10) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
+		dst.move(1, SIMD::Float((packed[0] >> 5) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
+		dst.move(2, SIMD::Float((packed[0]) & SIMD::Int(0x1F)) * SIMD::Float(1.0f / 0x1F));
+		dst.move(3, SIMD::Float((packed[0] >> 15) & SIMD::Int(0x1)));
+		break;
+	case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
+		dst.move(0, halfToFloatBits((packed[0] << 4) & SIMD::Int(0x7FF0)));
+		dst.move(1, halfToFloatBits((packed[0] >> 7) & SIMD::Int(0x7FF0)));
+		dst.move(2, halfToFloatBits((packed[0] >> 17) & SIMD::Int(0x7FE0)));
+		dst.move(3, SIMD::Float(1.0f));
+		break;
+	default:
+		UNSUPPORTED("VkFormat %d", int(vkFormat));
+		break;
 	}
 
 	return EmitResult::Continue;
@@ -1053,170 +1053,170 @@
 	auto format = static_cast<spv::ImageFormat>(imageType.definition.word(8));
 	switch(format)
 	{
-		case spv::ImageFormatRgba32f:
-		case spv::ImageFormatRgba32i:
-		case spv::ImageFormatRgba32ui:
-			texelSize = 16;
-			packed[0] = texel.Int(0);
-			packed[1] = texel.Int(1);
-			packed[2] = texel.Int(2);
-			packed[3] = texel.Int(3);
-			break;
-		case spv::ImageFormatR32f:
-		case spv::ImageFormatR32i:
-		case spv::ImageFormatR32ui:
-			texelSize = 4;
-			packed[0] = texel.Int(0);
-			break;
-		case spv::ImageFormatRgba8:
-			texelSize = 4;
-			packed[0] = (SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 8) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 16) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 24);
-			break;
-		case spv::ImageFormatRgba8Snorm:
-			texelSize = 4;
-			packed[0] = (SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
-			             SIMD::Int(0xFF)) |
-			            ((SIMD::Int(Round(Min(Max(texel.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
-			              SIMD::Int(0xFF))
-			             << 8) |
-			            ((SIMD::Int(Round(Min(Max(texel.Float(2), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
-			              SIMD::Int(0xFF))
-			             << 16) |
-			            ((SIMD::Int(Round(Min(Max(texel.Float(3), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
-			              SIMD::Int(0xFF))
-			             << 24);
-			break;
-		case spv::ImageFormatRgba8i:
-		case spv::ImageFormatRgba8ui:
-			texelSize = 4;
-			packed[0] = (SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xff))) |
-			            (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xff)) << 8) |
-			            (SIMD::UInt(texel.UInt(2) & SIMD::UInt(0xff)) << 16) |
-			            (SIMD::UInt(texel.UInt(3) & SIMD::UInt(0xff)) << 24);
-			break;
-		case spv::ImageFormatRgba16f:
-			texelSize = 8;
-			packed[0] = floatToHalfBits(texel.UInt(0), false) | floatToHalfBits(texel.UInt(1), true);
-			packed[1] = floatToHalfBits(texel.UInt(2), false) | floatToHalfBits(texel.UInt(3), true);
-			break;
-		case spv::ImageFormatRgba16i:
-		case spv::ImageFormatRgba16ui:
-			texelSize = 8;
-			packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xFFFF)) << 16);
-			packed[1] = SIMD::UInt(texel.UInt(2) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(3) & SIMD::UInt(0xFFFF)) << 16);
-			break;
-		case spv::ImageFormatRg32f:
-		case spv::ImageFormatRg32i:
-		case spv::ImageFormatRg32ui:
-			texelSize = 8;
-			packed[0] = texel.Int(0);
-			packed[1] = texel.Int(1);
-			break;
-		case spv::ImageFormatRg16f:
-			texelSize = 4;
-			packed[0] = floatToHalfBits(texel.UInt(0), false) | floatToHalfBits(texel.UInt(1), true);
-			break;
-		case spv::ImageFormatRg16i:
-		case spv::ImageFormatRg16ui:
-			texelSize = 4;
-			packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xFFFF)) << 16);
-			break;
-		case spv::ImageFormatR11fG11fB10f:
-			texelSize = 4;
-			// Truncates instead of rounding. See b/147900455
-			packed[0] = ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(0), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FF0)) >> 4) |
-			            ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(1), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FF0)) << 7) |
-			            ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(2), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FE0)) << 17);
-			break;
-		case spv::ImageFormatR16f:
-			texelSize = 2;
-			packed[0] = floatToHalfBits(texel.UInt(0), false);
-			break;
-		case spv::ImageFormatRgba16:
-			texelSize = 8;
-			packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) |
-			            (SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) << 16);
-			packed[1] = SIMD::UInt(Round(Min(Max(texel.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) |
-			            (SIMD::UInt(Round(Min(Max(texel.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) << 16);
-			break;
-		case spv::ImageFormatRgb10A2:
-			texelSize = 4;
-			packed[0] = (SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x3FF)))) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x3FF)))) << 10) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x3FF)))) << 20) |
-			            ((SIMD::UInt(Round(Min(Max(texel.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x3)))) << 30);
-			break;
-		case spv::ImageFormatRg16:
-			texelSize = 4;
-			packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) |
-			            (SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) << 16);
-			break;
-		case spv::ImageFormatRg8:
-			texelSize = 2;
-			packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFF))) |
-			            (SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFF))) << 8);
-			break;
-		case spv::ImageFormatR16:
-			texelSize = 2;
-			packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF)));
-			break;
-		case spv::ImageFormatR8:
-			texelSize = 1;
-			packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFF)));
-			break;
-		case spv::ImageFormatRgba16Snorm:
-			texelSize = 8;
-			packed[0] = (SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) & SIMD::Int(0xFFFF)) |
-			            (SIMD::Int(Round(Min(Max(texel.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) << 16);
-			packed[1] = (SIMD::Int(Round(Min(Max(texel.Float(2), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) & SIMD::Int(0xFFFF)) |
-			            (SIMD::Int(Round(Min(Max(texel.Float(3), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) << 16);
-			break;
-		case spv::ImageFormatRg16Snorm:
-			texelSize = 4;
-			packed[0] = (SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) & SIMD::Int(0xFFFF)) |
-			            (SIMD::Int(Round(Min(Max(texel.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF))) << 16);
-			break;
-		case spv::ImageFormatRg8Snorm:
-			texelSize = 2;
-			packed[0] = (SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7F))) & SIMD::Int(0xFF)) |
-			            (SIMD::Int(Round(Min(Max(texel.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7F))) << 8);
-			break;
-		case spv::ImageFormatR16Snorm:
-			texelSize = 2;
-			packed[0] = SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7FFF)));
-			break;
-		case spv::ImageFormatR8Snorm:
-			texelSize = 1;
-			packed[0] = SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(0x7F)));
-			break;
-		case spv::ImageFormatRg8i:
-		case spv::ImageFormatRg8ui:
-			texelSize = 2;
-			packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFF)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xFF)) << 8);
-			break;
-		case spv::ImageFormatR16i:
-		case spv::ImageFormatR16ui:
-			texelSize = 2;
-			packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFFFF));
-			break;
-		case spv::ImageFormatR8i:
-		case spv::ImageFormatR8ui:
-			texelSize = 1;
-			packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFF));
-			break;
-		case spv::ImageFormatRgb10a2ui:
-			texelSize = 4;
-			packed[0] = (SIMD::UInt(texel.UInt(0) & SIMD::UInt(0x3FF))) |
-			            (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0x3FF)) << 10) |
-			            (SIMD::UInt(texel.UInt(2) & SIMD::UInt(0x3FF)) << 20) |
-			            (SIMD::UInt(texel.UInt(3) & SIMD::UInt(0x3)) << 30);
-			break;
-		default:
-			UNSUPPORTED("spv::ImageFormat %d", int(format));
-			break;
+	case spv::ImageFormatRgba32f:
+	case spv::ImageFormatRgba32i:
+	case spv::ImageFormatRgba32ui:
+		texelSize = 16;
+		packed[0] = texel.Int(0);
+		packed[1] = texel.Int(1);
+		packed[2] = texel.Int(2);
+		packed[3] = texel.Int(3);
+		break;
+	case spv::ImageFormatR32f:
+	case spv::ImageFormatR32i:
+	case spv::ImageFormatR32ui:
+		texelSize = 4;
+		packed[0] = texel.Int(0);
+		break;
+	case spv::ImageFormatRgba8:
+		texelSize = 4;
+		packed[0] = (SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) |
+		            ((SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 8) |
+		            ((SIMD::UInt(Round(Min(Max(texel.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 16) |
+		            ((SIMD::UInt(Round(Min(Max(texel.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 24);
+		break;
+	case spv::ImageFormatRgba8Snorm:
+		texelSize = 4;
+		packed[0] = (SIMD::Int(Round(Min(Max(texel.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
+		             SIMD::Int(0xFF)) |
+		            ((SIMD::Int(Round(Min(Max(texel.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
+		              SIMD::Int(0xFF))
+		             << 8) |
+		            ((SIMD::Int(Round(Min(Max(texel.Float(2), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
+		              SIMD::Int(0xFF))
+		             << 16) |
+		            ((SIMD::Int(Round(Min(Max(texel.Float(3), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
+		              SIMD::Int(0xFF))
+		             << 24);
+		break;
+	case spv::ImageFormatRgba8i:
+	case spv::ImageFormatRgba8ui:
+		texelSize = 4;
+		packed[0] = (SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xff))) |
+		            (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xff)) << 8) |
+		            (SIMD::UInt(texel.UInt(2) & SIMD::UInt(0xff)) << 16) |
+		            (SIMD::UInt(texel.UInt(3) & SIMD::UInt(0xff)) << 24);
+		break;
+	case spv::ImageFormatRgba16f:
+		texelSize = 8;
+		packed[0] = floatToHalfBits(texel.UInt(0), false) | floatToHalfBits(texel.UInt(1), true);
+		packed[1] = floatToHalfBits(texel.UInt(2), false) | floatToHalfBits(texel.UInt(3), true);
+		break;
+	case spv::ImageFormatRgba16i:
+	case spv::ImageFormatRgba16ui:
+		texelSize = 8;
+		packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xFFFF)) << 16);
+		packed[1] = SIMD::UInt(texel.UInt(2) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(3) & SIMD::UInt(0xFFFF)) << 16);
+		break;
+	case spv::ImageFormatRg32f:
+	case spv::ImageFormatRg32i:
+	case spv::ImageFormatRg32ui:
+		texelSize = 8;
+		packed[0] = texel.Int(0);
+		packed[1] = texel.Int(1);
+		break;
+	case spv::ImageFormatRg16f:
+		texelSize = 4;
+		packed[0] = floatToHalfBits(texel.UInt(0), false) | floatToHalfBits(texel.UInt(1), true);
+		break;
+	case spv::ImageFormatRg16i:
+	case spv::ImageFormatRg16ui:
+		texelSize = 4;
+		packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xFFFF)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xFFFF)) << 16);
+		break;
+	case spv::ImageFormatR11fG11fB10f:
+		texelSize = 4;
+		// Truncates instead of rounding. See b/147900455
+		packed[0] = ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(0), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FF0)) >> 4) |
+		            ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(1), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FF0)) << 7) |
+		            ((floatToHalfBits(As<SIMD::UInt>(Max(texel.Float(2), SIMD::Float(0.0f))), false) & SIMD::UInt(0x7FE0)) << 17);
+		break;
+	case spv::ImageFormatR16f:
+		texelSize = 2;
+		packed[0] = floatToHalfBits(texel.UInt(0), false);
+		break;
+	case spv::ImageFormatRgba16:
+		texelSize = 8;
+		packed[0] = SIMD::UInt(Round(Min(Max(texel.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) |
+		            (SIMD::UInt(Round(Min(Max(texel.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) << 16);
+		packed[1] = SIMD::UInt(Round(Min(Max(texel.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(0xFFFF))) |
+		            (SIMD::UInt(Round(Min(Max(texel.Float(3), SIMD::Float(0.0f)), SIMD::Float(1.0