Merge pull request #7869 from stenzek/d3dcommon

D3D: Move sharable D3D11/D3D12 code to common library
This commit is contained in:
Connor McLaughlin
2019-03-29 20:40:06 +10:00
committed by GitHub
50 changed files with 1761 additions and 1423 deletions

View File

@ -151,6 +151,11 @@ std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage sta
return CreateShaderFromSource(stage, source.c_str(), source.size());
}
bool Renderer::EFBHasAlphaChannel() const
{
return m_prev_efb_format == PEControl::RGBA6_Z24;
}
void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
u32 color, u32 z)
{

View File

@ -224,6 +224,7 @@ public:
PEControl::PixelFormat GetPrevPixelFormat() const { return m_prev_efb_format; }
void StorePixelFormat(PEControl::PixelFormat new_format) { m_prev_efb_format = new_format; }
bool EFBHasAlphaChannel() const;
VideoCommon::PostProcessing* GetPostProcessor() const { return m_post_processor.get(); }
// Final surface changing
// This is called when the surface is resized (WX) or the window changes (Android).

View File

@ -966,10 +966,16 @@ void ShaderCache::QueueUberShaderPipelines()
config.vs_uid = vs_uid;
config.gs_uid = gs_uid;
config.ps_uid = ps_uid;
config.rasterization_state =
RenderState::GetCullBackFaceRasterizationState(PrimitiveType::TriangleStrip);
config.rasterization_state = RenderState::GetCullBackFaceRasterizationState(
static_cast<PrimitiveType>(gs_uid.GetUidData()->primitive_type));
config.depth_state = RenderState::GetNoDepthTestingDepthState();
config.blending_state = RenderState::GetNoBlendingBlendState();
if (ps_uid.GetUidData()->uint_output)
{
// uint_output is only ever enabled when logic ops are enabled.
config.blending_state.logicopenable = true;
config.blending_state.logicmode = BlendMode::AND;
}
auto iter = m_gx_uber_pipeline_cache.find(config);
if (iter != m_gx_uber_pipeline_cache.end())
@ -986,13 +992,15 @@ void ShaderCache::QueueUberShaderPipelines()
if (vuid.GetUidData()->num_texgens != puid.GetUidData()->num_texgens)
return;
UberShader::PixelShaderUid cleared_puid = puid;
UberShader::ClearUnusedPixelShaderUidBits(m_api_type, m_host_config, &cleared_puid);
EnumerateGeometryShaderUids([&](const GeometryShaderUid& guid) {
if (guid.GetUidData()->numTexGens != vuid.GetUidData()->num_texgens ||
(!guid.GetUidData()->IsPassthrough() && !m_host_config.backend_geometry_shaders))
{
return;
}
QueueDummyPipeline(vuid, guid, puid);
QueueDummyPipeline(vuid, guid, cleared_puid);
});
});
});

View File

@ -54,9 +54,9 @@ public:
// Streaming buffer sizes.
// Texel buffer will fit the maximum size of an encoded GX texture. 1024x1024, RGBA8 = 4MB.
static constexpr u32 VERTEX_STREAM_BUFFER_SIZE = 40 * 1024 * 1024;
static constexpr u32 INDEX_STREAM_BUFFER_SIZE = 4 * 1024 * 1024;
static constexpr u32 UNIFORM_STREAM_BUFFER_SIZE = 16 * 1024 * 1024;
static constexpr u32 VERTEX_STREAM_BUFFER_SIZE = 48 * 1024 * 1024;
static constexpr u32 INDEX_STREAM_BUFFER_SIZE = 8 * 1024 * 1024;
static constexpr u32 UNIFORM_STREAM_BUFFER_SIZE = 32 * 1024 * 1024;
static constexpr u32 TEXEL_STREAM_BUFFER_SIZE = 16 * 1024 * 1024;
VertexManagerBase();

View File

@ -294,6 +294,7 @@ void VideoBackendBase::InitializeShared()
GeometryShaderManager::Init();
PixelShaderManager::Init();
g_Config.VerifyValidity();
UpdateActiveConfig();
}