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 "RSXThread.h"
#include "Capture/rsx_capture.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 rsx
{ {
namespace FIFO namespace FIFO
@ -185,28 +179,6 @@ namespace rsx
data.set(cmd & 0xfffc, vm::read32(m_args_ptr)); 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) void flattening_helper::reset(bool _enabled)
{ {
enabled = _enabled; enabled = _enabled;
@ -336,8 +308,7 @@ namespace rsx
{ {
if (UNLIKELY(draw_count)) if (UNLIKELY(draw_count))
{ {
const auto props = m_register_properties[reg]; if (UNLIKELY(m_register_properties[reg] & register_props::always_ignore))
if (UNLIKELY(props & register_props::always_ignore))
{ {
// Always ignore // Always ignore
command.reg = FIFO_DISABLED_COMMAND; command.reg = FIFO_DISABLED_COMMAND;

View File

@ -2,23 +2,10 @@
#include <Utilities/types.h> #include <Utilities/types.h>
#include <Utilities/Atomic.h> #include <Utilities/Atomic.h>
#include <Utilities/mutex.h>
#include <Utilities/Thread.h>
#include "rsx_utils.h" #include "rsx_utils.h"
#include "Emu/Cell/lv2/sys_rsx.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 namespace rsx
{ {
class thread; class thread;
@ -72,7 +59,33 @@ namespace rsx
application_not_compatible 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 deferred_primitive = 0;
u32 draw_count = 0; u32 draw_count = 0;
u32 begin_end_ctr = 0; u32 begin_end_ctr = 0;
@ -84,8 +97,8 @@ namespace rsx
void reset(bool _enabled); void reset(bool _enabled);
public: public:
flattening_helper(); flattening_helper() = default;
~flattening_helper() {} ~flattening_helper() = default;
u32 get_primitive() const { return deferred_primitive; } u32 get_primitive() const { return deferred_primitive; }
bool is_enabled() const { return enabled; } bool is_enabled() const { return enabled; }