示例#1
0
        public override Media.PixelFormat GetNativeFormat(Graphics.TextureType ttype, Media.PixelFormat format, Graphics.TextureUsage usage)
        {
            var caps = Root.Instance.RenderSystem.Capabilities;

            //Check compressed texture support
            //if a compressed formt not supported, rever to PixelFormat.A8R8G8B8
            if (PixelUtil.IsCompressed(format) && !caps.HasCapability(Graphics.Capabilities.TextureCompressionDXT) && !caps.HasCapability(Graphics.Capabilities.TextureCompressionPVRTC))
            {
                return(PixelFormat.A8R8G8B8);
            }
            //if floating point texture not supported, rever to PixelFormat.A8R8G8B8
            if (PixelUtil.IsFloatingPoint(format) && !caps.HasCapability(Graphics.Capabilities.TextureFloat))
            {
                return(PixelFormat.A8R8G8B8);
            }

            //Check if this is a valid rendertarget format
            if ((usage & Graphics.TextureUsage.RenderTarget) == Graphics.TextureUsage.RenderTarget)
            {
                //Get closest supported alternative
                //if format is supported it's returned
                return(GLES2RTTManager.Instance.GetSupportedAlternative(format));
            }

            //Supported
            return(format);
        }
示例#2
0
        public override bool IsHardwareFilteringSupported(Graphics.TextureType ttype, Media.PixelFormat format, Graphics.TextureUsage usage, bool preciseFormatOnly)
        {
            if (format == PixelFormat.Unknown)
            {
                return(false);
            }

            //Check native format
            PixelFormat nativeFormat = this.GetNativeFormat(ttype, format, usage);

            if (preciseFormatOnly && format != nativeFormat)
            {
                return(false);
            }

            //Assume non-floaitng point is supported always
            if (!PixelUtil.IsFloatingPoint(nativeFormat))
            {
                return(true);
            }

            return(false);
        }