public static (PixelFormat, PixelType) GetTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.R32G32B32A32: return(PixelFormat.Rgba, PixelType.Float); case GalTextureFormat.R16G16B16A16: return(PixelFormat.Rgba, PixelType.HalfFloat); case GalTextureFormat.A8B8G8R8: return(PixelFormat.Rgba, PixelType.UnsignedByte); case GalTextureFormat.A2B10G10R10: return(PixelFormat.Rgba, PixelType.UnsignedInt2101010Reversed); case GalTextureFormat.R32: return(PixelFormat.Red, PixelType.Float); case GalTextureFormat.A1B5G5R5: return(PixelFormat.Rgba, PixelType.UnsignedShort5551); case GalTextureFormat.B5G6R5: return(PixelFormat.Rgb, PixelType.UnsignedShort565); case GalTextureFormat.G8R8: return(PixelFormat.Rg, PixelType.UnsignedByte); case GalTextureFormat.R16: return(PixelFormat.Red, PixelType.HalfFloat); case GalTextureFormat.R8: return(PixelFormat.Red, PixelType.UnsignedByte); case GalTextureFormat.ZF32: return(PixelFormat.DepthComponent, PixelType.Float); case GalTextureFormat.BF10GF11RF11: return(PixelFormat.Rgb, PixelType.UnsignedInt10F11F11FRev); case GalTextureFormat.Z24S8: return(PixelFormat.DepthStencil, PixelType.UnsignedInt248); } throw new NotImplementedException(Format.ToString()); }
public static (PixelFormat, PixelType) GetTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.R32G32B32A32: return(PixelFormat.Rgba, PixelType.Float); case GalTextureFormat.R16G16B16A16: return(PixelFormat.Rgba, PixelType.HalfFloat); case GalTextureFormat.A8B8G8R8: return(PixelFormat.Rgba, PixelType.UnsignedByte); case GalTextureFormat.R32: return(PixelFormat.Red, PixelType.Float); case GalTextureFormat.A1B5G5R5: return(PixelFormat.Rgba, PixelType.UnsignedShort5551); case GalTextureFormat.B5G6R5: return(PixelFormat.Rgb, PixelType.UnsignedShort565); case GalTextureFormat.G8R8: return(PixelFormat.Rg, PixelType.UnsignedByte); case GalTextureFormat.R16: return(PixelFormat.Red, PixelType.HalfFloat); case GalTextureFormat.R8: return(PixelFormat.Red, PixelType.UnsignedByte); } throw new NotImplementedException(Format.ToString()); }
public static (PixelFormat, PixelType) GetTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.A8B8G8R8: return(PixelFormat.Rgba, PixelType.UnsignedByte); case GalTextureFormat.A1B5G5R5: return(PixelFormat.Rgba, PixelType.UnsignedShort5551); case GalTextureFormat.B5G6R5: return(PixelFormat.Rgb, PixelType.UnsignedShort565); } throw new NotImplementedException(Format.ToString()); }
public static PixelInternalFormat GetCompressedTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.BC1: return(PixelInternalFormat.CompressedRgbaS3tcDxt1Ext); case GalTextureFormat.BC2: return(PixelInternalFormat.CompressedRgbaS3tcDxt3Ext); case GalTextureFormat.BC3: return(PixelInternalFormat.CompressedRgbaS3tcDxt5Ext); } throw new NotImplementedException(Format.ToString()); }
public static InternalFormat GetCompressedTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.BC7U: return(InternalFormat.CompressedRgbaBptcUnorm); case GalTextureFormat.BC1: return(InternalFormat.CompressedRgbaS3tcDxt1Ext); case GalTextureFormat.BC2: return(InternalFormat.CompressedRgbaS3tcDxt3Ext); case GalTextureFormat.BC3: return(InternalFormat.CompressedRgbaS3tcDxt5Ext); case GalTextureFormat.BC4: return(InternalFormat.CompressedRedRgtc1); case GalTextureFormat.BC5: return(InternalFormat.CompressedRgRgtc2); } throw new NotImplementedException(Format.ToString()); }
public static GalImageFormat ConvertTexture( GalTextureFormat Format, GalTextureType RType, GalTextureType GType, GalTextureType BType, GalTextureType AType) { if (RType != GType || RType != BType || RType != AType) { throw new NotImplementedException("Per component types are not implemented"); } GalTextureType Type = RType; switch (Type) { case GalTextureType.Snorm: switch (Format) { case GalTextureFormat.R16G16B16A16: return(GalImageFormat.R16G16B16A16_SNORM); case GalTextureFormat.A8B8G8R8: return(GalImageFormat.A8B8G8R8_SNORM_PACK32); case GalTextureFormat.A2B10G10R10: return(GalImageFormat.A2B10G10R10_SNORM_PACK32); case GalTextureFormat.G8R8: return(GalImageFormat.R8G8_SNORM); case GalTextureFormat.R16: return(GalImageFormat.R16_SNORM); case GalTextureFormat.R8: return(GalImageFormat.R8_SNORM); case GalTextureFormat.BC4: return(GalImageFormat.BC4_SNORM_BLOCK); case GalTextureFormat.BC5: return(GalImageFormat.BC5_SNORM_BLOCK); } break; case GalTextureType.Unorm: switch (Format) { case GalTextureFormat.R16G16B16A16: return(GalImageFormat.R16G16B16A16_UNORM); case GalTextureFormat.A8B8G8R8: return(GalImageFormat.A8B8G8R8_UNORM_PACK32); case GalTextureFormat.A2B10G10R10: return(GalImageFormat.A2B10G10R10_UNORM_PACK32); case GalTextureFormat.A4B4G4R4: return(GalImageFormat.R4G4B4A4_UNORM_PACK16_REVERSED); case GalTextureFormat.A1B5G5R5: return(GalImageFormat.A1R5G5B5_UNORM_PACK16); case GalTextureFormat.B5G6R5: return(GalImageFormat.B5G6R5_UNORM_PACK16); case GalTextureFormat.BC7U: return(GalImageFormat.BC7_UNORM_BLOCK); case GalTextureFormat.G8R8: return(GalImageFormat.R8G8_UNORM); case GalTextureFormat.R16: return(GalImageFormat.R16_UNORM); case GalTextureFormat.R8: return(GalImageFormat.R8_UNORM); case GalTextureFormat.BC1: return(GalImageFormat.BC1_RGBA_UNORM_BLOCK); case GalTextureFormat.BC2: return(GalImageFormat.BC2_UNORM_BLOCK); case GalTextureFormat.BC3: return(GalImageFormat.BC3_UNORM_BLOCK); case GalTextureFormat.BC4: return(GalImageFormat.BC4_UNORM_BLOCK); case GalTextureFormat.BC5: return(GalImageFormat.BC5_UNORM_BLOCK); case GalTextureFormat.Z24S8: return(GalImageFormat.D24_UNORM_S8_UINT); case GalTextureFormat.Astc2D4x4: return(GalImageFormat.ASTC_4x4_UNORM_BLOCK); case GalTextureFormat.Astc2D5x5: return(GalImageFormat.ASTC_5x5_UNORM_BLOCK); case GalTextureFormat.Astc2D6x6: return(GalImageFormat.ASTC_6x6_UNORM_BLOCK); case GalTextureFormat.Astc2D8x8: return(GalImageFormat.ASTC_8x8_UNORM_BLOCK); case GalTextureFormat.Astc2D10x10: return(GalImageFormat.ASTC_10x10_UNORM_BLOCK); case GalTextureFormat.Astc2D12x12: return(GalImageFormat.ASTC_12x12_UNORM_BLOCK); case GalTextureFormat.Astc2D5x4: return(GalImageFormat.ASTC_5x4_UNORM_BLOCK); case GalTextureFormat.Astc2D6x5: return(GalImageFormat.ASTC_6x5_UNORM_BLOCK); case GalTextureFormat.Astc2D8x6: return(GalImageFormat.ASTC_8x6_UNORM_BLOCK); case GalTextureFormat.Astc2D10x8: return(GalImageFormat.ASTC_10x8_UNORM_BLOCK); case GalTextureFormat.Astc2D12x10: return(GalImageFormat.ASTC_12x10_UNORM_BLOCK); case GalTextureFormat.Astc2D8x5: return(GalImageFormat.ASTC_8x5_UNORM_BLOCK); case GalTextureFormat.Astc2D10x5: return(GalImageFormat.ASTC_10x5_UNORM_BLOCK); case GalTextureFormat.Astc2D10x6: return(GalImageFormat.ASTC_10x6_UNORM_BLOCK); } break; case GalTextureType.Sint: switch (Format) { case GalTextureFormat.R32G32B32A32: return(GalImageFormat.R32G32B32A32_SINT); case GalTextureFormat.R16G16B16A16: return(GalImageFormat.R16G16B16A16_SINT); case GalTextureFormat.A8B8G8R8: return(GalImageFormat.A8B8G8R8_SINT_PACK32); case GalTextureFormat.A2B10G10R10: return(GalImageFormat.A2B10G10R10_SINT_PACK32); case GalTextureFormat.R32: return(GalImageFormat.R32_SINT); case GalTextureFormat.G8R8: return(GalImageFormat.R8G8_SINT); case GalTextureFormat.R16: return(GalImageFormat.R16_SINT); case GalTextureFormat.R8: return(GalImageFormat.R8_SINT); } break; case GalTextureType.Uint: switch (Format) { case GalTextureFormat.R32G32B32A32: return(GalImageFormat.R32G32B32A32_UINT); case GalTextureFormat.R16G16B16A16: return(GalImageFormat.R16G16B16A16_UINT); case GalTextureFormat.A8B8G8R8: return(GalImageFormat.A8B8G8R8_UINT_PACK32); case GalTextureFormat.A2B10G10R10: return(GalImageFormat.A2B10G10R10_UINT_PACK32); case GalTextureFormat.R32: return(GalImageFormat.R32_UINT); case GalTextureFormat.G8R8: return(GalImageFormat.R8G8_UINT); case GalTextureFormat.R16: return(GalImageFormat.R16_UINT); case GalTextureFormat.R8: return(GalImageFormat.R8_UINT); } break; case GalTextureType.Snorm_Force_Fp16: //TODO break; case GalTextureType.Unorm_Force_Fp16: //TODO break; case GalTextureType.Float: switch (Format) { case GalTextureFormat.R32G32B32A32: return(GalImageFormat.R32G32B32A32_SFLOAT); case GalTextureFormat.R16G16B16A16: return(GalImageFormat.R16G16B16A16_SFLOAT); case GalTextureFormat.R32: return(GalImageFormat.R32_SFLOAT); case GalTextureFormat.BC6H_SF16: return(GalImageFormat.BC6H_SFLOAT_BLOCK); case GalTextureFormat.BC6H_UF16: return(GalImageFormat.BC6H_UFLOAT_BLOCK); case GalTextureFormat.R16: return(GalImageFormat.R16_SFLOAT); case GalTextureFormat.BF10GF11RF11: return(GalImageFormat.B10G11R11_UFLOAT_PACK32); case GalTextureFormat.ZF32: return(GalImageFormat.D32_SFLOAT); } break; } throw new NotImplementedException("0x" + Format.ToString("x2") + " " + Type.ToString()); }