Пример #1
0
        private EPVRTColourSpace RetrieveNativeColorSpace(SiliconStudio.Paradox.Graphics.PixelFormat format)
        {
            switch (format)
            {
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb:
                return(EPVRTColourSpace.ePVRTCSpaceSRgb);

            default:
                return(EPVRTColourSpace.ePVRTCSpacelRGB);
            }
        }
Пример #2
0
        private EPVRTVariableType RetrieveNativePixelType(SiliconStudio.Paradox.Graphics.PixelFormat format)
        {
            switch (format)
            {
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_Float:
                return(EPVRTVariableType.ePVRTVarTypeFloat);

            //case Paradox.Framework.Graphics.PixelFormat.R16G16B16A16_Float:

            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_UInt:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedInteger);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_SInt:
                return(EPVRTVariableType.ePVRTVarTypeSignedInteger);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedShortNorm);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UInt:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedShort);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SNorm:
                return(EPVRTVariableType.ePVRTVarTypeSignedShortNorm);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SInt:
                return(EPVRTVariableType.ePVRTVarTypeSignedShort);


            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UInt:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedByte);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SNorm:
                return(EPVRTVariableType.ePVRTVarTypeSignedByteNorm);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SInt:
                return(EPVRTVariableType.ePVRTVarTypeSignedByte);

            default:
                return(EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm);
            }
        }
Пример #3
0
        /// <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.Paradox.Graphics.PixelFormat format)
        {
            switch (format)
            {
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_Float:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.B8G8R8A8_UNorm_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.B8G8R8A8_UNorm:

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGB:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGBA:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGB:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGBA:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_II_2bpp:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_II_4bpp:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGB_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGBA_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGB_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGBA_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC1:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGB:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGB_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGBA:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGBA_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGB_A1:
            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_R11_Unsigned:
            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_R11_Signed:
            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_RG11_Unsigned:
            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_RG11_Signed:
                return(true);

            default:
                return(false);
            }
        }
Пример #4
0
        private SiliconStudio.Paradox.Graphics.PixelFormat RetrieveFormatFromNativeData(PVRTextureHeader header)
        {
            SiliconStudio.Paradox.Graphics.PixelFormat format = header.GetFormat();
            if (format == SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float)
            {
                switch (header.GetChannelType())
                {
                case EPVRTVariableType.ePVRTVarTypeFloat:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float);

                case EPVRTVariableType.ePVRTVarTypeUnsignedInteger:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_UInt);

                case EPVRTVariableType.ePVRTVarTypeSignedInteger:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_SInt);
                }
            }
            else if (format == SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm)
            {
                switch (header.GetChannelType())
                {
                case EPVRTVariableType.ePVRTVarTypeUnsignedShortNorm:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm);

                case EPVRTVariableType.ePVRTVarTypeUnsignedShort:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UInt);

                case EPVRTVariableType.ePVRTVarTypeSignedShortNorm:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SNorm);

                case EPVRTVariableType.ePVRTVarTypeSignedShort:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SInt);
                }
            }
            else if (format == SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm)
            {
                switch (header.GetChannelType())
                {
                case EPVRTVariableType.ePVRTVarTypeUnsignedByteNorm:
                {
                    if (header.GetColourSpace() == EPVRTColourSpace.ePVRTCSpacelRGB)
                    {
                        return(SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm);
                    }
                    else
                    {
                        return(SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb);
                    }
                }

                case EPVRTVariableType.ePVRTVarTypeUnsignedByte:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UInt);

                case EPVRTVariableType.ePVRTVarTypeSignedByteNorm:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SNorm);

                case EPVRTVariableType.ePVRTVarTypeSignedByte:
                    return(SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SInt);
                }
            }

            return(format);
        }
Пример #5
0
        /// <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.Paradox.Graphics.PixelFormat format)
        {
            switch (format)
            {
            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGB:
                return(0);

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_2bpp_RGBA:
                return(1);

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGB:
                return(2);

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_4bpp_RGBA:
                return(3);

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_II_2bpp:
                return(4);

            case SiliconStudio.Paradox.Graphics.PixelFormat.PVRTC_II_4bpp:
                return(5);

            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC1:
                return(6);

            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGB:
                return(22);

            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGBA:
                return(23);

            case SiliconStudio.Paradox.Graphics.PixelFormat.ETC2_RGB_A1:
                return(24);

            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_R11_Unsigned:
                return(25);

            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_R11_Signed:
                return(26);

            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_RG11_Unsigned:
                return(27);

            case SiliconStudio.Paradox.Graphics.PixelFormat.EAC_RG11_Signed:
                return(28);

            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_Float:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_Float:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32A32_SInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R32G32B32_SInt:
                return(Utilities.ConvertPixelType(PixelType.Standard32PixelType));

            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R16G16B16A16_SInt:
                return(Utilities.ConvertPixelType(PixelType.Standard16PixelType));

            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm_SRgb:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UNorm:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_UInt:
            case SiliconStudio.Paradox.Graphics.PixelFormat.R8G8B8A8_SNorm:
            case SiliconStudio.Paradox.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.");
            }
        }
Пример #6
0
 /// <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>
 private bool SupportFormat(SiliconStudio.Paradox.Graphics.PixelFormat format)
 {
     return((int)(format) >= 1 && (int)(format) <= 115);
 }
Пример #7
0
 /// <summary>
 /// Retrieves the native format from <see cref="SiliconStudio.Paradox.Graphics.PixelFormat"/>.
 /// </summary>
 /// <param name="format">The format.</param>
 /// <returns>The corresponding <see cref="DXGI_FORMAT"/></returns>
 private DXGI_FORMAT RetrieveNativeFormat(SiliconStudio.Paradox.Graphics.PixelFormat format)
 {
     return((DXGI_FORMAT)format);
 }
Пример #8
0
 private EPVRTColourSpace RetrieveNativeColorSpace(SiliconStudio.Paradox.Graphics.PixelFormat format)
 {
     return(format.IsSRgb() ? EPVRTColourSpace.ePVRTCSpaceSRgb : EPVRTColourSpace.ePVRTCSpacelRGB);
 }