예제 #1
0
        void CreateSampler(SamplerCreateInfo mInfo)
        {
            var info = new VkSamplerCreateInfo();

            info.sType                   = VkStructureType.SamplerCreateInfo;
            info.magFilter               = mInfo.magFilter;
            info.minFilter               = mInfo.minFilter;
            info.mipmapMode              = mInfo.mipmapMode;
            info.addressModeU            = mInfo.addressModeU;
            info.addressModeV            = mInfo.addressModeV;
            info.addressModeW            = mInfo.addressModeW;
            info.mipLodBias              = mInfo.mipLodBias;
            info.anisotropyEnable        = mInfo.anisotropyEnable ? 1u : 0u;
            info.maxAnisotropy           = mInfo.maxAnisotropy;
            info.compareEnable           = mInfo.compareEnable ? 1u : 0u;
            info.compareOp               = mInfo.compareOp;
            info.minLod                  = mInfo.minLod;
            info.maxLod                  = mInfo.maxLod;
            info.borderColor             = mInfo.borderColor;
            info.unnormalizedCoordinates = mInfo.unnormalizedCoordinates ? 1u : 0u;

            var result = Device.Commands.createSampler(Device.Native, ref info, Device.Instance.AllocationCallbacks, out sampler);

            if (result != VkResult.Success)
            {
                throw new SamplerException(string.Format("Error creating sampler: {0}", result));
            }
        }
예제 #2
0
        public Sampler(Device device, SamplerCreateInfo info)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            Device = device;

            CreateSampler(info);
        }