Axiom.RenderSystems.DirectX9.D3DRenderSystem.CheckTextureFilteringSupported C# (CSharp) Метод

CheckTextureFilteringSupported() приватный метод

private CheckTextureFilteringSupported ( TextureType ttype, PixelFormat format, TextureUsage usage ) : bool
ttype TextureType
format PixelFormat
usage TextureUsage
Результат bool
        private bool CheckTextureFilteringSupported(TextureType ttype, PixelFormat format, TextureUsage usage)
        {
            // Gets D3D format
            var d3Dpf = D3DHelper.ConvertEnum(format);
            if (d3Dpf == Format.Unknown)
                return false;

            foreach (var currDevice in _deviceManager)
            {

                var currDevicePrimaryWindow = currDevice.PrimaryWindow;
                var pSurface = currDevicePrimaryWindow.RenderSurface;

                // Get surface desc
                var srfDesc = pSurface.Description;
            
                // Calculate usage
                
                var d3Dusage = Usage.QueryFilter;
                if ((usage & TextureUsage.RenderTarget) != 0)
                    d3Dusage |= Usage.RenderTarget;
                if ((usage & TextureUsage.Dynamic) != 0)
                    d3Dusage |= Usage.Dynamic;

                // Detect resource type
                ResourceType rtype;
                switch(ttype)
                {
                case TextureType.OneD:
                case TextureType.TwoD:
                    rtype = ResourceType.Texture;
                    break;
                case TextureType.ThreeD:
                    rtype = ResourceType.VolumeTexture;
                    break;
                case TextureType.CubeMap:
                    rtype = ResourceType.CubeTexture;
                    break;
                default:
                    return false;
                }


                var hr = _pD3D.CheckDeviceFormat(
                    currDevice.AdapterNumber,
                    currDevice.DeviceType,
                    srfDesc.Format,
                    d3Dusage,
                    rtype,
                    d3Dpf);

                if (!hr)
                    return false;
            }
        
            return true;    
        }
D3DRenderSystem