mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
fp32 precision on GPUs is embarassing
- Division seems to suffer from drift easily on GPUs due to limited precision
This commit is contained in:
parent
ccc0383f75
commit
5cf2d774f3
1 changed files with 6 additions and 4 deletions
|
@ -306,13 +306,15 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
|
||||||
//It is therefore critical that this step is done post-transform and the result re-scaled by w
|
//It is therefore critical that this step is done post-transform and the result re-scaled by w
|
||||||
//SEE Naruto: UNS
|
//SEE Naruto: UNS
|
||||||
|
|
||||||
OS << " float ndc_z = gl_Position.z / gl_Position.w;\n";
|
//NOTE: On GPUs, poor fp32 precision means dividing z by w, then multiplying by w again gives slightly incorrect results
|
||||||
OS << " ndc_z = (ndc_z * 2.) - 1.;\n";
|
//This equation is simplified algebraically to an addition and subreaction which gives more accurate results (Fixes flickering skybox in Dark Souls 2)
|
||||||
OS << " gl_Position.z = ndc_z * gl_Position.w;\n";
|
//OS << " float ndc_z = gl_Position.z / gl_Position.w;\n";
|
||||||
|
//OS << " ndc_z = (ndc_z * 2.) - 1.;\n";
|
||||||
|
//OS << " gl_Position.z = ndc_z * gl_Position.w;\n";
|
||||||
|
OS << " gl_Position.z = (gl_Position.z + gl_Position.z) - gl_Position.w;\n";
|
||||||
OS << "}\n";
|
OS << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLVertexDecompilerThread::Task()
|
void GLVertexDecompilerThread::Task()
|
||||||
{
|
{
|
||||||
m_shader = Decompile();
|
m_shader = Decompile();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue