1 module sbylib.wrapper.vulkan.sampler; 2 3 import std; 4 import erupted; 5 import sbylib.wrapper.vulkan.device; 6 import sbylib.wrapper.vulkan.enums; 7 import sbylib.wrapper.vulkan.util; 8 9 class Sampler { 10 static struct CreateInfo { 11 12 @vkProp() { 13 VkSamplerCreateFlags flags; 14 SamplerFilter magFilter; 15 SamplerFilter minFilter; 16 SamplerMipmapMode mipmapMode; 17 SamplerAddressMode addressModeU; 18 SamplerAddressMode addressModeV; 19 SamplerAddressMode addressModeW; 20 float mipLodBias; 21 bool anisotropyEnable; 22 float maxAnisotropy; 23 bool compareEnable; 24 CompareOp compareOp; 25 float minLod; 26 float maxLod; 27 BorderColor borderColor; 28 bool unnormalizedCoordinates; 29 } 30 31 const mixin VkTo!(VkSamplerCreateInfo); 32 } 33 34 private Device device; 35 package VkSampler sampler; 36 37 mixin ImplNameSetter!(device, sampler, DebugReportObjectType.Sampler); 38 39 this(Device device, CreateInfo _info) { 40 import std.exception : enforce; 41 42 this.device = device; 43 44 auto info = _info.vkTo(); 45 46 enforceVK(vkCreateSampler(device.device, &info, null, &sampler)); 47 enforce(sampler != VK_NULL_HANDLE); 48 } 49 50 ~this() { 51 vkDestroySampler(device.device, sampler, null); 52 } 53 54 mixin VkTo!(VkSampler); 55 }