/// <summary> /// Determines whether this requested format is supported. /// </summary> /// <param name="format">The format.</param> /// <returns> /// <c>true</c> if the formats is supported; otherwise, <c>false</c>. /// </returns> public bool SupportFormat(SiliconStudio.Xenko.Graphics.PixelFormat format) { switch (format) { case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.B8G8R8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGBA_Explicit: case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGBA_Interpolated: return(true); default: return(false); } }
private EPVRTVariableType RetrieveNativePixelType(SiliconStudio.Xenko.Graphics.PixelFormat format) { switch (format) { case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_Float: return(EPVRTVariableType.ePVRTVarTypeFloat); //case Xenko.Framework.Graphics.PixelFormat.R16G16B16A16_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_UInt: return(EPVRTVariableType.ePVRTVarTypeUnsignedInteger); case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_SInt: return(EPVRTVariableType.ePVRTVarTypeSignedInteger); case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UNorm: return(EPVRTVariableType.ePVRTVarTypeUnsignedShortNorm); case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UInt: return(EPVRTVariableType.ePVRTVarTypeUnsignedShort); case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SNorm: return(EPVRTVariableType.ePVRTVarTypeSignedShortNorm); case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SInt: return(EPVRTVariableType.ePVRTVarTypeSignedShort); case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm: return(EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm); case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UInt: return(EPVRTVariableType.ePVRTVarTypeUnsignedByte); case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SNorm: return(EPVRTVariableType.ePVRTVarTypeSignedByteNorm); case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SInt: return(EPVRTVariableType.ePVRTVarTypeSignedByte); default: return(EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm); } }
/// <summary> /// Determines whether the specified compression format is supported by this library /// </summary> /// <param name="format">The format.</param> /// <returns> /// <c>true</c> if the formats is supported by this library; otherwise, <c>false</c>. /// </returns> private bool SupportFormat(SiliconStudio.Xenko.Graphics.PixelFormat format) { switch (format) { case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.B8G8R8A8_UNorm_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.B8G8R8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_II_2bpp: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_II_4bpp: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGB_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGBA_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGB_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGBA_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC1: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGBA_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB_A1: case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_R11_Unsigned: case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_R11_Signed: case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_RG11_Unsigned: case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_RG11_Signed: return(true); default: return(false); } }
/// <summary> /// Retrieves the native format from <see cref="SiliconStudio.Xenko.Graphics.PixelFormat"/>. /// </summary> /// <param name="format">The format.</param> /// <returns>the corresponding <see cref="Format"/> format</returns> private Format RetrieveNativeFormat(SiliconStudio.Xenko.Graphics.PixelFormat format) { switch (format) { case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.B8G8R8A8_UNorm: return(Format.ATI_TC_FORMAT_ARGB_8888); case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGB: return(Format.ATI_TC_FORMAT_ATC_RGB); case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGBA_Explicit: return(Format.ATI_TC_FORMAT_ATC_RGBA_Explicit); case SiliconStudio.Xenko.Graphics.PixelFormat.ATC_RGBA_Interpolated: return(Format.ATI_TC_FORMAT_ATC_RGBA_Interpolated); default: throw new TextureToolsException("UnHandled compression format by ATI texture."); } }
/// <summary> /// Retrieves the native format from <see cref="SiliconStudio.Xenko.Graphics.PixelFormat"/>. /// </summary> /// <param name="format">The format.</param> /// <returns>The corresponding <see cref="DXGI_FORMAT"/></returns> private DXGI_FORMAT RetrieveNativeFormat(SiliconStudio.Xenko.Graphics.PixelFormat format) { return((DXGI_FORMAT)format); }
private SiliconStudio.Xenko.Graphics.PixelFormat RetrieveFormatFromNativeData(PVRTextureHeader header) { SiliconStudio.Xenko.Graphics.PixelFormat format = header.GetFormat(); if (format == SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_Float) { switch (header.GetChannelType()) { case EPVRTVariableType.ePVRTVarTypeFloat: return(SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_Float); case EPVRTVariableType.ePVRTVarTypeUnsignedInteger: return(SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_UInt); case EPVRTVariableType.ePVRTVarTypeSignedInteger: return(SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_SInt); } } else if (format == SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UNorm) { switch (header.GetChannelType()) { case EPVRTVariableType.ePVRTVarTypeUnsignedShortNorm: return(SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UNorm); case EPVRTVariableType.ePVRTVarTypeUnsignedShort: return(SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UInt); case EPVRTVariableType.ePVRTVarTypeSignedShortNorm: return(SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SNorm); case EPVRTVariableType.ePVRTVarTypeSignedShort: return(SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SInt); } } else if (format == SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm) { switch (header.GetChannelType()) { case EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm: { if (header.GetColourSpace() == EPVRTColourSpace.ePVRTCSpacelRGB) { return(SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm); } else { return(SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb); } } case EPVRTVariableType.ePVRTVarTypeUnsignedByte: return(SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UInt); case EPVRTVariableType.ePVRTVarTypeSignedByteNorm: return(SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SNorm); case EPVRTVariableType.ePVRTVarTypeSignedByte: return(SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SInt); } } return(format); }
/// <summary> /// Retrieves the native format from the PixelFormat. /// </summary> /// <param name="format">The format.</param> /// <returns></returns> /// <exception cref="TexLibraryException">UnHandled compression format by PowerVC Texture Tool.</exception> private UInt64 RetrieveNativeFormat(SiliconStudio.Xenko.Graphics.PixelFormat format) { switch (format) { case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGB_SRgb: return(0); case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_2bpp_RGBA_SRgb: return(1); case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGB_SRgb: return(2); case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_4bpp_RGBA_SRgb: return(3); case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_II_2bpp: return(4); case SiliconStudio.Xenko.Graphics.PixelFormat.PVRTC_II_4bpp: return(5); case SiliconStudio.Xenko.Graphics.PixelFormat.ETC1: return(6); case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB_SRgb: return(22); case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGBA: case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGBA_SRgb: return(23); case SiliconStudio.Xenko.Graphics.PixelFormat.ETC2_RGB_A1: return(24); case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_R11_Unsigned: return(25); case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_R11_Signed: return(26); case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_RG11_Unsigned: return(27); case SiliconStudio.Xenko.Graphics.PixelFormat.EAC_RG11_Signed: return(28); case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_Float: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32A32_SInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R32G32B32_SInt: return(Utilities.ConvertPixelType(PixelType.Standard32PixelType)); case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R16G16B16A16_SInt: return(Utilities.ConvertPixelType(PixelType.Standard16PixelType)); case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_UInt: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SNorm: case SiliconStudio.Xenko.Graphics.PixelFormat.R8G8B8A8_SInt: return(Utilities.ConvertPixelType(PixelType.Standard8PixelType)); default: Log.Error("UnHandled compression format by PowerVC Texture Tool."); throw new TextureToolsException("UnHandled compression format by PowerVC Texture Tool."); } }
private EPVRTColourSpace RetrieveNativeColorSpace(SiliconStudio.Xenko.Graphics.PixelFormat format) { return(format.IsSRgb() ? EPVRTColourSpace.ePVRTCSpaceSRgb : EPVRTColourSpace.ePVRTCSpacelRGB); }