From 4959985a173d8b8cbf48a3b803e5e55ab02704d7 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Fri, 5 Jan 2018 20:47:27 +0100 Subject: [PATCH] Enable sampler anisotropy only if enabled on device --- base/VulkanTexture.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/VulkanTexture.hpp b/base/VulkanTexture.hpp index 456bf94b..48d24a68 100644 --- a/base/VulkanTexture.hpp +++ b/base/VulkanTexture.hpp @@ -344,7 +344,7 @@ namespace vks samplerCreateInfo.maxLod = (useStaging) ? (float)mipLevels : 0.0f; // Only enable anisotropic filtering if enabled on the devicec samplerCreateInfo.maxAnisotropy = device->enabledFeatures.samplerAnisotropy ? device->properties.limits.maxSamplerAnisotropy : 1.0f; - samplerCreateInfo.anisotropyEnable = VK_TRUE; + samplerCreateInfo.anisotropyEnable = device->enabledFeatures.samplerAnisotropy; samplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE; VK_CHECK_RESULT(vkCreateSampler(device->logicalDevice, &samplerCreateInfo, nullptr, &sampler)); @@ -731,6 +731,7 @@ namespace vks samplerCreateInfo.addressModeW = samplerCreateInfo.addressModeU; samplerCreateInfo.mipLodBias = 0.0f; samplerCreateInfo.maxAnisotropy = device->enabledFeatures.samplerAnisotropy ? device->properties.limits.maxSamplerAnisotropy : 1.0f; + samplerCreateInfo.anisotropyEnable = device->enabledFeatures.samplerAnisotropy; samplerCreateInfo.compareOp = VK_COMPARE_OP_NEVER; samplerCreateInfo.minLod = 0.0f; samplerCreateInfo.maxLod = (float)mipLevels; @@ -945,6 +946,7 @@ namespace vks samplerCreateInfo.addressModeW = samplerCreateInfo.addressModeU; samplerCreateInfo.mipLodBias = 0.0f; samplerCreateInfo.maxAnisotropy = device->enabledFeatures.samplerAnisotropy ? device->properties.limits.maxSamplerAnisotropy : 1.0f; + samplerCreateInfo.anisotropyEnable = device->enabledFeatures.samplerAnisotropy; samplerCreateInfo.compareOp = VK_COMPARE_OP_NEVER; samplerCreateInfo.minLod = 0.0f; samplerCreateInfo.maxLod = (float)mipLevels;