Fixed a bug with readback_resolve and readback_memexport that was responsible for a large portion of their overhead. readback_memexport and resolve are now usable for games, depending on your hardware. in my case games that were slideshows now run at like 20-30 fps, and my hardware isnt the best for xenia.
add split_map class for mapping keys to values in a way that optimizes for frequent searches and infrequent insertions/removals remove jump table implementation of GetColorRenderTargetFormatComponentCount, it was appearing relatively high in profiles. instead pack the component counts into a single 32 bit word, which is indexed by shifting Add cvar to align all basic blocks to a boundary Add mmio aware load paths liberally apply XE_RESTRICT in ringbuffer related code Removed the IS_TRUE and IS_FALSE opcodes, they were pointless duplicates of COMPARE_EQ/COMPARE_NE and i want to simplify our set of opcodes for future backends More work on LVSR/LVSL/STVR/STVL opcodes Optimized X64 translated code emission, now only compute instrkey once Add code for pre-computing integer division magic numbers Optimized GetHostViewportInfo a little Move args for GetHostViewportInfo into a class, cache the result and compare for future queries. moved GetHostViewportInfo far lower on the profile Add (currently not functional, and very racy) asynchronous memcpy code. will improve it and actually use it in future commits. Add non-temporal memcpy function for huge page-aligned allocations. Used for copying to shared memory/readback hoist are_accumulated_render_targets_valid_ check out of loop in render_target_cache already bound check. Add stosb/movsb code for small constant memcpys/memsets that arent worth the overhead of memcpy/memset
This commit is contained in:
87
src/xenia/base/split_map.h
Normal file
87
src/xenia/base/split_map.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2019 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_BASE_SPLIT_MAP_H_
|
||||
#define XENIA_BASE_SPLIT_MAP_H_
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
namespace xe {
|
||||
/*
|
||||
a map structure that is optimized for infrequent
|
||||
reallocation/resizing/erasure and frequent searches by key implemented as 2
|
||||
std::vectors, one of the keys and one of the values
|
||||
*/
|
||||
template <typename TKey, typename TValue>
|
||||
class split_map {
|
||||
using key_vector = std::vector<TKey>;
|
||||
using value_vector = std::vector<TValue>;
|
||||
|
||||
key_vector keys_;
|
||||
value_vector values_;
|
||||
|
||||
public:
|
||||
using my_type = split_map<TKey, TValue>;
|
||||
|
||||
uint32_t IndexForKey(const TKey& k) {
|
||||
auto lbound = std::lower_bound(keys_.begin(), keys_.end(), k);
|
||||
return static_cast<uint32_t>(lbound - keys_.begin());
|
||||
}
|
||||
|
||||
uint32_t size() const { return static_cast<uint32_t>(keys_.size()); }
|
||||
key_vector& Keys() { return keys_; }
|
||||
value_vector& Values() { return values_; }
|
||||
void clear() {
|
||||
keys_.clear();
|
||||
values_.clear();
|
||||
}
|
||||
void resize(uint32_t new_size) {
|
||||
keys_.resize(static_cast<size_t>(new_size));
|
||||
values_.resize(static_cast<size_t>(new_size));
|
||||
}
|
||||
|
||||
void reserve(uint32_t new_size) {
|
||||
keys_.reserve(static_cast<size_t>(new_size));
|
||||
values_.reserve(static_cast<size_t>(new_size));
|
||||
}
|
||||
const TKey* KeyAt(uint32_t index) const {
|
||||
if (index == size()) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return &keys_[index];
|
||||
}
|
||||
}
|
||||
const TValue* ValueAt(uint32_t index) const {
|
||||
if (index == size()) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return &values_[index];
|
||||
}
|
||||
}
|
||||
|
||||
void InsertAt(TKey k, TValue v, uint32_t idx) {
|
||||
uint32_t old_size = size();
|
||||
|
||||
bool needs_shiftup = idx != old_size;
|
||||
|
||||
values_.insert(values_.begin() + idx, v);
|
||||
keys_.insert(keys_.begin() + idx, k);
|
||||
}
|
||||
void EraseAt(uint32_t idx) {
|
||||
uint32_t old_size = size();
|
||||
if (idx == old_size) {
|
||||
return; // trying to erase nonexistent entry
|
||||
} else {
|
||||
values_.erase(values_.begin() + idx);
|
||||
keys_.erase(keys_.begin() + idx);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_BASE_SPLIT_MAP_H_
|
||||
Reference in New Issue
Block a user