code: Add texture sampling option (#7118)

* This replaces the nearest neighbour filter that shouldn't have existed in the first place
This commit is contained in:
GPUCode 2023-11-23 02:04:47 +02:00 committed by GitHub
parent c17ec1d1aa
commit 85bd1be852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 110 additions and 59 deletions

View file

@ -46,8 +46,6 @@ std::string_view GetTextureFilterName(TextureFilter filter) {
return "Anime4K";
case TextureFilter::Bicubic:
return "Bicubic";
case TextureFilter::NearestNeighbor:
return "NearestNeighbor";
case TextureFilter::ScaleForce:
return "ScaleForce";
case TextureFilter::xBRZ:
@ -59,6 +57,19 @@ std::string_view GetTextureFilterName(TextureFilter filter) {
}
}
std::string_view GetTextureSamplingName(TextureSampling sampling) {
switch (sampling) {
case TextureSampling::GameControlled:
return "GameControlled";
case TextureSampling::NearestNeighbor:
return "NearestNeighbor";
case TextureSampling::Linear:
return "Linear";
default:
return "Invalid";
}
}
} // Anonymous namespace
Values values = {};
@ -87,6 +98,8 @@ void LogSettings() {
log_setting("Renderer_PostProcessingShader", values.pp_shader_name.GetValue());
log_setting("Renderer_FilterMode", values.filter_mode.GetValue());
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
log_setting("Renderer_TextureSampling",
GetTextureSamplingName(values.texture_sampling.GetValue()));
log_setting("Stereoscopy_Render3d", values.render_3d.GetValue());
log_setting("Stereoscopy_Factor3d", values.factor_3d.GetValue());
log_setting("Stereoscopy_MonoRenderOption", values.mono_render_option.GetValue());
@ -175,6 +188,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.resolution_factor.SetGlobal(true);
values.frame_limit.SetGlobal(true);
values.texture_filter.SetGlobal(true);
values.texture_sampling.SetGlobal(true);
values.layout_option.SetGlobal(true);
values.swap_screen.SetGlobal(true);
values.upright_screen.SetGlobal(true);

View file

@ -72,10 +72,15 @@ enum class TextureFilter : u32 {
None = 0,
Anime4K = 1,
Bicubic = 2,
NearestNeighbor = 3,
ScaleForce = 4,
xBRZ = 5,
MMPX = 6
ScaleForce = 3,
xBRZ = 4,
MMPX = 5,
};
enum class TextureSampling : u32 {
GameControlled = 0,
NearestNeighbor = 1,
Linear = 2,
};
namespace NativeButton {
@ -451,6 +456,8 @@ struct Values {
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, "resolution_factor"};
SwitchableSetting<u16, true> frame_limit{100, 0, 1000, "frame_limit"};
SwitchableSetting<TextureFilter> texture_filter{TextureFilter::None, "texture_filter"};
SwitchableSetting<TextureSampling> texture_sampling{TextureSampling::GameControlled,
"texture_sampling"};
SwitchableSetting<LayoutOption> layout_option{LayoutOption::Default, "layout_option"};
SwitchableSetting<bool> swap_screen{false, "swap_screen"};