vk_sampler_cache: Make use of designated initializers where applicable
This commit is contained in:
parent
772b6e4d28
commit
fd7af52ec3
|
@ -44,32 +44,35 @@ vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) c
|
||||||
const bool arbitrary_borders = device.IsExtCustomBorderColorSupported();
|
const bool arbitrary_borders = device.IsExtCustomBorderColorSupported();
|
||||||
const std::array color = tsc.GetBorderColor();
|
const std::array color = tsc.GetBorderColor();
|
||||||
|
|
||||||
VkSamplerCustomBorderColorCreateInfoEXT border;
|
VkSamplerCustomBorderColorCreateInfoEXT border{
|
||||||
border.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT;
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT,
|
||||||
border.pNext = nullptr;
|
.pNext = nullptr,
|
||||||
border.format = VK_FORMAT_UNDEFINED;
|
.format = VK_FORMAT_UNDEFINED,
|
||||||
|
};
|
||||||
std::memcpy(&border.customBorderColor, color.data(), sizeof(color));
|
std::memcpy(&border.customBorderColor, color.data(), sizeof(color));
|
||||||
|
|
||||||
VkSamplerCreateInfo ci;
|
return device.GetLogical().CreateSampler({
|
||||||
ci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||||
ci.pNext = arbitrary_borders ? &border : nullptr;
|
.pNext = arbitrary_borders ? &border : nullptr,
|
||||||
ci.flags = 0;
|
.flags = 0,
|
||||||
ci.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter);
|
.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter),
|
||||||
ci.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter);
|
.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter),
|
||||||
ci.mipmapMode = MaxwellToVK::Sampler::MipmapMode(tsc.mipmap_filter);
|
.mipmapMode = MaxwellToVK::Sampler::MipmapMode(tsc.mipmap_filter),
|
||||||
ci.addressModeU = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_u, tsc.mag_filter);
|
.addressModeU = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_u, tsc.mag_filter),
|
||||||
ci.addressModeV = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_v, tsc.mag_filter);
|
.addressModeV = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_v, tsc.mag_filter),
|
||||||
ci.addressModeW = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_p, tsc.mag_filter);
|
.addressModeW = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_p, tsc.mag_filter),
|
||||||
ci.mipLodBias = tsc.GetLodBias();
|
.mipLodBias = tsc.GetLodBias(),
|
||||||
ci.anisotropyEnable = tsc.GetMaxAnisotropy() > 1.0f ? VK_TRUE : VK_FALSE;
|
.anisotropyEnable =
|
||||||
ci.maxAnisotropy = tsc.GetMaxAnisotropy();
|
static_cast<VkBool32>(tsc.GetMaxAnisotropy() > 1.0f ? VK_TRUE : VK_FALSE),
|
||||||
ci.compareEnable = tsc.depth_compare_enabled;
|
.maxAnisotropy = tsc.GetMaxAnisotropy(),
|
||||||
ci.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func);
|
.compareEnable = tsc.depth_compare_enabled,
|
||||||
ci.minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.GetMinLod();
|
.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func),
|
||||||
ci.maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.GetMaxLod();
|
.minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.GetMinLod(),
|
||||||
ci.borderColor = arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color);
|
.maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.GetMaxLod(),
|
||||||
ci.unnormalizedCoordinates = VK_FALSE;
|
.borderColor =
|
||||||
return device.GetLogical().CreateSampler(ci);
|
arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color),
|
||||||
|
.unnormalizedCoordinates = VK_FALSE,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSampler VKSamplerCache::ToSamplerType(const vk::Sampler& sampler) const {
|
VkSampler VKSamplerCache::ToSamplerType(const vk::Sampler& sampler) const {
|
||||||
|
|
Reference in New Issue