示例#1
0
        public ulong GetRequiredIntermediateSize(int firstSubresource, int numSubresources)
        {
            ResourceDescription desc = GetDescription();

            using (ID3D12Device device = GetDevice <ID3D12Device>())
            {
                device.GetCopyableFootprints(desc, firstSubresource, numSubresources, 0, null, null, null, out ulong requiredSize);
                return(requiredSize);
            }
        }
示例#2
0
        public static Result D3D12CreateDevice(IUnknown adapter, FeatureLevel minFeatureLevel, out ID3D12Device device)
        {
            var result = D3D12CreateDevice(adapter, minFeatureLevel, typeof(ID3D12Device).GUID, out var nativePtr);

            if (result.Failure)
            {
                device = null;
                return(result);
            }

            device = new ID3D12Device(nativePtr);
            return(result);
        }
示例#3
0
        /// <summary>
        /// Gets the highest supported hardware feature level of the primary adapter.
        /// </summary>
        /// <param name="adapter">The <see cref="IDXGIAdapter"/>.</param>
        /// <param name="minFeatureLevel">Thje</param>
        /// <returns>The highest supported hardware feature level.</returns>
        public static FeatureLevel GetMaxSupportedFeatureLevel(IDXGIAdapter adapter, FeatureLevel minFeatureLevel = FeatureLevel.Level_11_0)
        {
            ID3D12Device device = null;

            try
            {
                D3D12CreateDevice(adapter, minFeatureLevel, out device);
                return(device.CheckMaxSupportedFeatureLevel(FeatureLevels));
            }
            catch
            {
                return(FeatureLevel.Level_9_1);
            }
            finally
            {
                device?.Dispose();
            }
        }
 public int Subresources(ID3D12Device pDevice)
 {
     return(MipLevels * ArraySize * GetPlaneCount(pDevice));
 }
 public byte GetPlaneCount(ID3D12Device device)
 {
     return(device.GetFormatPlaneCount(Format));
 }
示例#6
0
 public static Result D3D12CreateDevice(IDXGIAdapter adapter, out ID3D12Device device)
 {
     return(D3D12CreateDevice(adapter, FeatureLevel.Level_11_0, out device));
 }