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

rsx: Use constexpr for flattening_helper::m_register_properties

This commit is contained in:
scribam 2019-06-02 19:51:25 +02:00 committed by Ani
parent d6db61c594
commit 65581acbf9
2 changed files with 30 additions and 46 deletions

View File

@ -4,12 +4,6 @@
#include "RSXThread.h"
#include "Capture/rsx_capture.h"
extern rsx::frame_capture_data frame_capture;
extern bool user_asked_for_frame_capture;
extern bool capture_current_frame;
#define ENABLE_OPTIMIZATION_DEBUGGING 0
namespace rsx
{
namespace FIFO
@ -185,28 +179,6 @@ namespace rsx
data.set(cmd & 0xfffc, vm::read32(m_args_ptr));
}
flattening_helper::flattening_helper()
{
const std::pair<u32, u32> ignorable_ranges[] =
{
// General
{ NV4097_INVALIDATE_VERTEX_FILE, 3 }, // PSLight clears VERTEX_FILE[0-2]
{ NV4097_INVALIDATE_VERTEX_CACHE_FILE, 1 },
{ NV4097_INVALIDATE_L2, 1 },
{ NV4097_INVALIDATE_ZCULL, 1 }
};
std::fill(m_register_properties.begin(), m_register_properties.end(), 0u);
for (const auto &method : ignorable_ranges)
{
for (u32 i = 0; i < method.second; ++i)
{
m_register_properties[method.first + i] |= register_props::always_ignore;
}
}
}
void flattening_helper::reset(bool _enabled)
{
enabled = _enabled;
@ -336,8 +308,7 @@ namespace rsx
{
if (UNLIKELY(draw_count))
{
const auto props = m_register_properties[reg];
if (UNLIKELY(props & register_props::always_ignore))
if (UNLIKELY(m_register_properties[reg] & register_props::always_ignore))
{
// Always ignore
command.reg = FIFO_DISABLED_COMMAND;

View File

@ -2,23 +2,10 @@
#include <Utilities/types.h>
#include <Utilities/Atomic.h>
#include <Utilities/mutex.h>
#include <Utilities/Thread.h>
#include "rsx_utils.h"
#include "Emu/Cell/lv2/sys_rsx.h"
#include <vector>
#include <string>
#include <memory>
#include <unordered_map>
#ifndef __unused
#define __unused(expression) do { (void)(expression); } while(0)
#endif
struct RsxDmaControl;
namespace rsx
{
class thread;
@ -72,7 +59,33 @@ namespace rsx
application_not_compatible
};
std::array<u8, 0x10000 / 4> m_register_properties;
// Workaround for MSVC, C2248
static constexpr u8 register_props_always_ignore = register_props::always_ignore;
static constexpr std::array<u8, 0x10000 / 4> m_register_properties = []
{
constexpr std::array<std::pair<u32, u32>, 4> ignorable_ranges =
{{
// General
{ NV4097_INVALIDATE_VERTEX_FILE, 3 }, // PSLight clears VERTEX_FILE[0-2]
{ NV4097_INVALIDATE_VERTEX_CACHE_FILE, 1 },
{ NV4097_INVALIDATE_L2, 1 },
{ NV4097_INVALIDATE_ZCULL, 1 }
}};
std::array<u8, 0x10000 / 4> register_properties{};
for (const auto &method : ignorable_ranges)
{
for (u32 i = 0; i < method.second; ++i)
{
register_properties[method.first + i] |= register_props_always_ignore;
}
}
return register_properties;
}();
u32 deferred_primitive = 0;
u32 draw_count = 0;
u32 begin_end_ctr = 0;
@ -84,8 +97,8 @@ namespace rsx
void reset(bool _enabled);
public:
flattening_helper();
~flattening_helper() {}
flattening_helper() = default;
~flattening_helper() = default;
u32 get_primitive() const { return deferred_primitive; }
bool is_enabled() const { return enabled; }