GS/DX12: Fix incorrect topology on PrimID DATE setup

This commit is contained in:
Connor McLaughlin 2022-09-07 17:08:27 +10:00 committed by refractionpcsx2
parent e60e0c02c0
commit d4a5a714fb
1 changed files with 5 additions and 4 deletions

View File

@ -35,6 +35,9 @@
static bool IsDATMConvertShader(ShaderConvert i) { return (i == ShaderConvert::DATM_0 || i == ShaderConvert::DATM_1); }
static bool IsDATEModePrimIDInit(u32 flag) { return flag == 1 || flag == 2; }
static constexpr std::array<D3D12_PRIMITIVE_TOPOLOGY, 3> s_primitive_topology_mapping =
{{D3D_PRIMITIVE_TOPOLOGY_POINTLIST, D3D_PRIMITIVE_TOPOLOGY_LINELIST, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST}};
static D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE GetLoadOpForTexture(GSTexture12* tex)
{
if (!tex)
@ -2399,6 +2402,7 @@ GSTexture12* GSDevice12::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config, Pipe
DrawPrimitive();
// image is now filled with either -1 or INT_MAX, so now we can do the prepass
SetPrimitiveTopology(s_primitive_topology_mapping[static_cast<u8>(config.topology)]);
IASetVertexBuffer(config.verts, sizeof(GSVertex), config.nverts);
IASetIndexBuffer(config.indices, config.nindices);
@ -2429,9 +2433,6 @@ GSTexture12* GSDevice12::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config, Pipe
void GSDevice12::RenderHW(GSHWDrawConfig& config)
{
static constexpr std::array<D3D12_PRIMITIVE_TOPOLOGY, 3> primitive_topologies =
{{D3D_PRIMITIVE_TOPOLOGY_POINTLIST, D3D_PRIMITIVE_TOPOLOGY_LINELIST, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST}};
// Destination Alpha Setup
const bool stencil_DATE =
(config.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::Stencil ||
@ -2592,7 +2593,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
}
// VB/IB upload, if we did DATE setup and it's not HDR this has already been done
SetPrimitiveTopology(primitive_topologies[static_cast<u8>(config.topology)]);
SetPrimitiveTopology(s_primitive_topology_mapping[static_cast<u8>(config.topology)]);
if (!date_image || hdr_rt)
{
IASetVertexBuffer(config.verts, sizeof(GSVertex), config.nverts);