From 9b67d0ad8be408269cbc67da92f5316973c7f56b Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sun, 27 Jan 2019 20:14:28 -0600 Subject: [PATCH] Shaders: Use mipmap_input flag. --- shaders/glsl.cpp | 6 ++++++ shaders/glsl.h | 1 + 2 files changed, 7 insertions(+) diff --git a/shaders/glsl.cpp b/shaders/glsl.cpp index a53f390c..ebde6140 100644 --- a/shaders/glsl.cpp +++ b/shaders/glsl.cpp @@ -185,6 +185,9 @@ bool GLSLShader::load_shader_preset_file(char *filename) sprintf(key, "::wrap_mode%u", i); pass.wrap_mode = wrap_mode_string_to_enum (conf.GetString (key ,"")); + sprintf(key, "::mipmap_input%u", i); + pass.mipmap_input = conf.GetBool (key); + sprintf(key, "::frame_count_mod%u", i); pass.frame_count_mod = conf.GetInt(key, 0); @@ -731,6 +734,9 @@ void GLSLShader::render(GLuint &orig, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, pass[i].wrap_mode); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, pass[i].wrap_mode); + if (pass[i].mipmap_input) + glGenerateMipmap(GL_TEXTURE_2D); + glUseProgram(pass[i].program); #ifdef USE_SLANG if (using_slang) diff --git a/shaders/glsl.h b/shaders/glsl.h index bb2d5cfc..19bebfee 100644 --- a/shaders/glsl.h +++ b/shaders/glsl.h @@ -118,6 +118,7 @@ typedef struct GLuint width; GLuint height; GLuint filter; + bool mipmap_input; GLSLUniforms unif; #ifdef USE_SLANG