Remove some toggles for tests + phi testing changes

This commit is contained in:
CamilleLaVey
2026-09-06 03:34:34 -04:00
parent 6c87c031a2
commit b858e52f0a
10 changed files with 60 additions and 76 deletions
@@ -30,8 +30,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"), RENDERER_REACTIVE_FLUSHING("use_reactive_flushing"),
ENABLE_BUFFER_HISTORY("enable_buffer_history"), ENABLE_BUFFER_HISTORY("enable_buffer_history"),
USE_OPTIMIZED_VERTEX_BUFFERS("use_optimized_vertex_buffers"), 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_SHADER_PHI_TRACKING("enable_shader_phi_tracking"),
ENABLE_GPU_BUFFER_READBACK("enable_gpu_buffer_readback"), ENABLE_GPU_BUFFER_READBACK("enable_gpu_buffer_readback"),
SYNC_MEMORY_OPERATIONS("sync_memory_operations"), SYNC_MEMORY_OPERATIONS("sync_memory_operations"),
@@ -927,20 +927,6 @@ abstract class SettingsItem(
descriptionId = R.string.use_optimized_vertex_buffers_description 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( put(
SwitchSetting( SwitchSetting(
BooleanSetting.ENABLE_SHADER_PHI_TRACKING, BooleanSetting.ENABLE_SHADER_PHI_TRACKING,
@@ -338,8 +338,6 @@ class SettingsFragmentPresenter(
add(BooleanSetting.ENABLE_BUFFER_HISTORY.key) add(BooleanSetting.ENABLE_BUFFER_HISTORY.key)
add(BooleanSetting.ENABLE_GPU_BUFFER_READBACK.key) add(BooleanSetting.ENABLE_GPU_BUFFER_READBACK.key)
add(BooleanSetting.USE_OPTIMIZED_VERTEX_BUFFERS.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(BooleanSetting.ENABLE_SHADER_PHI_TRACKING.key)
add(HeaderSetting(R.string.hacks)) 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="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">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="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">Shader Phi Tracking</string>
<string name="enable_shader_phi_tracking_description">toggle for test on shader phi tracking.</string> <string name="enable_shader_phi_tracking_description">toggle for test on shader phi tracking.</string>
-16
View File
@@ -592,22 +592,6 @@ struct Values {
true, true,
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, SwitchableSetting<bool> enable_shader_phi_tracking{linkage,
true, true,
"enable_shader_phi_tracking", "enable_shader_phi_tracking",
@@ -267,10 +267,6 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent) {
INSERT(Settings, enable_buffer_history, tr("Enable buffer history"), INSERT(Settings, enable_buffer_history, tr("Enable buffer history"),
tr("Enables access to previous buffer states.\nThis option may improve rendering " tr("Enables access to previous buffer states.\nThis option may improve rendering "
"quality and performance consistency in some games.")); "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"), INSERT(Settings, enable_shader_phi_tracking, tr("Shader phi tracking"),
tr("toggle for test on 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.")); INSERT(Settings, fix_bloom_effects, tr("Fix bloom effects"), tr("Removes bloom in Burnout."));
+58 -21
View File
@@ -320,44 +320,86 @@ bool IsSameConstBufferAddr(const ConstBufferAddr& lhs, const ConstBufferAddr& rh
lhs.has_secondary == rhs.has_secondary && lhs.dynamic_offset == rhs.dynamic_offset; 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, 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; std::optional<ConstBufferAddr> agreed;
bool failed = false;
const size_t num_args{phi->NumArgs()}; const size_t num_args{phi->NumArgs()};
for (size_t index = 0; index < num_args; ++index) { for (size_t index = 0; index < num_args; ++index) {
const IR::Value arg{phi->Arg(index).Resolve()}; const IR::Value arg{phi->Arg(index).Resolve()};
if (arg.IsImmediate()) { if (arg.IsImmediate()) {
ambiguous = true; failed = true;
return std::nullopt; break;
} }
const IR::Inst* arg_inst{arg.InstRecursive()}; const IR::Inst* arg_inst{arg.InstRecursive()};
if (arg_inst == phi) { if (arg_inst == phi) {
continue; continue;
} }
if (arg_inst->GetOpcode() == IR::Opcode::Phi) { if (std::ranges::find(state.active, arg_inst) != state.active.end()) {
ambiguous = true; continue;
return std::nullopt;
} }
const std::optional<ConstBufferAddr> operand{TrackCached(arg, env, host_info)}; bool operand_ambiguous = false;
if (!operand) { const std::optional<ConstBufferAddr> operand{
ambiguous = true; TrackUncached(arg, env, host_info, state, operand_ambiguous)};
return std::nullopt; if (!operand || operand_ambiguous) {
failed = true;
break;
} }
if (!agreed) { if (!agreed) {
agreed = operand; agreed = operand;
continue; continue;
} }
if (!IsSameConstBufferAddr(*agreed, *operand)) { if (!IsSameConstBufferAddr(*agreed, *operand)) {
ambiguous = true; failed = true;
return std::nullopt; break;
} }
} }
if (!agreed) {
--state.depth;
state.active.pop_back();
if (failed || !agreed) {
ambiguous = true; ambiguous = true;
return std::nullopt;
} }
return agreed; 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) { std::optional<ConstBufferAddr> Track(const IR::Value& value, Environment& env, const HostTranslateInfo& host_info) {
if (!Settings::values.enable_shader_phi_tracking.GetValue()) { if (!Settings::values.enable_shader_phi_tracking.GetValue()) {
return IR::BreadthFirstSearch( return IR::BreadthFirstSearch(
@@ -365,15 +407,10 @@ std::optional<ConstBufferAddr> Track(const IR::Value& value, Environment& env, c
return TryGetConstBuffer(inst, env, host_info); return TryGetConstBuffer(inst, env, host_info);
}); });
} }
PhiTrackState state;
bool ambiguous = false; bool ambiguous = false;
const std::optional<ConstBufferAddr> result{IR::BreadthFirstSearch( const std::optional<ConstBufferAddr> result{
value, [&env, &host_info, &ambiguous](const IR::Inst* inst) TrackUncached(value, env, host_info, state, ambiguous)};
-> std::optional<ConstBufferAddr> {
if (inst->GetOpcode() == IR::Opcode::Phi) {
return TrackPhi(inst, env, host_info, ambiguous);
}
return TryGetConstBuffer(inst, env, host_info);
})};
if (ambiguous) { if (ambiguous) {
return std::nullopt; return std::nullopt;
} }
+1 -7
View File
@@ -114,10 +114,7 @@ void BufferCache<P>::TickFrame() {
template <class P> template <class P>
void BufferCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t size) { void BufferCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t size) {
if constexpr (requires { runtime.SupportsMultiRange(); }) { if constexpr (requires { runtime.BindMultiRangeStorageBuffer(u64{}); }) {
if (!runtime.SupportsMultiRange()) {
return;
}
virtual_ranges.Unmap(as_id, gpu_addr, size); 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_first = 0;
binding.segment_count = 0; binding.segment_count = 0;
if constexpr (requires { runtime.BindMultiRangeStorageBuffer(u64{}); }) { if constexpr (requires { runtime.BindMultiRangeStorageBuffer(u64{}); }) {
if (!runtime.SupportsMultiRange()) {
return;
}
if (binding.gpu_addr == 0 || binding.size == 0) { if (binding.gpu_addr == 0 || binding.size == 0) {
return; return;
} }
@@ -175,10 +175,6 @@ public:
return multi_range_buffers.BlockSize(); return multi_range_buffers.BlockSize();
} }
[[nodiscard]] bool SupportsMultiRange() const noexcept {
return Settings::values.enable_multi_range_storage.GetValue();
}
[[nodiscard]] bool PrefersSparseSources() const noexcept { [[nodiscard]] bool PrefersSparseSources() const noexcept {
return multi_range_buffers.UsesSparse(); return multi_range_buffers.UsesSparse();
} }
@@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings.h"
#include "video_core/vulkan_common/vulkan_memory_allocator.h" #include "video_core/vulkan_common/vulkan_memory_allocator.h"
#include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/vulkan_common/vulkan_wrapper.h"
@@ -45,7 +44,7 @@ public:
MultiRangeBufferCache& operator=(const MultiRangeBufferCache&) = delete; MultiRangeBufferCache& operator=(const MultiRangeBufferCache&) = delete;
[[nodiscard]] bool UsesSparse() const noexcept { [[nodiscard]] bool UsesSparse() const noexcept {
return use_sparse && Settings::values.enable_sparse_buffer_binding.GetValue(); return use_sparse;
} }
[[nodiscard]] VkDeviceSize BlockSize() const noexcept { [[nodiscard]] VkDeviceSize BlockSize() const noexcept {