mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 06:48:33 +00:00
VideoBackends:D3D12: Add support for vertex shader point and line expansion
This commit is contained in:
parent
9624479933
commit
1eeba6dcca
3 changed files with 16 additions and 8 deletions
|
@ -19,6 +19,14 @@
|
||||||
|
|
||||||
namespace DX12
|
namespace DX12
|
||||||
{
|
{
|
||||||
|
static bool UsesDynamicVertexLoader(const AbstractPipeline* pipeline)
|
||||||
|
{
|
||||||
|
const AbstractPipelineUsage usage = static_cast<const DXPipeline*>(pipeline)->GetUsage();
|
||||||
|
return (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader &&
|
||||||
|
usage == AbstractPipelineUsage::GXUber) ||
|
||||||
|
(g_ActiveConfig.UseVSForLinePointExpand() && usage != AbstractPipelineUsage::Utility);
|
||||||
|
}
|
||||||
|
|
||||||
Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain, float backbuffer_scale)
|
Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain, float backbuffer_scale)
|
||||||
: ::Renderer(swap_chain ? swap_chain->GetWidth() : 0, swap_chain ? swap_chain->GetHeight() : 0,
|
: ::Renderer(swap_chain ? swap_chain->GetWidth() : 0, swap_chain ? swap_chain->GetHeight() : 0,
|
||||||
backbuffer_scale,
|
backbuffer_scale,
|
||||||
|
@ -364,8 +372,7 @@ void Renderer::DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// DX12 is great and doesn't include the base vertex in SV_VertexID
|
// DX12 is great and doesn't include the base vertex in SV_VertexID
|
||||||
if (static_cast<const DXPipeline*>(m_current_pipeline)->GetUsage() ==
|
if (UsesDynamicVertexLoader(m_current_pipeline))
|
||||||
AbstractPipelineUsage::GXUber)
|
|
||||||
g_dx_context->GetCommandList()->SetGraphicsRoot32BitConstant(
|
g_dx_context->GetCommandList()->SetGraphicsRoot32BitConstant(
|
||||||
ROOT_PARAMETER_BASE_VERTEX_CONSTANT, base_vertex, 0);
|
ROOT_PARAMETER_BASE_VERTEX_CONSTANT, base_vertex, 0);
|
||||||
g_dx_context->GetCommandList()->DrawIndexedInstanced(num_indices, 1, base_index, base_vertex, 0);
|
g_dx_context->GetCommandList()->DrawIndexedInstanced(num_indices, 1, base_index, base_vertex, 0);
|
||||||
|
@ -601,8 +608,7 @@ bool Renderer::ApplyState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty_bits & DirtyState_VS_SRV_Descriptor &&
|
if (dirty_bits & DirtyState_VS_SRV_Descriptor && UsesDynamicVertexLoader(pipeline))
|
||||||
pipeline->GetUsage() == AbstractPipelineUsage::GXUber)
|
|
||||||
{
|
{
|
||||||
cmdlist->SetGraphicsRootDescriptorTable(ROOT_PARAMETER_VS_SRV,
|
cmdlist->SetGraphicsRootDescriptorTable(ROOT_PARAMETER_VS_SRV,
|
||||||
m_state.vertex_srv_descriptor_base);
|
m_state.vertex_srv_descriptor_base);
|
||||||
|
@ -724,9 +730,7 @@ bool Renderer::UpdateUAVDescriptorTable()
|
||||||
|
|
||||||
bool Renderer::UpdateVSSRVDescriptorTable()
|
bool Renderer::UpdateVSSRVDescriptorTable()
|
||||||
{
|
{
|
||||||
if (!g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader ||
|
if (!UsesDynamicVertexLoader(m_current_pipeline))
|
||||||
static_cast<const DXPipeline*>(m_current_pipeline)->GetUsage() !=
|
|
||||||
AbstractPipelineUsage::GXUber)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,6 +353,9 @@ bool DXContext::CreateGXRootSignature()
|
||||||
param_count++;
|
param_count++;
|
||||||
SetRootParamCBV(¶ms[param_count], 1, D3D12_SHADER_VISIBILITY_VERTEX);
|
SetRootParamCBV(¶ms[param_count], 1, D3D12_SHADER_VISIBILITY_VERTEX);
|
||||||
param_count++;
|
param_count++;
|
||||||
|
if (g_ActiveConfig.UseVSForLinePointExpand())
|
||||||
|
SetRootParamCBV(¶ms[param_count], 2, D3D12_SHADER_VISIBILITY_VERTEX);
|
||||||
|
else
|
||||||
SetRootParamCBV(¶ms[param_count], 0, D3D12_SHADER_VISIBILITY_GEOMETRY);
|
SetRootParamCBV(¶ms[param_count], 0, D3D12_SHADER_VISIBILITY_GEOMETRY);
|
||||||
param_count++;
|
param_count++;
|
||||||
SetRootParamTable(¶ms[param_count], &ranges[param_count], D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 3,
|
SetRootParamTable(¶ms[param_count], &ranges[param_count], D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 3,
|
||||||
|
|
|
@ -88,6 +88,7 @@ void VideoBackend::FillBackendInfo()
|
||||||
g_Config.backend_info.bSupportsSettingObjectNames = true;
|
g_Config.backend_info.bSupportsSettingObjectNames = true;
|
||||||
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
|
g_Config.backend_info.bSupportsPartialMultisampleResolve = true;
|
||||||
g_Config.backend_info.bSupportsDynamicVertexLoader = true;
|
g_Config.backend_info.bSupportsDynamicVertexLoader = true;
|
||||||
|
g_Config.backend_info.bSupportsVSLinePointExpand = true;
|
||||||
|
|
||||||
// We can only check texture support once we have a device.
|
// We can only check texture support once we have a device.
|
||||||
if (g_dx_context)
|
if (g_dx_context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue