internal static uint GetMaxTextureCubeDimensions(MTLFeatureSet fs) { switch (fs) { case MTLFeatureSet.iOS_GPUFamily1_v1: case MTLFeatureSet.iOS_GPUFamily2_v1: return(4096); case MTLFeatureSet.iOS_GPUFamily1_v2: case MTLFeatureSet.iOS_GPUFamily2_v2: case MTLFeatureSet.iOS_GPUFamily1_v3: case MTLFeatureSet.iOS_GPUFamily2_v3: case MTLFeatureSet.iOS_GPUFamily1_v4: case MTLFeatureSet.iOS_GPUFamily2_v4: case MTLFeatureSet.tvOS_GPUFamily1_v1: case MTLFeatureSet.tvOS_GPUFamily1_v2: case MTLFeatureSet.tvOS_GPUFamily1_v3: return(8192); case MTLFeatureSet.iOS_GPUFamily3_v1: case MTLFeatureSet.iOS_GPUFamily3_v2: case MTLFeatureSet.iOS_GPUFamily3_v3: case MTLFeatureSet.iOS_GPUFamily4_v1: case MTLFeatureSet.tvOS_GPUFamily2_v1: case MTLFeatureSet.macOS_GPUFamily1_v1: case MTLFeatureSet.macOS_GPUFamily1_v2: case MTLFeatureSet.macOS_GPUFamily1_v3: return(16384); default: return(4096); } }
public MTLFeatureSupport(MTLDevice device) { foreach (MTLFeatureSet set in Enum.GetValues(typeof(MTLFeatureSet))) { if (device.supportsFeatureSet(set)) { _supportedFeatureSets.Add(set); MaxFeatureSet = set; } } IsMacOS = IsSupported(MTLFeatureSet.macOS_GPUFamily1_v1) || IsSupported(MTLFeatureSet.macOS_GPUFamily1_v2) || IsSupported(MTLFeatureSet.macOS_GPUFamily1_v3); }
internal static uint GetMaxTextureVolume(MTLFeatureSet fs) { return(2048); }
private protected override bool GetPixelFormatSupportCore( PixelFormat format, TextureType type, TextureUsage usage, out PixelFormatProperties properties) { if (!MTLFormats.IsFormatSupported(format, usage, MetalFeatures)) { properties = default(PixelFormatProperties); return(false); } uint sampleCounts = 0; for (int i = 0; i < _supportedSampleCounts.Length; i++) { if (_supportedSampleCounts[i]) { sampleCounts |= (uint)(1 << i); } } MTLFeatureSet maxFeatureSet = MetalFeatures.MaxFeatureSet; uint maxArrayLayer = MTLFormats.GetMaxTextureVolume(maxFeatureSet); uint maxWidth; uint maxHeight; uint maxDepth; if (type == TextureType.Texture1D) { maxWidth = MTLFormats.GetMaxTexture1DWidth(maxFeatureSet); maxHeight = 1; maxDepth = 1; } else if (type == TextureType.Texture2D) { uint maxDimensions; if ((usage & TextureUsage.Cubemap) != 0) { maxDimensions = MTLFormats.GetMaxTextureCubeDimensions(maxFeatureSet); } else { maxDimensions = MTLFormats.GetMaxTexture2DDimensions(maxFeatureSet); } maxWidth = maxDimensions; maxHeight = maxDimensions; maxDepth = 1; } else if (type == TextureType.Texture3D) { maxWidth = maxArrayLayer; maxHeight = maxArrayLayer; maxDepth = maxArrayLayer; maxArrayLayer = 1; } else { throw Illegal.Value <TextureType>(); } properties = new PixelFormatProperties( maxWidth, maxHeight, maxDepth, uint.MaxValue, maxArrayLayer, sampleCounts); return(true); }
public bool IsSupported(MTLFeatureSet featureSet) => _supportedFeatureSets.Contains(featureSet);