mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
d3d12: Implement discard
Should make alpha test kill test almost working as it should.
This commit is contained in:
parent
dc1a57e71c
commit
70b537c8c2
3 changed files with 8 additions and 1 deletions
|
@ -436,6 +436,7 @@ void D3D12GSRender::setScaleOffset()
|
||||||
void *scaleOffsetMap;
|
void *scaleOffsetMap;
|
||||||
check(scaleOffsetBuffer->Map(0, nullptr, &scaleOffsetMap));
|
check(scaleOffsetBuffer->Map(0, nullptr, &scaleOffsetMap));
|
||||||
streamToBuffer(scaleOffsetMap, scaleOffsetMat, 16 * sizeof(float));
|
streamToBuffer(scaleOffsetMap, scaleOffsetMat, 16 * sizeof(float));
|
||||||
|
streamToBuffer((char*)scaleOffsetMap + 16 * sizeof(float), &m_alpha_ref, sizeof(float));
|
||||||
scaleOffsetBuffer->Unmap(0, nullptr);
|
scaleOffsetBuffer->Unmap(0, nullptr);
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
||||||
|
|
|
@ -34,7 +34,11 @@ std::string D3D12FragmentDecompiler::compareFunction(COMPARE f, const std::strin
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertHeader(std::stringstream & OS)
|
void D3D12FragmentDecompiler::insertHeader(std::stringstream & OS)
|
||||||
{
|
{
|
||||||
OS << "// Header" << std::endl;
|
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
||||||
|
OS << "{" << std::endl;
|
||||||
|
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
||||||
|
OS << " float alphaRef;" << std::endl;
|
||||||
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D12FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
void D3D12FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
||||||
|
@ -158,6 +162,7 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS)
|
||||||
else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second))
|
else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second))
|
||||||
OS << " Out." << table2[i].first << " = " << table2[i].second << ";" << std::endl;
|
OS << " Out." << table2[i].first << " = " << table2[i].second << ";" << std::endl;
|
||||||
}
|
}
|
||||||
|
OS << " if (Out.ocol0.a <= alphaRef) discard;" << std::endl;
|
||||||
OS << " return Out;" << std::endl;
|
OS << " return Out;" << std::endl;
|
||||||
OS << "}" << std::endl;
|
OS << "}" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ void D3D12VertexProgramDecompiler::insertHeader(std::stringstream &OS)
|
||||||
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
OS << "cbuffer SCALE_OFFSET : register(b0)" << std::endl;
|
||||||
OS << "{" << std::endl;
|
OS << "{" << std::endl;
|
||||||
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
OS << " float4x4 scaleOffsetMat;" << std::endl;
|
||||||
|
OS << " float alphaRef;" << std::endl;
|
||||||
OS << "};" << std::endl;
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue