mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Merge 2c0e5ecc48
into 80ea68b13c
This commit is contained in:
commit
b37674a035
@ -3,6 +3,7 @@
|
||||
|
||||
#include "VideoBackends/Software/SWVertexLoader.h"
|
||||
|
||||
#include <cfenv>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
@ -78,6 +79,10 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
|
||||
SetFormat();
|
||||
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)
|
||||
OutputVertexData* outVertex = m_setup_unit.GetVertex();
|
||||
TransformUnit::TransformPosition(&m_vertex, outVertex);
|
||||
@ -85,6 +90,8 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
|
||||
TransformUnit::TransformColor(&m_vertex, outVertex);
|
||||
TransformUnit::TransformTexCoord(&m_vertex, outVertex);
|
||||
|
||||
std::fesetround(round_mode);
|
||||
|
||||
// assemble and rasterize the primitive
|
||||
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.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]) * (1.0f - (float)1e-7);
|
||||
result.z = proj[4] * vec.z + proj[5];
|
||||
result.w = -vec.z;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user