Beispiel #1
0
        /// <summary>
        /// Creates a new <see cref="Sampler"/>
        /// </summary>
        public unsafe Sampler(
            TextureAddressMode texU,
            TextureAddressMode texW,
            TextureAddressMode texV,
            SamplerFilterType filter,
            float mipLODBias   = 0,
            uint maxAnisotropy = 16,
            SampleComparisonFunc comparisonFunc = SampleComparisonFunc.LessThan,
            Rgba128 borderColor = default,
            float minLOD        = 0,
            float maxLOD        = float.MaxValue
            )
        {
            Debug.Assert(maxAnisotropy <= 16);

            Desc = new D3D12_SAMPLER_DESC
            {
                AddressU       = (D3D12_TEXTURE_ADDRESS_MODE)texU,
                AddressW       = (D3D12_TEXTURE_ADDRESS_MODE)texW,
                AddressV       = (D3D12_TEXTURE_ADDRESS_MODE)texV,
                Filter         = (D3D12_FILTER)filter,
                MipLODBias     = mipLODBias,
                MaxAnisotropy  = maxAnisotropy,
                ComparisonFunc = (D3D12_COMPARISON_FUNC)comparisonFunc,
                MinLOD         = minLOD,
                MaxLOD         = maxLOD,
            };
            Unsafe.As <float, Rgba128>(ref Desc.BorderColor[0]) = borderColor;
        }
Beispiel #2
0
        public virtual void CreateSampler(
            ref D3D12_SAMPLER_DESC pDesc,
            D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor
            )
        {
            var fp = GetFunctionPointer(22);

            if (m_CreateSamplerFunc == null)
            {
                m_CreateSamplerFunc = (CreateSamplerFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateSamplerFunc));
            }

            m_CreateSamplerFunc(m_ptr, ref pDesc, DestDescriptor);
        }