gl_add_lut can now become a static function inside gl.c

This commit is contained in:
twinaphex 2019-02-02 21:34:02 +01:00
parent 90f1317498
commit 350b0dd1a2
3 changed files with 48 additions and 55 deletions

View File

@ -148,51 +148,3 @@ void gl_load_texture_data(
if (want_mipmap && have_mipmap)
glGenerateMipmap(GL_TEXTURE_2D);
}
bool gl_add_lut(
const char *lut_path,
bool lut_mipmap,
unsigned lut_filter,
enum gfx_wrap_type lut_wrap_type,
unsigned i, void *textures_data)
{
struct texture_image img;
GLuint *textures_lut = (GLuint*)textures_data;
enum texture_filter_type filter_type = TEXTURE_FILTER_LINEAR;
img.width = 0;
img.height = 0;
img.pixels = NULL;
img.supports_rgba = video_driver_supports_rgba();
if (!image_texture_load(&img, lut_path))
{
RARCH_ERR("[GL]: Failed to load texture image from: \"%s\"\n",
lut_path);
return false;
}
RARCH_LOG("[GL]: Loaded texture image from: \"%s\" ...\n",
lut_path);
if (lut_filter == RARCH_FILTER_NEAREST)
filter_type = TEXTURE_FILTER_NEAREST;
if (lut_mipmap)
{
if (filter_type == TEXTURE_FILTER_NEAREST)
filter_type = TEXTURE_FILTER_MIPMAP_NEAREST;
else
filter_type = TEXTURE_FILTER_MIPMAP_LINEAR;
}
gl_load_texture_data(
textures_lut[i],
lut_wrap_type,
filter_type, 4,
img.width, img.height,
img.pixels, sizeof(uint32_t));
image_texture_free(&img);
return true;
}

View File

@ -408,13 +408,6 @@ static INLINE bool gl_set_core_context(enum retro_hw_context_type ctx_type)
return true;
}
bool gl_add_lut(
const char *lut_path,
bool lut_mipmap,
unsigned lut_filter,
enum gfx_wrap_type lut_wrap_type,
unsigned i, void *textures_data);
bool gl_load_luts(
const void *shader_data,
GLuint *textures_lut);

View File

@ -128,6 +128,54 @@ void context_bind_hw_render(void *data, bool enable)
gl_context_bind_hw_render(gl, enable);
}
static bool gl_add_lut(
const char *lut_path,
bool lut_mipmap,
unsigned lut_filter,
enum gfx_wrap_type lut_wrap_type,
unsigned i, void *textures_data)
{
struct texture_image img;
GLuint *textures_lut = (GLuint*)textures_data;
enum texture_filter_type filter_type = TEXTURE_FILTER_LINEAR;
img.width = 0;
img.height = 0;
img.pixels = NULL;
img.supports_rgba = video_driver_supports_rgba();
if (!image_texture_load(&img, lut_path))
{
RARCH_ERR("[GL]: Failed to load texture image from: \"%s\"\n",
lut_path);
return false;
}
RARCH_LOG("[GL]: Loaded texture image from: \"%s\" ...\n",
lut_path);
if (lut_filter == RARCH_FILTER_NEAREST)
filter_type = TEXTURE_FILTER_NEAREST;
if (lut_mipmap)
{
if (filter_type == TEXTURE_FILTER_NEAREST)
filter_type = TEXTURE_FILTER_MIPMAP_NEAREST;
else
filter_type = TEXTURE_FILTER_MIPMAP_LINEAR;
}
gl_load_texture_data(
textures_lut[i],
lut_wrap_type,
filter_type, 4,
img.width, img.height,
img.pixels, sizeof(uint32_t));
image_texture_free(&img);
return true;
}
bool gl_load_luts(
const void *shader_data,
GLuint *textures_lut)