Vertex Data base offset/index

Fixed incorrect default value in RSXTexture.
This commit is contained in:
Alexandro Sánchez Bach 2014-08-19 02:10:29 +02:00
parent cf9769fe65
commit 529d0dbbbe
3 changed files with 27 additions and 7 deletions

View File

@ -26,7 +26,7 @@ void RSXTexture::Init()
// Address // Address
methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] = methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] =
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) | ((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
((/*wrapr*/2) << 16) | ((/*gamma*/0) << 20) |((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28)); ((/*wrapr*/3) << 16) | ((/*gamma*/0) << 20) |((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
// Control0 // Control0
methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] = methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] =

View File

@ -73,7 +73,7 @@ void RSXVertexData::Reset()
data.clear(); data.clear();
} }
void RSXVertexData::Load(u32 start, u32 count) void RSXVertexData::Load(u32 start, u32 count, u32 baseOffset, u32 baseIndex=0)
{ {
if(!addr) return; if(!addr) return;
@ -83,7 +83,7 @@ void RSXVertexData::Load(u32 start, u32 count)
for(u32 i=start; i<start + count; ++i) for(u32 i=start; i<start + count; ++i)
{ {
const u8* src = Memory.GetMemFromAddr(addr) + stride * i; const u8* src = Memory.GetMemFromAddr(addr) + baseOffset + stride * (i+baseIndex);
u8* dst = &data[i * tsize * size]; u8* dst = &data[i * tsize * size];
switch(tsize) switch(tsize)
@ -905,6 +905,21 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t args, const u32
} }
break; break;
case NV4097_SET_VERTEX_DATA_BASE_OFFSET:
{
m_vertex_data_base_offset = ARGS(0);
if (count >= 2) {
m_vertex_data_base_index = ARGS(1);
}
}
break;
case NV4097_SET_VERTEX_DATA_BASE_INDEX:
{
m_vertex_data_base_index = ARGS(0);
}
break;
case NV4097_SET_BEGIN_END: case NV4097_SET_BEGIN_END:
{ {
const u32 a0 = ARGS(0); const u32 a0 = ARGS(0);

View File

@ -36,7 +36,7 @@ struct RSXVertexData
void Reset(); void Reset();
bool IsEnabled() const { return size > 0; } bool IsEnabled() const { return size > 0; }
void Load(u32 start, u32 count); void Load(u32 start, u32 count, u32 baseOffset, u32 baseIndex);
u32 GetTypeSize(); u32 GetTypeSize();
}; };
@ -412,6 +412,10 @@ public:
u8 m_shader_window_origin; u8 m_shader_window_origin;
u16 m_shader_window_pixel_centers; u16 m_shader_window_pixel_centers;
// Vertex Data
u32 m_vertex_data_base_offset;
u32 m_vertex_data_base_index;
// Front face // Front face
bool m_set_front_face; bool m_set_front_face;
u32 m_front_face; u32 m_front_face;
@ -505,8 +509,9 @@ protected:
m_line_width = 1.0; m_line_width = 1.0;
m_line_stipple_pattern = 0xffff; m_line_stipple_pattern = 0xffff;
m_line_stipple_factor = 1; m_line_stipple_factor = 1;
for (size_t i = 0; i < 32; i++) m_vertex_data_base_offset = 0;
{ m_vertex_data_base_index = 0;
for (size_t i = 0; i < 32; i++) {
m_polygon_stipple_pattern[i] = 0xFFFFFFFF; m_polygon_stipple_pattern[i] = 0xFFFFFFFF;
} }
@ -624,7 +629,7 @@ protected:
{ {
if(!m_vertex_data[i].IsEnabled()) continue; if(!m_vertex_data[i].IsEnabled()) continue;
m_vertex_data[i].Load(first, count); m_vertex_data[i].Load(first, count, m_vertex_data_base_offset, m_vertex_data_base_index);
} }
} }