From 7ea3fb5e2d3f13d9c1c77a02e221b6b32e7b6716 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 6 Sep 2019 10:44:48 +0100 Subject: [PATCH] Only use anisotropic sampling if the device supports it Fixes #610 --- examples/particlefire/particlefire.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/particlefire/particlefire.cpp b/examples/particlefire/particlefire.cpp index 94c48141..385de4f6 100644 --- a/examples/particlefire/particlefire.cpp +++ b/examples/particlefire/particlefire.cpp @@ -374,9 +374,14 @@ public: samplerCreateInfo.minLod = 0.0f; // Both particle textures have the same number of mip maps samplerCreateInfo.maxLod = float(textures.particles.fire.mipLevels); - // Enable anisotropic filtering - samplerCreateInfo.maxAnisotropy = 8.0f; - samplerCreateInfo.anisotropyEnable = VK_TRUE; + + if (vulkanDevice->features.samplerAnisotropy) + { + // Enable anisotropic filtering + samplerCreateInfo.maxAnisotropy = 8.0f; + samplerCreateInfo.anisotropyEnable = VK_TRUE; + } + // Use a different border color (than the normal texture loader) for additive blending samplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; VK_CHECK_RESULT(vkCreateSampler(device, &samplerCreateInfo, nullptr, &textures.particles.sampler));