Vulkan: Initial support for aniso filtering.

This commit is contained in:
Unknown W. Brackets 2016-03-17 21:59:16 -07:00 committed by Henrik Rydgard
parent da50370328
commit 82f3df1e06
4 changed files with 12 additions and 6 deletions

View File

@ -664,6 +664,9 @@ VkResult VulkanContext::CreateDevice(int physical_device) {
if (featuresAvailable_.depthBounds) {
featuresEnabled_.depthBounds = true;
}
if (featuresAvailable_.samplerAnisotropy) {
featuresEnabled_.samplerAnisotropy = true;
}
VkDeviceCreateInfo device_info = {};
device_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;

View File

@ -457,6 +457,7 @@ enum {
GPU_SUPPORTS_LOGIC_OP = FLAG_BIT(5),
GPU_USE_DEPTH_RANGE_HACK = FLAG_BIT(6),
GPU_SUPPORTS_WIDE_LINES = FLAG_BIT(7),
GPU_SUPPORTS_ANISOTROPY = FLAG_BIT(8),
GPU_SUPPORTS_LARGE_VIEWPORTS = FLAG_BIT(16),
GPU_SUPPORTS_ACCURATE_DEPTH = FLAG_BIT(17),
GPU_SUPPORTS_VAO = FLAG_BIT(18),

View File

@ -471,6 +471,9 @@ void GPU_Vulkan::CheckGPUFeatures() {
if (vulkan_->GetFeaturesEnabled().logicOp) {
gstate_c.featureFlags |= GPU_SUPPORTS_LOGIC_OP;
}
if (vulkan_->GetFeaturesEnabled().samplerAnisotropy) {
gstate_c.featureFlags |= GPU_SUPPORTS_ANISOTROPY;
}
// Mandatory features on Vulkan, which may be checked in "centralized" code
gstate_c.featureFlags |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
gstate_c.featureFlags |= GPU_SUPPORTS_FBO;

View File

@ -105,15 +105,14 @@ VkSampler SamplerCache::GetOrCreateSampler(const SamplerCacheKey &key) {
samp.minFilter = key.minFilt ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
samp.mipmapMode = key.mipFilt ? VK_SAMPLER_MIPMAP_MODE_LINEAR : VK_SAMPLER_MIPMAP_MODE_NEAREST;
// TODO: Need to check for device support before enabling aniso
/*
if (g_Config.iAnisotropyLevel > 1) {
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
samp.maxAnisotropy = g_Config.iAnisotropyLevel;
samp.anisotropyEnable = true;
} else {
samp.maxAnisotropy = 1.0f;
samp.anisotropyEnable = false;
}
*/
samp.maxAnisotropy = 1.0f;
samp.anisotropyEnable = false;
samp.maxLod = key.maxLevel;
samp.minLod = 0.0f;
samp.mipLodBias = 0.0f;