1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

rsx: Enable primitive restart index only when needed (#6889)

* rsx: Enable primitive restart index only when needed

* rsx: Use if with initializer in read_put()
This commit is contained in:
Eladash 2019-10-28 22:16:27 +02:00 committed by Ivan
parent 83cf6e6fa3
commit 42fc698186
5 changed files with 31 additions and 35 deletions

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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,

View File

@ -3357,7 +3357,7 @@ struct registers_decoder<NV4097_SET_INDEX_ARRAY_DMA>
private:
u32 value;
u32 type_raw() const { return bf_decoder<4, 28>(value); }
u8 type_raw() const { return bf_decoder<4, 8>(value); }
public:
decoded_type(u32 value) : value(value) {}
@ -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());
}
};

View File

@ -665,9 +665,14 @@ 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
@ -675,6 +680,22 @@ namespace rsx
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);
@ -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)