public SamplerDescription(float maxLod, float minLod, VkCompareOp compareOp, bool compareEnable, float mipLodBias, VkSamplerAddressMode addressModeW, VkSamplerAddressMode addressModeV, VkSamplerAddressMode addressModeU, VkSamplerMipmapMode mipmapMode, VkFilter minFilter, VkFilter magFilter, VkBorderColor borderColor, bool unNormalizedCoordinates) { MaxLod = maxLod; MinLod = minLod; CompareOp = compareOp; CompareEnable = compareEnable; MipLodBias = mipLodBias; AddressModeW = addressModeW; AddressModeV = addressModeV; AddressModeU = addressModeU; MipmapMode = mipmapMode; MinFilter = minFilter; MagFilter = magFilter; BorderColor = borderColor; UnNormalizedCoordinates = unNormalizedCoordinates; }
public Sampler(VkFilter filter, VkSamplerMipmapMode mipmapMode, VkSamplerAddressMode addressMode, uint mipLevels, bool anisotropyEnable, VkBorderColor borderColor = VkBorderColor.FloatOpaqueWhite) { // Create sampler var samplerCreateInfo = new VkSamplerCreateInfo { sType = VkStructureType.SamplerCreateInfo, magFilter = filter, minFilter = filter, mipmapMode = mipmapMode, addressModeU = addressMode, addressModeV = addressMode, addressModeW = addressMode, mipLodBias = 0.0f, compareOp = VkCompareOp.Never, minLod = 0.0f, maxLod = mipLevels, borderColor = borderColor, maxAnisotropy = anisotropyEnable ? Device.Properties.limits.maxSamplerAnisotropy : 1, anisotropyEnable = anisotropyEnable }; handle = Device.CreateSampler(ref samplerCreateInfo); }
public void CreateSampler(VkFilter minFilter = VkFilter.Linear, VkFilter magFilter = VkFilter.Linear, VkSamplerMipmapMode mipmapMode = VkSamplerMipmapMode.Linear, VkSamplerAddressMode addressMode = VkSamplerAddressMode.Repeat, float maxAnisotropy = 1.0f, float minLod = 0.0f, float maxLod = -1f) { VkSampler sampler; VkSamplerCreateInfo sampInfo = VkSamplerCreateInfo.New(); sampInfo.maxAnisotropy = maxAnisotropy; sampInfo.maxAnisotropy = 1.0f; // device->enabledFeatures.samplerAnisotropy ? device->properties.limits.maxSamplerAnisotropy : 1.0f; //samplerInfo.anisotropyEnable = device->enabledFeatures.samplerAnisotropy; sampInfo.addressModeU = addressMode; sampInfo.addressModeV = addressMode; sampInfo.addressModeW = addressMode; sampInfo.magFilter = magFilter; sampInfo.minFilter = minFilter; sampInfo.mipmapMode = mipmapMode; sampInfo.minLod = minLod; sampInfo.maxLod = maxLod < 0f ? info.mipLevels : maxLod; Utils.CheckResult(vkCreateSampler(Dev.VkDev, ref sampInfo, IntPtr.Zero, out sampler)); if (Descriptor.sampler.Handle != 0) { Dev.DestroySampler(Descriptor.sampler); } Descriptor.sampler = sampler; }
public void CreateSampler(VkSamplerAddressMode addressMode, VkFilter minFilter = VkFilter.Linear, VkFilter magFilter = VkFilter.Linear, VkSamplerMipmapMode mipmapMode = VkSamplerMipmapMode.Linear, float maxAnisotropy = 1.0f, float minLod = 0.0f, float maxLod = -1f) { CreateSampler(minFilter, magFilter, mipmapMode, addressMode, maxAnisotropy, minLod, maxLod); }