mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-06 12:13:57 +00:00
Remove some toggles for tests + phi testing changes
This commit is contained in:
-2
@@ -30,8 +30,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
||||
RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"),
|
||||
ENABLE_BUFFER_HISTORY("enable_buffer_history"),
|
||||
USE_OPTIMIZED_VERTEX_BUFFERS("use_optimized_vertex_buffers"),
|
||||
ENABLE_MULTI_RANGE_STORAGE("enable_multi_range_storage"),
|
||||
ENABLE_SPARSE_BUFFER_BINDING("enable_sparse_buffer_binding"),
|
||||
ENABLE_SHADER_PHI_TRACKING("enable_shader_phi_tracking"),
|
||||
ENABLE_GPU_BUFFER_READBACK("enable_gpu_buffer_readback"),
|
||||
SYNC_MEMORY_OPERATIONS("sync_memory_operations"),
|
||||
|
||||
-14
@@ -927,20 +927,6 @@ abstract class SettingsItem(
|
||||
descriptionId = R.string.use_optimized_vertex_buffers_description
|
||||
)
|
||||
)
|
||||
put(
|
||||
SwitchSetting(
|
||||
BooleanSetting.ENABLE_MULTI_RANGE_STORAGE,
|
||||
titleId = R.string.enable_multi_range_storage,
|
||||
descriptionId = R.string.enable_multi_range_storage_description
|
||||
)
|
||||
)
|
||||
put(
|
||||
SwitchSetting(
|
||||
BooleanSetting.ENABLE_SPARSE_BUFFER_BINDING,
|
||||
titleId = R.string.enable_sparse_buffer_binding,
|
||||
descriptionId = R.string.enable_sparse_buffer_binding_description
|
||||
)
|
||||
)
|
||||
put(
|
||||
SwitchSetting(
|
||||
BooleanSetting.ENABLE_SHADER_PHI_TRACKING,
|
||||
|
||||
-2
@@ -338,8 +338,6 @@ class SettingsFragmentPresenter(
|
||||
add(BooleanSetting.ENABLE_BUFFER_HISTORY.key)
|
||||
add(BooleanSetting.ENABLE_GPU_BUFFER_READBACK.key)
|
||||
add(BooleanSetting.USE_OPTIMIZED_VERTEX_BUFFERS.key)
|
||||
add(BooleanSetting.ENABLE_MULTI_RANGE_STORAGE.key)
|
||||
add(BooleanSetting.ENABLE_SPARSE_BUFFER_BINDING.key)
|
||||
add(BooleanSetting.ENABLE_SHADER_PHI_TRACKING.key)
|
||||
|
||||
add(HeaderSetting(R.string.hacks))
|
||||
|
||||
@@ -570,10 +570,6 @@
|
||||
<string name="enable_gpu_buffer_readback_description">Preserves GPU-modified buffer data by reading it back before uploads. Some games require this to render certain effects properly. May cause issues if the hardware cannot handle the additional workload.</string>
|
||||
<string name="use_optimized_vertex_buffers">Optimized Vertex Buffers</string>
|
||||
<string name="use_optimized_vertex_buffers_description">Enables optimized vertex buffer binding for improved performance. Requires Mesa 26.0+ Turnip drivers/ QCOM drivers. Will crash on older Turnip drivers (25.3 and below).</string>
|
||||
<string name="enable_multi_range_storage">Multi-Range Storage Buffers</string>
|
||||
<string name="enable_multi_range_storage_description">toggle for test on multi-range.</string>
|
||||
<string name="enable_sparse_buffer_binding">Sparse Buffer Binding</string>
|
||||
<string name="enable_sparse_buffer_binding_description">toggle for test on sparse buffer binding.</string>
|
||||
<string name="enable_shader_phi_tracking">Shader Phi Tracking</string>
|
||||
<string name="enable_shader_phi_tracking_description">toggle for test on shader phi tracking.</string>
|
||||
|
||||
|
||||
@@ -592,22 +592,6 @@ struct Values {
|
||||
true,
|
||||
true};
|
||||
|
||||
SwitchableSetting<bool> enable_multi_range_storage{linkage,
|
||||
false,
|
||||
"enable_multi_range_storage",
|
||||
Category::RendererAdvanced,
|
||||
Specialization::Default,
|
||||
true,
|
||||
true};
|
||||
|
||||
SwitchableSetting<bool> enable_sparse_buffer_binding{linkage,
|
||||
false,
|
||||
"enable_sparse_buffer_binding",
|
||||
Category::RendererAdvanced,
|
||||
Specialization::Default,
|
||||
true,
|
||||
true};
|
||||
|
||||
SwitchableSetting<bool> enable_shader_phi_tracking{linkage,
|
||||
true,
|
||||
"enable_shader_phi_tracking",
|
||||
|
||||
@@ -267,10 +267,6 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent) {
|
||||
INSERT(Settings, enable_buffer_history, tr("Enable buffer history"),
|
||||
tr("Enables access to previous buffer states.\nThis option may improve rendering "
|
||||
"quality and performance consistency in some games."));
|
||||
INSERT(Settings, enable_multi_range_storage, tr("Multi-range storage buffers"),
|
||||
tr("toggle for test on multi-range."));
|
||||
INSERT(Settings, enable_sparse_buffer_binding, tr("Sparse buffer binding"),
|
||||
tr("toggle for test on sparse buffer binding."));
|
||||
INSERT(Settings, enable_shader_phi_tracking, tr("Shader phi tracking"),
|
||||
tr("toggle for test on shader phi tracking."));
|
||||
INSERT(Settings, fix_bloom_effects, tr("Fix bloom effects"), tr("Removes bloom in Burnout."));
|
||||
|
||||
@@ -320,44 +320,86 @@ bool IsSameConstBufferAddr(const ConstBufferAddr& lhs, const ConstBufferAddr& rh
|
||||
lhs.has_secondary == rhs.has_secondary && lhs.dynamic_offset == rhs.dynamic_offset;
|
||||
}
|
||||
|
||||
constexpr size_t PHI_TRACK_MAX_DEPTH = 4;
|
||||
|
||||
struct PhiTrackState {
|
||||
boost::container::small_vector<const IR::Inst*, 8> active;
|
||||
size_t depth{};
|
||||
};
|
||||
|
||||
std::optional<ConstBufferAddr> TrackUncached(const IR::Value& value, Environment& env,
|
||||
const HostTranslateInfo& host_info,
|
||||
PhiTrackState& state, bool& ambiguous);
|
||||
|
||||
std::optional<ConstBufferAddr> TrackPhi(const IR::Inst* phi, Environment& env,
|
||||
const HostTranslateInfo& host_info, bool& ambiguous) {
|
||||
const HostTranslateInfo& host_info, PhiTrackState& state,
|
||||
bool& ambiguous) {
|
||||
if (state.depth >= PHI_TRACK_MAX_DEPTH) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
}
|
||||
if (std::ranges::find(state.active, phi) != state.active.end()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
state.active.push_back(phi);
|
||||
++state.depth;
|
||||
|
||||
std::optional<ConstBufferAddr> agreed;
|
||||
bool failed = false;
|
||||
const size_t num_args{phi->NumArgs()};
|
||||
for (size_t index = 0; index < num_args; ++index) {
|
||||
const IR::Value arg{phi->Arg(index).Resolve()};
|
||||
if (arg.IsImmediate()) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
const IR::Inst* arg_inst{arg.InstRecursive()};
|
||||
if (arg_inst == phi) {
|
||||
continue;
|
||||
}
|
||||
if (arg_inst->GetOpcode() == IR::Opcode::Phi) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
if (std::ranges::find(state.active, arg_inst) != state.active.end()) {
|
||||
continue;
|
||||
}
|
||||
const std::optional<ConstBufferAddr> operand{TrackCached(arg, env, host_info)};
|
||||
if (!operand) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
bool operand_ambiguous = false;
|
||||
const std::optional<ConstBufferAddr> operand{
|
||||
TrackUncached(arg, env, host_info, state, operand_ambiguous)};
|
||||
if (!operand || operand_ambiguous) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
if (!agreed) {
|
||||
agreed = operand;
|
||||
continue;
|
||||
}
|
||||
if (!IsSameConstBufferAddr(*agreed, *operand)) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!agreed) {
|
||||
|
||||
--state.depth;
|
||||
state.active.pop_back();
|
||||
|
||||
if (failed || !agreed) {
|
||||
ambiguous = true;
|
||||
return std::nullopt;
|
||||
}
|
||||
return agreed;
|
||||
}
|
||||
|
||||
std::optional<ConstBufferAddr> TrackUncached(const IR::Value& value, Environment& env,
|
||||
const HostTranslateInfo& host_info,
|
||||
PhiTrackState& state, bool& ambiguous) {
|
||||
return IR::BreadthFirstSearch(
|
||||
value, [&env, &host_info, &state, &ambiguous](
|
||||
const IR::Inst* inst) -> std::optional<ConstBufferAddr> {
|
||||
if (inst->GetOpcode() == IR::Opcode::Phi) {
|
||||
return TrackPhi(inst, env, host_info, state, ambiguous);
|
||||
}
|
||||
return TryGetConstBuffer(inst, env, host_info);
|
||||
});
|
||||
}
|
||||
|
||||
std::optional<ConstBufferAddr> Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info) {
|
||||
if (!Settings::values.enable_shader_phi_tracking.GetValue()) {
|
||||
return IR::BreadthFirstSearch(
|
||||
@@ -365,15 +407,10 @@ std::optional<ConstBufferAddr> Track(const IR::Value& value, Environment& env, c
|
||||
return TryGetConstBuffer(inst, env, host_info);
|
||||
});
|
||||
}
|
||||
PhiTrackState state;
|
||||
bool ambiguous = false;
|
||||
const std::optional<ConstBufferAddr> result{IR::BreadthFirstSearch(
|
||||
value, [&env, &host_info, &ambiguous](const IR::Inst* inst)
|
||||
-> std::optional<ConstBufferAddr> {
|
||||
if (inst->GetOpcode() == IR::Opcode::Phi) {
|
||||
return TrackPhi(inst, env, host_info, ambiguous);
|
||||
}
|
||||
return TryGetConstBuffer(inst, env, host_info);
|
||||
})};
|
||||
const std::optional<ConstBufferAddr> result{
|
||||
TrackUncached(value, env, host_info, state, ambiguous)};
|
||||
if (ambiguous) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -114,10 +114,7 @@ void BufferCache<P>::TickFrame() {
|
||||
|
||||
template <class P>
|
||||
void BufferCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t size) {
|
||||
if constexpr (requires { runtime.SupportsMultiRange(); }) {
|
||||
if (!runtime.SupportsMultiRange()) {
|
||||
return;
|
||||
}
|
||||
if constexpr (requires { runtime.BindMultiRangeStorageBuffer(u64{}); }) {
|
||||
virtual_ranges.Unmap(as_id, gpu_addr, size);
|
||||
}
|
||||
}
|
||||
@@ -1014,9 +1011,6 @@ void BufferCache<P>::ResolveMultiRangeStorage(Binding& binding, bool is_written,
|
||||
binding.segment_first = 0;
|
||||
binding.segment_count = 0;
|
||||
if constexpr (requires { runtime.BindMultiRangeStorageBuffer(u64{}); }) {
|
||||
if (!runtime.SupportsMultiRange()) {
|
||||
return;
|
||||
}
|
||||
if (binding.gpu_addr == 0 || binding.size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,10 +175,6 @@ public:
|
||||
return multi_range_buffers.BlockSize();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool SupportsMultiRange() const noexcept {
|
||||
return Settings::values.enable_multi_range_storage.GetValue();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool PrefersSparseSources() const noexcept {
|
||||
return multi_range_buffers.UsesSparse();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/settings.h"
|
||||
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
|
||||
@@ -45,7 +44,7 @@ public:
|
||||
MultiRangeBufferCache& operator=(const MultiRangeBufferCache&) = delete;
|
||||
|
||||
[[nodiscard]] bool UsesSparse() const noexcept {
|
||||
return use_sparse && Settings::values.enable_sparse_buffer_binding.GetValue();
|
||||
return use_sparse;
|
||||
}
|
||||
|
||||
[[nodiscard]] VkDeviceSize BlockSize() const noexcept {
|
||||
|
||||
Reference in New Issue
Block a user