mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-16 23:39:14 +00:00
VideoSW: drop fudge factor from position transform
Use round-to-zero instead.
This commit is contained in:
parent
812c6c2ea4
commit
df3c21a33b
2 changed files with 8 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "VideoBackends/Software/SWVertexLoader.h"
|
#include "VideoBackends/Software/SWVertexLoader.h"
|
||||||
|
|
||||||
|
#include <cfenv>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -77,6 +78,10 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
|
||||||
SetFormat();
|
SetFormat();
|
||||||
ParseVertex(VertexLoaderManager::GetCurrentVertexFormat()->GetVertexDeclaration(), index);
|
ParseVertex(VertexLoaderManager::GetCurrentVertexFormat()->GetVertexDeclaration(), index);
|
||||||
|
|
||||||
|
// At least the position transform uses round-to-zero.
|
||||||
|
const auto round_mode = std::fegetround();
|
||||||
|
std::fesetround(FE_TOWARDZERO);
|
||||||
|
|
||||||
// transform this vertex so that it can be used for rasterization (outVertex)
|
// transform this vertex so that it can be used for rasterization (outVertex)
|
||||||
OutputVertexData* outVertex = m_setup_unit.GetVertex();
|
OutputVertexData* outVertex = m_setup_unit.GetVertex();
|
||||||
TransformUnit::TransformPosition(&m_vertex, outVertex);
|
TransformUnit::TransformPosition(&m_vertex, outVertex);
|
||||||
|
@ -84,6 +89,8 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
|
||||||
TransformUnit::TransformColor(&m_vertex, outVertex);
|
TransformUnit::TransformColor(&m_vertex, outVertex);
|
||||||
TransformUnit::TransformTexCoord(&m_vertex, outVertex);
|
TransformUnit::TransformTexCoord(&m_vertex, outVertex);
|
||||||
|
|
||||||
|
std::fesetround(round_mode);
|
||||||
|
|
||||||
// assemble and rasterize the primitive
|
// assemble and rasterize the primitive
|
||||||
m_setup_unit.SetupVertex();
|
m_setup_unit.SetupVertex();
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ static void MultipleVec3Perspective(const Vec3& vec, const Projection::Raw& proj
|
||||||
{
|
{
|
||||||
result.x = proj[0] * vec.x + proj[1] * vec.z;
|
result.x = proj[0] * vec.x + proj[1] * vec.z;
|
||||||
result.y = proj[2] * vec.y + proj[3] * vec.z;
|
result.y = proj[2] * vec.y + proj[3] * vec.z;
|
||||||
// result.z = (proj[4] * vec.z + proj[5]);
|
result.z = proj[4] * vec.z + proj[5];
|
||||||
result.z = (proj[4] * vec.z + proj[5]) * (1.0f - (float)1e-7);
|
|
||||||
result.w = -vec.z;
|
result.w = -vec.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue