From 3632d200f920e0be21c930bc9fdafcc93a6305d9 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 19 Nov 2019 20:16:58 +0100 Subject: [PATCH] Added anisotropic filtering to Vulkan backend --- README.md | 4 ++-- neo/renderer/Vulkan/Image_VK.cpp | 12 ++++++++++++ neo/renderer/Vulkan/RenderBackend_VK.cpp | 6 +++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e954ed60..5254bcab 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ I started this project in 2012 and focused on making this code being future proo * Win64 support and Visual Studio support up to VS 2019 * OS X support * OpenAL Soft sound backend primarily developed for Linux but works on Windows as well -* Bink video support through libbinkdec or FFmpeg (thanks to Daniel Gibson) +* Bink video support through libbinkdec (thanks to Daniel Gibson) or FFmpeg (thanks to Carl Kenner) * PNG image support * Soft shadows using PCF hardware shadow mapping The implementation uses sampler2DArrayShadow and PCF which usually @@ -163,7 +163,7 @@ Steam. This includes roaming profiles, achievements, leaderboards, matchmaking, any other Steam features. ### Bink Video playback -The RBDOOM-3-BFG Edition GPL Source Code release includes functionality for rendering Bink Videos through FFmpeg. +The RBDOOM-3-BFG Edition GPL Source Code release includes functionality for rendering Bink Videos through FFmpeg or libbinkdec. ### Back End Rendering of Stencil Shadows The Doom 3 BFG Edition GPL Source Code release does not include functionality enabling rendering diff --git a/neo/renderer/Vulkan/Image_VK.cpp b/neo/renderer/Vulkan/Image_VK.cpp index 71f898ee..a992b43e 100644 --- a/neo/renderer/Vulkan/Image_VK.cpp +++ b/neo/renderer/Vulkan/Image_VK.cpp @@ -236,6 +236,18 @@ void idImage::CreateSampler() switch( filter ) { case TF_DEFAULT: + createInfo.minFilter = VK_FILTER_LINEAR; + createInfo.magFilter = VK_FILTER_LINEAR; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; + + // RB: enable anisotropic filtering + if( r_maxAnisotropicFiltering.GetInteger() > 0 ) + { + createInfo.anisotropyEnable = VK_TRUE; + createInfo.maxAnisotropy = r_maxAnisotropicFiltering.GetInteger(); + } + break; + case TF_LINEAR: createInfo.minFilter = VK_FILTER_LINEAR; createInfo.magFilter = VK_FILTER_LINEAR; diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index 4e01e4f0..ea110ced 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -600,7 +600,7 @@ static void CreateLogicalDeviceAndQueues() deviceFeatures.depthBiasClamp = VK_TRUE; deviceFeatures.depthBounds = VK_TRUE; deviceFeatures.fillModeNonSolid = VK_TRUE; - //deviceFeatures.samplerAnisotropy = vkcontext.physicalDeviceFeatures.samplerAnisotropy; // RB + deviceFeatures.samplerAnisotropy = vkcontext.physicalDeviceFeatures.samplerAnisotropy; // RB VkDeviceCreateInfo info = {}; info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; @@ -2081,6 +2081,10 @@ See if some cvars that we watch have changed void idRenderBackend::CheckCVars() { // TODO + if( r_useShadowMapping.GetBool() ) + { + r_useShadowMapping.SetBool( false ); + } /* // gamma stuff