Skip to content

Commit

Permalink
Vulkan: Initial support for aniso filtering.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets authored and hrydgard committed Mar 20, 2016
1 parent da50370 commit 82f3df1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Common/Vulkan/VulkanContext.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUState.h
Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions GPU/Vulkan/GPU_Vulkan.cpp
Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions GPU/Vulkan/TextureCacheVulkan.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 82f3df1

Please sign in to comment.