public void SetBufferData( long Key, int Width, int Height, GalTextureFormat Format, byte[] Buffer) { if (Fbs.TryGetValue(Key, out FrameBuffer Fb)) { GL.BindTexture(TextureTarget.Texture2D, Fb.TexHandle); const int Level = 0; const int Border = 0; const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba; (PixelFormat GlFormat, PixelType Type) = OGLEnumConverter.GetTextureFormat(Format); GL.TexImage2D( TextureTarget.Texture2D, Level, InternalFmt, Width, Height, Border, GlFormat, Type, Buffer); } }
public GalTexture(byte[] Data, int Width, int Height, GalTextureFormat Format) { this.Data = Data; this.Width = Width; this.Height = Height; this.Format = Format; }
private static int GetAstcBlockHeight(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.Astc2D4x4: return(4); case GalTextureFormat.Astc2D5x5: return(5); case GalTextureFormat.Astc2D6x6: return(6); case GalTextureFormat.Astc2D8x8: return(8); case GalTextureFormat.Astc2D10x10: return(10); case GalTextureFormat.Astc2D12x12: return(12); case GalTextureFormat.Astc2D5x4: return(4); case GalTextureFormat.Astc2D6x5: return(5); case GalTextureFormat.Astc2D8x6: return(6); case GalTextureFormat.Astc2D10x8: return(8); case GalTextureFormat.Astc2D12x10: return(10); case GalTextureFormat.Astc2D8x5: return(5); case GalTextureFormat.Astc2D10x5: return(5); case GalTextureFormat.Astc2D10x6: return(6); } throw new ArgumentException(nameof(Format)); }
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 byte[] GetTextureData(NvGpuVmm Vmm, long TicPosition) { int[] Tic = ReadWords(Vmm, TicPosition, 8); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); long TextureAddress = (uint)Tic[1]; TextureAddress |= (long)((ushort)Tic[2]) << 32; TextureSwizzle Swizzle = (TextureSwizzle)((Tic[2] >> 21) & 7); int Pitch = (Tic[3] & 0xffff) << 5; int BlockHeightLog2 = (Tic[3] >> 3) & 7; int BlockHeight = 1 << BlockHeightLog2; int Width = (Tic[4] & 0xffff) + 1; int Height = (Tic[5] & 0xffff) + 1; Texture Texture = new Texture( TextureAddress, Width, Height, Pitch, BlockHeight, Swizzle, Format); return(TextureReader.Read(Vmm, Texture)); }
public static GalImageFormat ConvertTexture( GalTextureFormat Format, GalTextureType RType, GalTextureType GType, GalTextureType BType, GalTextureType AType, bool ConvSrgb) { if (RType != GType || RType != BType || RType != AType) { throw new NotImplementedException("Per component types are not implemented!"); } if (!s_TextureTable.TryGetValue(Format, out GalImageFormat ImageFormat)) { throw new NotImplementedException($"Format 0x{((int)Format):x} not implemented!"); } GalImageFormat FormatType = ConvSrgb ? Srgb : GetFormatType(RType); GalImageFormat CombinedFormat = (ImageFormat & GalImageFormat.FormatMask) | FormatType; if (!ImageFormat.HasFlag(FormatType)) { throw new NotImplementedException($"Format \"{CombinedFormat}\" not implemented!"); } return(CombinedFormat); }
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"); } if (!s_TextureTable.TryGetValue(Format, out GalImageFormat ImageFormat)) { throw new NotImplementedException("Texture with format " + ((int)Format).ToString("x2") + " not implemented"); } GalTextureType Type = RType; GalImageFormat FormatType = GetFormatType(RType); if (ImageFormat.HasFlag(FormatType)) { return((ImageFormat & GalImageFormat.FormatMask) | FormatType); } else { throw new NotImplementedException("Texture with format " + Format + " and component type " + Type + " is not implemented"); } }
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 GalImageFormat ConvertTexture( GalTextureFormat format, GalTextureType rType, GalTextureType gType, GalTextureType bType, GalTextureType aType, bool convSrgb) { if (!TextureTable.TryGetValue(format, out GalImageFormat imageFormat)) { throw new NotImplementedException($"Format 0x{((int)format):x} not implemented!"); } if (!HasDepth(imageFormat) && (rType != gType || rType != bType || rType != aType)) { throw new NotImplementedException("Per component types are not implemented!"); } GalImageFormat formatType = convSrgb ? Srgb : GetFormatType(rType); GalImageFormat combinedFormat = (imageFormat & GalImageFormat.FormatMask) | formatType; if (!imageFormat.HasFlag(formatType)) { throw new NotImplementedException($"Format \"{combinedFormat}\" not implemented!"); } return(combinedFormat); }
private static GalImageFormat GetImageFormat(int[] Tic) { GalTextureType RType = (GalTextureType)((Tic[0] >> 7) & 7); GalTextureType GType = (GalTextureType)((Tic[0] >> 10) & 7); GalTextureType BType = (GalTextureType)((Tic[0] >> 13) & 7); GalTextureType AType = (GalTextureType)((Tic[0] >> 16) & 7); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); return(ImageUtils.ConvertTexture(Format, RType, GType, BType, AType)); }
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()); }
private static GalImageFormat GetImageFormat(int[] tic) { GalTextureType rType = (GalTextureType)((tic[0] >> 7) & 7); GalTextureType gType = (GalTextureType)((tic[0] >> 10) & 7); GalTextureType bType = (GalTextureType)((tic[0] >> 13) & 7); GalTextureType aType = (GalTextureType)((tic[0] >> 16) & 7); GalTextureFormat format = (GalTextureFormat)(tic[0] & 0x7f); bool convSrgb = ((tic[4] >> 22) & 1) != 0; return(ImageUtils.ConvertTexture(format, rType, gType, bType, aType, convSrgb)); }
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()); }
private static bool IsCompressedTextureFormat(GalTextureFormat Format) { switch (Format) { case GalTextureFormat.BC1: case GalTextureFormat.BC2: case GalTextureFormat.BC3: case GalTextureFormat.BC4: case GalTextureFormat.BC5: return(true); } return(false); }
public static GalTexture MakeTexture(NvGpu Gpu, NvGpuVmm Vmm, long TicPosition) { int[] Tic = ReadWords(Vmm, TicPosition, 8); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7); GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7); GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7); GalTextureSource WSource = (GalTextureSource)((Tic[0] >> 28) & 7); long TextureAddress = (uint)Tic[1]; TextureAddress |= (long)((ushort)Tic[2]) << 32; TextureSwizzle Swizzle = (TextureSwizzle)((Tic[2] >> 21) & 7); int Pitch = (Tic[3] & 0xffff) << 5; int BlockHeightLog2 = (Tic[3] >> 3) & 7; int BlockHeight = 1 << BlockHeightLog2; int Width = (Tic[4] & 0xffff) + 1; int Height = (Tic[5] & 0xffff) + 1; Texture Texture = new Texture( TextureAddress, Width, Height, Pitch, BlockHeight, Swizzle, Format); byte[] Data = TextureReader.Read(Vmm, Texture); return(new GalTexture( Data, Width, Height, Format, XSource, YSource, ZSource, WSource)); }
public Texture( long Position, int Width, int Height) { this.Position = Position; this.Width = Width; this.Height = Height; Pitch = 0; BlockHeight = 16; Swizzle = TextureSwizzle.BlockLinear; Format = GalTextureFormat.A8B8G8R8; }
public static byte[] GetTextureData(NvGpuVmm Vmm, long TicPosition) { int[] Tic = ReadWords(Vmm, TicPosition, 8); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); long TextureAddress = (uint)Tic[1]; TextureAddress |= (long)((ushort)Tic[2]) << 32; TextureSwizzle Swizzle = (TextureSwizzle)((Tic[2] >> 21) & 7); if (Swizzle == TextureSwizzle.BlockLinear || Swizzle == TextureSwizzle.BlockLinearColorKey) { TextureAddress &= ~0x1ffL; } else if (Swizzle == TextureSwizzle.Pitch || Swizzle == TextureSwizzle.PitchColorKey) { TextureAddress &= ~0x1fL; } int Pitch = (Tic[3] & 0xffff) << 5; int BlockHeightLog2 = (Tic[3] >> 3) & 7; int TileWidthLog2 = (Tic[3] >> 10) & 7; int BlockHeight = 1 << BlockHeightLog2; int TileWidth = 1 << TileWidthLog2; int Width = (Tic[4] & 0xffff) + 1; int Height = (Tic[5] & 0xffff) + 1; TextureInfo Texture = new TextureInfo( TextureAddress, Width, Height, Pitch, BlockHeight, TileWidth, Swizzle, Format); return(TextureReader.Read(Vmm, Texture)); }
public Texture( long Position, int Width, int Height, int Pitch, int BlockHeight, TextureSwizzle Swizzle, GalTextureFormat Format) { this.Position = Position; this.Width = Width; this.Height = Height; this.Pitch = Pitch; this.BlockHeight = BlockHeight; this.Swizzle = Swizzle; this.Format = Format; }
public GalTexture( int Width, int Height, GalTextureFormat Format, GalTextureSource XSource, GalTextureSource YSource, GalTextureSource ZSource, GalTextureSource WSource) { this.Width = Width; this.Height = Height; this.Format = Format; this.XSource = XSource; this.YSource = YSource; this.ZSource = ZSource; this.WSource = WSource; }
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 GalTexture MakeTexture(NvGpuVmm Vmm, long TicPosition) { int[] Tic = ReadWords(Vmm, TicPosition, 8); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7); GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7); GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7); GalTextureSource WSource = (GalTextureSource)((Tic[0] >> 28) & 7); int Width = (Tic[4] & 0xffff) + 1; int Height = (Tic[5] & 0xffff) + 1; return(new GalTexture( Width, Height, Format, XSource, YSource, ZSource, WSource)); }
public static GalTexture MakeTexture(NsGpu Gpu, AMemory Memory, long TicPosition) { int[] Tic = ReadWords(Memory, TicPosition, 8); GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); long TextureAddress = (uint)Tic[1]; TextureAddress |= (long)((ushort)Tic[2]) << 32; TextureAddress = Gpu.GetCpuAddr(TextureAddress); TextureSwizzle Swizzle = (TextureSwizzle)((Tic[2] >> 21) & 7); int Pitch = (Tic[3] & 0xffff) << 5; int BlockHeightLog2 = (Tic[3] >> 3) & 7; int BlockHeight = 1 << BlockHeightLog2; int Width = (Tic[4] & 0xffff) + 1; int Height = (Tic[5] & 0xffff) + 1; Texture Texture = new Texture( TextureAddress, Width, Height, Pitch, BlockHeight, Swizzle, Format); byte[] Data = TextureReader.Read(Memory, Texture); return(new GalTexture(Data, Width, Height, Format)); }
private void TextureCopy(NvGpuVmm Vmm, NvGpuPBEntry PBEntry) { CopyOperation Operation = (CopyOperation)ReadRegister(NvGpuEngine2dReg.CopyOperation); bool SrcLinear = ReadRegister(NvGpuEngine2dReg.SrcLinear) != 0; int SrcWidth = ReadRegister(NvGpuEngine2dReg.SrcWidth); int SrcHeight = ReadRegister(NvGpuEngine2dReg.SrcHeight); int SrcPitch = ReadRegister(NvGpuEngine2dReg.SrcPitch); int SrcBlkDim = ReadRegister(NvGpuEngine2dReg.SrcBlockDimensions); bool DstLinear = ReadRegister(NvGpuEngine2dReg.DstLinear) != 0; int DstWidth = ReadRegister(NvGpuEngine2dReg.DstWidth); int DstHeight = ReadRegister(NvGpuEngine2dReg.DstHeight); int DstPitch = ReadRegister(NvGpuEngine2dReg.DstPitch); int DstBlkDim = ReadRegister(NvGpuEngine2dReg.DstBlockDimensions); TextureSwizzle SrcSwizzle = SrcLinear ? TextureSwizzle.Pitch : TextureSwizzle.BlockLinear; TextureSwizzle DstSwizzle = DstLinear ? TextureSwizzle.Pitch : TextureSwizzle.BlockLinear; int SrcBlockHeight = 1 << ((SrcBlkDim >> 4) & 0xf); int DstBlockHeight = 1 << ((DstBlkDim >> 4) & 0xf); long SrcAddress = MakeInt64From2xInt32(NvGpuEngine2dReg.SrcAddress); long DstAddress = MakeInt64From2xInt32(NvGpuEngine2dReg.DstAddress); long SrcKey = Vmm.GetPhysicalAddress(SrcAddress); long DstKey = Vmm.GetPhysicalAddress(DstAddress); bool IsSrcFb = Gpu.Engine3d.IsFrameBufferPosition(SrcKey); bool IsDstFb = Gpu.Engine3d.IsFrameBufferPosition(DstKey); TextureInfo SrcTexture() { return(new TextureInfo( SrcAddress, SrcWidth, SrcHeight, SrcPitch, SrcBlockHeight, 1, SrcSwizzle, GalTextureFormat.A8B8G8R8)); } TextureInfo DstTexture() { return(new TextureInfo( DstAddress, DstWidth, DstHeight, DstPitch, DstBlockHeight, 1, DstSwizzle, GalTextureFormat.A8B8G8R8)); } //TODO: fb -> fb copies, tex -> fb copies, formats other than RGBA8, //make it throw for unimpl stuff (like the copy mode)... if (IsSrcFb && IsDstFb) { //Frame Buffer -> Frame Buffer copy. Gpu.Renderer.FrameBuffer.Copy( SrcKey, DstKey, 0, 0, SrcWidth, SrcHeight, 0, 0, DstWidth, DstHeight); } if (IsSrcFb) { //Frame Buffer -> Texture copy. Gpu.Renderer.FrameBuffer.GetBufferData(SrcKey, (byte[] Buffer) => { TextureInfo Src = SrcTexture(); TextureInfo Dst = DstTexture(); if (Src.Width != Dst.Width || Src.Height != Dst.Height) { throw new NotImplementedException("Texture resizing is not supported"); } TextureWriter.Write(Vmm, Dst, Buffer); }); } else if (IsDstFb) { //Texture -> Frame Buffer copy. const GalTextureFormat Format = GalTextureFormat.A8B8G8R8; byte[] Buffer = TextureReader.Read(Vmm, SrcTexture()); Gpu.Renderer.FrameBuffer.SetBufferData( DstKey, DstWidth, DstHeight, Format, Buffer); } else { //Texture -> Texture copy. TextureInfo Src = SrcTexture(); TextureInfo Dst = DstTexture(); if (Src.Width != Dst.Width || Src.Height != Dst.Height) { throw new NotImplementedException("Texture resizing is not supported"); } TextureWriter.Write(Vmm, Dst, TextureReader.Read(Vmm, Src)); } }
private static bool IsCompressedTextureFormat(GalTextureFormat Format) { return(Format == GalTextureFormat.BC1 || Format == GalTextureFormat.BC2 || Format == GalTextureFormat.BC3); }
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()); }