FramebufferManager: Dynamic selection of EFB depth format
This commit is contained in:
parent
b30342d38f
commit
3323265d91
|
@ -142,12 +142,12 @@ bool FramebufferManager::Initialize()
|
||||||
|
|
||||||
bool FramebufferManager::CreateEFBRenderPasses()
|
bool FramebufferManager::CreateEFBRenderPasses()
|
||||||
{
|
{
|
||||||
m_efb_load_render_pass =
|
m_efb_load_render_pass = g_object_cache->GetRenderPass(
|
||||||
g_object_cache->GetRenderPass(EFB_COLOR_TEXTURE_FORMAT, EFB_DEPTH_TEXTURE_FORMAT,
|
EFB_COLOR_TEXTURE_FORMAT, Util::GetVkFormatForHostTextureFormat(GetEFBDepthFormat()),
|
||||||
g_ActiveConfig.iMultisamples, VK_ATTACHMENT_LOAD_OP_LOAD);
|
g_ActiveConfig.iMultisamples, VK_ATTACHMENT_LOAD_OP_LOAD);
|
||||||
m_efb_clear_render_pass =
|
m_efb_clear_render_pass = g_object_cache->GetRenderPass(
|
||||||
g_object_cache->GetRenderPass(EFB_COLOR_TEXTURE_FORMAT, EFB_DEPTH_TEXTURE_FORMAT,
|
EFB_COLOR_TEXTURE_FORMAT, Util::GetVkFormatForHostTextureFormat(GetEFBDepthFormat()),
|
||||||
g_ActiveConfig.iMultisamples, VK_ATTACHMENT_LOAD_OP_CLEAR);
|
g_ActiveConfig.iMultisamples, VK_ATTACHMENT_LOAD_OP_CLEAR);
|
||||||
m_depth_resolve_render_pass = g_object_cache->GetRenderPass(
|
m_depth_resolve_render_pass = g_object_cache->GetRenderPass(
|
||||||
EFB_DEPTH_AS_COLOR_TEXTURE_FORMAT, VK_FORMAT_UNDEFINED, 1, VK_ATTACHMENT_LOAD_OP_DONT_CARE);
|
EFB_DEPTH_AS_COLOR_TEXTURE_FORMAT, VK_FORMAT_UNDEFINED, 1, VK_ATTACHMENT_LOAD_OP_DONT_CARE);
|
||||||
return m_efb_load_render_pass != VK_NULL_HANDLE && m_efb_clear_render_pass != VK_NULL_HANDLE &&
|
return m_efb_load_render_pass != VK_NULL_HANDLE && m_efb_clear_render_pass != VK_NULL_HANDLE &&
|
||||||
|
@ -181,7 +181,8 @@ bool FramebufferManager::CreateEFBFramebuffer()
|
||||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
|
|
||||||
m_efb_depth_texture = Texture2D::Create(
|
m_efb_depth_texture = Texture2D::Create(
|
||||||
efb_width, efb_height, 1, efb_layers, EFB_DEPTH_TEXTURE_FORMAT, efb_samples,
|
efb_width, efb_height, 1, efb_layers,
|
||||||
|
Util::GetVkFormatForHostTextureFormat(GetEFBDepthFormat()), efb_samples,
|
||||||
VK_IMAGE_VIEW_TYPE_2D_ARRAY, VK_IMAGE_TILING_OPTIMAL,
|
VK_IMAGE_VIEW_TYPE_2D_ARRAY, VK_IMAGE_TILING_OPTIMAL,
|
||||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
||||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "VideoCommon/AbstractTexture.h"
|
||||||
#include "VideoCommon/RenderBase.h"
|
#include "VideoCommon/RenderBase.h"
|
||||||
|
|
||||||
std::unique_ptr<FramebufferManagerBase> g_framebuffer_manager;
|
std::unique_ptr<FramebufferManagerBase> g_framebuffer_manager;
|
||||||
|
@ -13,3 +14,8 @@ std::unique_ptr<FramebufferManagerBase> g_framebuffer_manager;
|
||||||
unsigned int FramebufferManagerBase::m_EFBLayers = 1;
|
unsigned int FramebufferManagerBase::m_EFBLayers = 1;
|
||||||
|
|
||||||
FramebufferManagerBase::~FramebufferManagerBase() = default;
|
FramebufferManagerBase::~FramebufferManagerBase() = default;
|
||||||
|
|
||||||
|
AbstractTextureFormat FramebufferManagerBase::GetEFBDepthFormat()
|
||||||
|
{
|
||||||
|
return AbstractTextureFormat::D32F;
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
enum class AbstractTextureFormat : u32;
|
||||||
|
|
||||||
inline bool AddressRangesOverlap(u32 aLower, u32 aUpper, u32 bLower, u32 bUpper)
|
inline bool AddressRangesOverlap(u32 aLower, u32 aUpper, u32 bLower, u32 bUpper)
|
||||||
{
|
{
|
||||||
return !((aLower >= bUpper) || (bLower >= aUpper));
|
return !((aLower >= bUpper) || (bLower >= aUpper));
|
||||||
|
@ -19,6 +21,7 @@ public:
|
||||||
virtual ~FramebufferManagerBase();
|
virtual ~FramebufferManagerBase();
|
||||||
|
|
||||||
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
||||||
|
static AbstractTextureFormat GetEFBDepthFormat();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static unsigned int m_EFBLayers;
|
static unsigned int m_EFBLayers;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
|
|
||||||
|
#include "VideoCommon/FramebufferManagerBase.h"
|
||||||
#include "VideoCommon/RenderBase.h"
|
#include "VideoCommon/RenderBase.h"
|
||||||
#include "VideoCommon/Statistics.h"
|
#include "VideoCommon/Statistics.h"
|
||||||
#include "VideoCommon/VertexLoaderManager.h"
|
#include "VideoCommon/VertexLoaderManager.h"
|
||||||
|
@ -26,6 +27,7 @@ bool ShaderCache::Initialize()
|
||||||
{
|
{
|
||||||
m_api_type = g_ActiveConfig.backend_info.api_type;
|
m_api_type = g_ActiveConfig.backend_info.api_type;
|
||||||
m_host_config = ShaderHostConfig::GetCurrent();
|
m_host_config = ShaderHostConfig::GetCurrent();
|
||||||
|
m_efb_depth_format = FramebufferManagerBase::GetEFBDepthFormat();
|
||||||
m_efb_multisamples = g_ActiveConfig.iMultisamples;
|
m_efb_multisamples = g_ActiveConfig.iMultisamples;
|
||||||
|
|
||||||
// Create the async compiler, and start the worker threads.
|
// Create the async compiler, and start the worker threads.
|
||||||
|
@ -441,7 +443,7 @@ AbstractPipelineConfig ShaderCache::GetGXPipelineConfig(
|
||||||
config.depth_state = depth_state;
|
config.depth_state = depth_state;
|
||||||
config.blending_state = blending_state;
|
config.blending_state = blending_state;
|
||||||
config.framebuffer_state.color_texture_format = AbstractTextureFormat::RGBA8;
|
config.framebuffer_state.color_texture_format = AbstractTextureFormat::RGBA8;
|
||||||
config.framebuffer_state.depth_texture_format = AbstractTextureFormat::D32F;
|
config.framebuffer_state.depth_texture_format = m_efb_depth_format;
|
||||||
config.framebuffer_state.per_sample_shading = m_host_config.ssaa;
|
config.framebuffer_state.per_sample_shading = m_host_config.ssaa;
|
||||||
config.framebuffer_state.samples = m_efb_multisamples;
|
config.framebuffer_state.samples = m_efb_multisamples;
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "VideoCommon/VertexShaderGen.h"
|
#include "VideoCommon/VertexShaderGen.h"
|
||||||
|
|
||||||
class NativeVertexFormat;
|
class NativeVertexFormat;
|
||||||
|
enum class AbstractTextureFormat : u32;
|
||||||
|
|
||||||
namespace VideoCommon
|
namespace VideoCommon
|
||||||
{
|
{
|
||||||
|
@ -129,6 +130,7 @@ private:
|
||||||
// Configuration bits.
|
// Configuration bits.
|
||||||
APIType m_api_type = APIType::Nothing;
|
APIType m_api_type = APIType::Nothing;
|
||||||
ShaderHostConfig m_host_config = {};
|
ShaderHostConfig m_host_config = {};
|
||||||
|
AbstractTextureFormat m_efb_depth_format;
|
||||||
u32 m_efb_multisamples = 1;
|
u32 m_efb_multisamples = 1;
|
||||||
std::unique_ptr<AsyncShaderCompiler> m_async_shader_compiler;
|
std::unique_ptr<AsyncShaderCompiler> m_async_shader_compiler;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue