vulkan: fix texture LoD, enable anisotropic filtering
fixes textures being grainy when seen from a distance
This commit is contained in:
parent
78eb1829d8
commit
01af8e5f5e
|
@ -96,8 +96,9 @@ public:
|
|||
return samplers.emplace(
|
||||
std::make_pair(samplerHash, VulkanContext::Instance()->GetDevice().createSamplerUnique(
|
||||
vk::SamplerCreateInfo(vk::SamplerCreateFlags(), filter, filter,
|
||||
vk::SamplerMipmapMode::eLinear, uRepeat, vRepeat, vk::SamplerAddressMode::eClampToEdge, 0.0f, false,
|
||||
16.0f, false, vk::CompareOp::eNever, 0.0f, 0.0f, vk::BorderColor::eFloatOpaqueBlack)))).first->second.get();
|
||||
vk::SamplerMipmapMode::eNearest, uRepeat, vRepeat, vk::SamplerAddressMode::eClampToEdge, 0.0f,
|
||||
VulkanContext::Instance()->SupportsSamplerAnisotropy(), 16.0f, false, vk::CompareOp::eNever,
|
||||
0.0f, 256.0f, vk::BorderColor::eFloatOpaqueBlack)))).first->second.get();
|
||||
}
|
||||
static const u32 TSP_Mask = 0x7e000;
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
vk::ImageView GetSwapChainImageView(int i) const { return imageViews[i].get(); }
|
||||
static VulkanContext *Instance() { return contextInstance; }
|
||||
bool SupportsFragmentShaderStoresAndAtomics() const { return fragmentStoresAndAtomics; }
|
||||
bool SupportsSamplerAnisotropy() const { return samplerAnisotropy; }
|
||||
|
||||
private:
|
||||
vk::Format InitDepthBuffer();
|
||||
|
@ -141,6 +142,7 @@ private:
|
|||
bool optimalTilingSupported1555 = false;
|
||||
bool optimalTilingSupported4444 = false;
|
||||
bool fragmentStoresAndAtomics = false;
|
||||
bool samplerAnisotropy = false;
|
||||
vk::UniqueDevice device;
|
||||
|
||||
#ifdef USE_SDL
|
||||
|
|
|
@ -199,6 +199,7 @@ bool VulkanContext::InitInstance(const char** extensions, uint32_t extensions_co
|
|||
vk::PhysicalDeviceFeatures features;
|
||||
physicalDevice.getFeatures(&features);
|
||||
fragmentStoresAndAtomics = features.fragmentStoresAndAtomics;
|
||||
samplerAnisotropy = features.samplerAnisotropy;
|
||||
|
||||
ShaderCompiler::Init();
|
||||
|
||||
|
@ -383,6 +384,8 @@ bool VulkanContext::InitDevice()
|
|||
vk::PhysicalDeviceFeatures features;
|
||||
if (fragmentStoresAndAtomics)
|
||||
features.fragmentStoresAndAtomics = true;
|
||||
if (samplerAnisotropy)
|
||||
features.samplerAnisotropy = true;
|
||||
device = physicalDevice.createDeviceUnique(vk::DeviceCreateInfo(vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo,
|
||||
0, nullptr, deviceExtensions.size(), &deviceExtensions[0], &features));
|
||||
|
||||
|
|
Loading…
Reference in New Issue