Fifo recorder: Fix position's type being used for normals/colors/texture coords

In most cases, games will use the same type for all vertex components (either Index8 or Index16 or Direct).  However, RS2's deflection towers use Index16 for the texture coordinate and Index8 for everything else, meaning the texture coordinates were recorded incorrectly (the first byte was used, so only indices 0 and 1 were recorded instead of 0 through 0x0192).  Worse still, some background elements in RS2 use direct positions but indexed normals or texture coordinates, and those would not be recorded at all.

This is a regression from b5fd35f951.
This commit is contained in:
Pokechu22 2022-05-18 18:03:10 -07:00
parent 804e42150e
commit 24b761acda
1 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ void FifoRecorder::FifoRecordAnalyzer::OnPrimitiveCommand(OpcodeDecoder::Primiti
const u32 norm_size = const u32 norm_size =
VertexLoader_Normal::GetSize(vtx_desc.low.Normal, vtx_attr.g0.NormalFormat, VertexLoader_Normal::GetSize(vtx_desc.low.Normal, vtx_attr.g0.NormalFormat,
vtx_attr.g0.NormalElements, vtx_attr.g0.NormalIndex3); vtx_attr.g0.NormalElements, vtx_attr.g0.NormalIndex3);
ProcessVertexComponent(CPArray::Normal, vtx_desc.low.Position, offset, vertex_size, num_vertices, ProcessVertexComponent(CPArray::Normal, vtx_desc.low.Normal, offset, vertex_size, num_vertices,
vertex_data); vertex_data);
offset += norm_size; offset += norm_size;
@ -106,7 +106,7 @@ void FifoRecorder::FifoRecordAnalyzer::OnPrimitiveCommand(OpcodeDecoder::Primiti
{ {
const u32 color_size = const u32 color_size =
VertexLoader_Color::GetSize(vtx_desc.low.Color[i], vtx_attr.GetColorFormat(i)); VertexLoader_Color::GetSize(vtx_desc.low.Color[i], vtx_attr.GetColorFormat(i));
ProcessVertexComponent(CPArray::Color0 + i, vtx_desc.low.Position, offset, vertex_size, ProcessVertexComponent(CPArray::Color0 + i, vtx_desc.low.Color[i], offset, vertex_size,
num_vertices, vertex_data); num_vertices, vertex_data);
offset += color_size; offset += color_size;
} }
@ -114,7 +114,7 @@ void FifoRecorder::FifoRecordAnalyzer::OnPrimitiveCommand(OpcodeDecoder::Primiti
{ {
const u32 tc_size = VertexLoader_TextCoord::GetSize( const u32 tc_size = VertexLoader_TextCoord::GetSize(
vtx_desc.high.TexCoord[i], vtx_attr.GetTexFormat(i), vtx_attr.GetTexElements(i)); vtx_desc.high.TexCoord[i], vtx_attr.GetTexFormat(i), vtx_attr.GetTexElements(i));
ProcessVertexComponent(CPArray::TexCoord0 + i, vtx_desc.low.Position, offset, vertex_size, ProcessVertexComponent(CPArray::TexCoord0 + i, vtx_desc.high.TexCoord[i], offset, vertex_size,
num_vertices, vertex_data); num_vertices, vertex_data);
offset += tc_size; offset += tc_size;
} }