port: add texture filter setting

This commit is contained in:
fgsfds 2023-08-19 13:56:15 +02:00
parent 63a5701906
commit 2f54ceb96e
4 changed files with 7 additions and 2 deletions

View File

@ -744,7 +744,7 @@ static uint32_t gfx_cm_to_opengl(uint32_t val) {
}
static void gfx_opengl_set_sampler_parameters(int tile, bool linear_filter, uint32_t cms, uint32_t cmt) {
const GLint filter = linear_filter && current_filter_mode == FILTER_LINEAR ? GL_LINEAR : GL_NEAREST;
const GLint filter = linear_filter && (current_filter_mode != FILTER_NONE) ? GL_LINEAR : GL_NEAREST;
glActiveTexture(GL_TEXTURE0 + tile);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);

View File

@ -12,7 +12,7 @@ struct GfxClipParameters {
bool invert_y;
};
enum FilteringMode { FILTER_THREE_POINT, FILTER_LINEAR, FILTER_NONE };
enum FilteringMode { FILTER_NONE, FILTER_LINEAR, FILTER_THREE_POINT };
struct GfxRenderingAPI {
const char* (*get_name)(void);

View File

@ -33,6 +33,7 @@ struct configentry {
{ "Video.VSync", CONFIG_S32, { .s32val = 1 } },
{ "Video.FramerateLimit", CONFIG_S32, { .s32val = 0 } },
{ "Video.FovY", CONFIG_F32, { .f32val = 60.f } },
{ "Video.TextureFilter", CONFIG_S32, { .s32val = 1 } },
/* Audio */
{ "Audio.BufferSize", CONFIG_S32, { .s32val = 512 } },
{ "Audio.QueueLimit", CONFIG_S32, { .s32val = 8192 } },

View File

@ -41,6 +41,10 @@ s32 videoInit(void)
wmAPI->set_swap_interval(configGetInt("Video.VSync", 1));
wmAPI->set_target_fps(configGetInt("Video.FramerateLimit", 0)); // disabled because vsync is on
u32 filter = configGetInt("Video.TextureFilter", FILTER_LINEAR);
if (filter > FILTER_THREE_POINT) filter = FILTER_THREE_POINT;
renderingAPI->set_texture_filter((enum FilteringMode)filter);
initDone = true;
return 0;
}