Esempio n. 1
0
 public static void Init([NativeTypeName("D3D12_DESCRIPTOR_RANGE1 &")] out D3D12_DESCRIPTOR_RANGE1 range, D3D12_DESCRIPTOR_RANGE_TYPE rangeType, uint numDescriptors, uint baseShaderRegister, uint registerSpace = 0, D3D12_DESCRIPTOR_RANGE_FLAGS flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE, uint offsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
 {
     range.RangeType          = rangeType;
     range.NumDescriptors     = numDescriptors;
     range.BaseShaderRegister = baseShaderRegister;
     range.RegisterSpace      = registerSpace;
     range.Flags = flags;
     range.OffsetInDescriptorsFromTableStart = offsetInDescriptorsFromTableStart;
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new descriptor table root parameter
        /// </summary>
        /// <param name="ranges">The <see cref="DescriptorRangeParameter"/>s to bind</param>
        /// <param name="visibility">Indicates which shaders have access to this parameter</param>
        /// <returns>A new <see cref="RootParameter"/> representing a descriptor table</returns>
        public static RootParameter CreateDescriptorTable(DescriptorRangeParameter[] ranges, ShaderVisibility visibility = ShaderVisibility.All)
        {
            // do NOT make this a not pinned array. RootSignature.TranslateRootParameters relies on it
            var d3d12Ranges = GC.AllocateArray <D3D12_DESCRIPTOR_RANGE1>(ranges.Length, pinned: true);

            for (var i = 0; i < ranges.Length; i++)
            {
                var range = ranges[i];
                d3d12Ranges[i] = new D3D12_DESCRIPTOR_RANGE1(
                    (D3D12_DESCRIPTOR_RANGE_TYPE)range.Type,
                    range.DescriptorCount,
                    range.BaseShaderRegister,
                    range.RegisterSpace,
                    D3D12_DESCRIPTOR_RANGE_FLAGS.D3D12_DESCRIPTOR_RANGE_FLAG_NONE,
                    range.DescriptorOffset
                    );
            }

            return(new RootParameter(d3d12Ranges, visibility));
        }