Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: Enable primitive restart index only when needed #6889

Merged
merged 9 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions rpcs3/Emu/RSX/RSXFIFO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ namespace rsx
}
else
{
u32 put = m_ctrl->put;
if (LIKELY((put & 3) == 0))
if (u32 put = m_ctrl->put; LIKELY((put & 3) == 0))
{
return put;
}
else
{
return m_ctrl->put.and_fetch(~3);
}

return m_ctrl->put.and_fetch(~3);
}
}

Expand Down
10 changes: 0 additions & 10 deletions rpcs3/Emu/RSX/gcm_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
fmt::throw_exception("Unknown vertex base type %d" HERE, in);
}

rsx::index_array_type rsx::to_index_array_type(u8 in)
{
switch (in)
{
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_32: return rsx::index_array_type::u32;
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_16: return rsx::index_array_type::u16;
}
fmt::throw_exception("Unknown index array type %d" HERE, in);
}

rsx::primitive_type rsx::to_primitive_type(u8 in)
{
switch (in)
Expand Down
6 changes: 2 additions & 4 deletions rpcs3/Emu/RSX/gcm_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ namespace rsx

enum class index_array_type : u8
{
u32,
u16,
u32 = 0, // CELL_GCM_DRAW_INDEX_ARRAY_TYPE_32
u16 = 1, // CELL_GCM_DRAW_INDEX_ARRAY_TYPE_16
};

index_array_type to_index_array_type(u8 in);

enum class primitive_type : u8
{
invalid,
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/RSX/rsx_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3369,8 +3369,8 @@ struct registers_decoder<NV4097_SET_INDEX_ARRAY_DMA>

index_array_type type() const
{
// Why truncate??
return to_index_array_type(static_cast<u8>(type_raw()));
// Must be a valid value
return static_cast<index_array_type>(type_raw());
}
};

Expand Down
35 changes: 23 additions & 12 deletions rpcs3/Emu/RSX/rsx_methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,37 @@ namespace rsx
return decode<NV4097_SET_STENCIL_TEST_ENABLE>().stencil_test_enabled();
}

bool restart_index_enabled() const
u8 index_array_location() const
{
return decode<NV4097_SET_RESTART_INDEX_ENABLE>().restart_index_enabled();
return decode<NV4097_SET_INDEX_ARRAY_DMA>().index_dma();
}

rsx::index_array_type index_type() const
{
return decode<NV4097_SET_INDEX_ARRAY_DMA>().type();
}

u32 restart_index() const
{
return decode<NV4097_SET_RESTART_INDEX>().restart_index();
}

bool restart_index_enabled_raw() const
{
return decode<NV4097_SET_RESTART_INDEX_ENABLE>().restart_index_enabled();
}

bool restart_index_enabled() const
{
if (!restart_index_enabled_raw())
{
return false;

}

return restart_index() <= (index_type() == rsx::index_array_type::u16 ? 0xffff : 0xfffff);
}

u32 z_clear_value(bool is_depth_stencil) const
{
return decode<NV4097_SET_ZSTENCIL_CLEAR_VALUE>().clear_z(is_depth_stencil);
Expand All @@ -695,16 +716,6 @@ namespace rsx
return decode<NV4097_SET_FOG_PARAMS + 1>().fog_param_1();
}

u8 index_array_location() const
{
return decode<NV4097_SET_INDEX_ARRAY_DMA>().index_dma();
}

rsx::index_array_type index_type() const
{
return decode<NV4097_SET_INDEX_ARRAY_DMA>().type();
}

bool color_mask_b(int index) const
{
if (index == 0)
Expand Down