BS2Emu: Initialize the last rows of postMatrices to the identity matrix

This fixes Datel titles having missing textures (which was an issue with the previous commit).
This commit is contained in:
Pokechu22 2022-06-12 23:38:33 -07:00
parent b2ddffeeb1
commit 76401e8ffb
1 changed files with 15 additions and 0 deletions

View File

@ -37,6 +37,10 @@
#include "DiscIO/RiivolutionPatcher.h"
#include "DiscIO/VolumeDisc.h"
#include "VideoCommon/VertexManagerBase.h"
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/XFMemory.h"
namespace
{
void PresetTimeBaseTicks()
@ -253,6 +257,17 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::VolumeDisc& volume,
SetupGCMemory();
// Datel titles don't initialize the postMatrices, but they have dual-texture coordinate
// transformation enabled. We initialize all of xfmem to 0, which results in everything using
// a texture coordinate of (0, 0), breaking textures. Normally the IPL will initialize the last
// entry to the identity matrix, but the whole point of BS2 EMU is that it skips the IPL, so we
// need to do this initialization ourselves.
xfmem.postMatrices[0x3d * 4 + 0] = 1.0f;
xfmem.postMatrices[0x3e * 4 + 1] = 1.0f;
xfmem.postMatrices[0x3f * 4 + 2] = 1.0f;
g_vertex_manager->Flush();
VertexShaderManager::InvalidateXFRange(XFMEM_POSTMATRICES + 0x3d * 4, XFMEM_POSTMATRICES_END);
DVDReadDiscID(volume, 0x00000000);
bool streaming = Memory::Read_U8(0x80000008);