mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
d3d12: Start supporting mrt
This commit is contained in:
parent
c167a1228e
commit
f77e2acfbe
2 changed files with 27 additions and 8 deletions
|
@ -66,7 +66,7 @@ void D3D12GSRender::ResourceStorage::Init(ID3D12Device *device)
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
D3D12_HEAP_DESC heapDescription = {};
|
D3D12_HEAP_DESC heapDescription = {};
|
||||||
heapDescription.SizeInBytes = 1024 * 1024 * 64;
|
heapDescription.SizeInBytes = 1024 * 1024 * 512;
|
||||||
heapDescription.Properties.Type = D3D12_HEAP_TYPE_UPLOAD;
|
heapDescription.Properties.Type = D3D12_HEAP_TYPE_UPLOAD;
|
||||||
heapDescription.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
|
heapDescription.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
|
||||||
check(device->CreateHeap(&heapDescription, IID_PPV_ARGS(&m_uploadTextureHeap)));
|
check(device->CreateHeap(&heapDescription, IID_PPV_ARGS(&m_uploadTextureHeap)));
|
||||||
|
@ -243,11 +243,11 @@ D3D12GSRender::D3D12GSRender()
|
||||||
descriptorRange[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV;
|
descriptorRange[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV;
|
||||||
// Textures
|
// Textures
|
||||||
descriptorRange[2].BaseShaderRegister = 0;
|
descriptorRange[2].BaseShaderRegister = 0;
|
||||||
descriptorRange[2].NumDescriptors = 1;
|
descriptorRange[2].NumDescriptors = 16;
|
||||||
descriptorRange[2].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
descriptorRange[2].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
|
||||||
// Samplers
|
// Samplers
|
||||||
descriptorRange[3].BaseShaderRegister = 0;
|
descriptorRange[3].BaseShaderRegister = 0;
|
||||||
descriptorRange[3].NumDescriptors = 1;
|
descriptorRange[3].NumDescriptors = 16;
|
||||||
descriptorRange[3].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
|
descriptorRange[3].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
|
||||||
D3D12_ROOT_PARAMETER RP[4] = {};
|
D3D12_ROOT_PARAMETER RP[4] = {};
|
||||||
RP[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
RP[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
||||||
|
@ -559,11 +559,28 @@ bool D3D12GSRender::LoadProgram()
|
||||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
|
switch (m_surface_color_target)
|
||||||
|
{
|
||||||
|
case CELL_GCM_SURFACE_TARGET_0:
|
||||||
|
case CELL_GCM_SURFACE_TARGET_1:
|
||||||
|
prop.numMRT = 1;
|
||||||
|
break;
|
||||||
|
case CELL_GCM_SURFACE_TARGET_MRT1:
|
||||||
|
prop.numMRT = 2;
|
||||||
|
break;
|
||||||
|
case CELL_GCM_SURFACE_TARGET_MRT2:
|
||||||
|
prop.numMRT = 3;
|
||||||
|
break;
|
||||||
|
case CELL_GCM_SURFACE_TARGET_MRT3:
|
||||||
|
prop.numMRT = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target);
|
||||||
|
}
|
||||||
|
|
||||||
prop.IASet = m_IASet;
|
prop.IASet = m_IASet;
|
||||||
|
|
||||||
|
|
||||||
m_PSO = m_cachePSO.getGraphicPipelineState(m_cur_vertex_prog, m_cur_fragment_prog, prop, std::make_pair(m_device, m_rootSignature));
|
m_PSO = m_cachePSO.getGraphicPipelineState(m_cur_vertex_prog, m_cur_fragment_prog, prop, std::make_pair(m_device, m_rootSignature));
|
||||||
return m_PSO != nullptr;
|
return m_PSO != nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,12 @@ struct D3D12PipelineProperties
|
||||||
DXGI_FORMAT DepthStencilFormat;
|
DXGI_FORMAT DepthStencilFormat;
|
||||||
std::vector<D3D12_INPUT_ELEMENT_DESC> IASet;
|
std::vector<D3D12_INPUT_ELEMENT_DESC> IASet;
|
||||||
D3D12_BLEND_DESC Blend;
|
D3D12_BLEND_DESC Blend;
|
||||||
|
unsigned numMRT : 3;
|
||||||
|
|
||||||
bool operator==(const D3D12PipelineProperties &in) const
|
bool operator==(const D3D12PipelineProperties &in) const
|
||||||
{
|
{
|
||||||
// TODO: blend and IASet equality
|
// TODO: blend and IASet equality
|
||||||
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat;
|
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,8 +145,9 @@ struct D3D12Traits
|
||||||
graphicPipelineStateDesc.RasterizerState = CD3D12_RASTERIZER_DESC;
|
graphicPipelineStateDesc.RasterizerState = CD3D12_RASTERIZER_DESC;
|
||||||
graphicPipelineStateDesc.PrimitiveTopologyType = pipelineProperties.Topology;
|
graphicPipelineStateDesc.PrimitiveTopologyType = pipelineProperties.Topology;
|
||||||
|
|
||||||
graphicPipelineStateDesc.NumRenderTargets = 1;
|
graphicPipelineStateDesc.NumRenderTargets = pipelineProperties.numMRT;
|
||||||
graphicPipelineStateDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
for (unsigned i = 0; i < pipelineProperties.numMRT; i++)
|
||||||
|
graphicPipelineStateDesc.RTVFormats[i] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
graphicPipelineStateDesc.DSVFormat = pipelineProperties.DepthStencilFormat;
|
graphicPipelineStateDesc.DSVFormat = pipelineProperties.DepthStencilFormat;
|
||||||
|
|
||||||
graphicPipelineStateDesc.InputLayout.pInputElementDescs = pipelineProperties.IASet.data();
|
graphicPipelineStateDesc.InputLayout.pInputElementDescs = pipelineProperties.IASet.data();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue