Refactor gl_load_texture_data
This commit is contained in:
parent
77f6b98aa9
commit
118ce66dec
|
@ -2783,9 +2783,9 @@ static bool gl_overlay_load(void *data,
|
||||||
* sizeof(uint32_t));
|
* sizeof(uint32_t));
|
||||||
|
|
||||||
gl_load_texture_data(gl->overlay_tex[i],
|
gl_load_texture_data(gl->overlay_tex[i],
|
||||||
&images[i],
|
|
||||||
RARCH_WRAP_EDGE, TEXTURE_FILTER_LINEAR,
|
RARCH_WRAP_EDGE, TEXTURE_FILTER_LINEAR,
|
||||||
alignment);
|
alignment,
|
||||||
|
images[i].width, images[i].height, images[i].pixels);
|
||||||
|
|
||||||
/* Default. Stretch to whole screen. */
|
/* Default. Stretch to whole screen. */
|
||||||
gl_overlay_tex_geom(gl, i, 0, 0, 1, 1);
|
gl_overlay_tex_geom(gl, i, 0, 0, 1, 1);
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
#include "gl_common.h"
|
#include "gl_common.h"
|
||||||
|
|
||||||
void gl_load_texture_data(GLuint id,
|
void gl_load_texture_data(GLuint id,
|
||||||
const struct texture_image *img,
|
|
||||||
enum gfx_wrap_type wrap_type,
|
enum gfx_wrap_type wrap_type,
|
||||||
enum texture_filter_type filter_type,
|
enum texture_filter_type filter_type,
|
||||||
unsigned alignment)
|
unsigned alignment,
|
||||||
|
unsigned width, unsigned height,
|
||||||
|
const void *frame)
|
||||||
{
|
{
|
||||||
GLint mag_filter, min_filter;
|
GLint mag_filter, min_filter;
|
||||||
GLenum wrap;
|
GLenum wrap;
|
||||||
|
@ -69,9 +70,9 @@ void gl_load_texture_data(GLuint id,
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32,
|
driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_INTERNAL_FORMAT32,
|
||||||
img->width, img->height, 0,
|
width, height, 0,
|
||||||
driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_TEXTURE_TYPE32,
|
driver.gfx_use_rgba ? GL_RGBA : RARCH_GL_TEXTURE_TYPE32,
|
||||||
RARCH_GL_FORMAT32, img->pixels);
|
RARCH_GL_FORMAT32, frame);
|
||||||
|
|
||||||
if (want_mipmap)
|
if (want_mipmap)
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
@ -117,9 +118,11 @@ bool gl_load_luts(const struct video_shader *generic_shader,
|
||||||
filter_type = TEXTURE_FILTER_MIPMAP_LINEAR;
|
filter_type = TEXTURE_FILTER_MIPMAP_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_load_texture_data(textures_lut[i], &img,
|
gl_load_texture_data(textures_lut[i],
|
||||||
generic_shader->lut[i].wrap,
|
generic_shader->lut[i].wrap,
|
||||||
filter_type, 4);
|
filter_type, 4,
|
||||||
|
img.width, img.height,
|
||||||
|
img.pixels);
|
||||||
texture_image_free(&img);
|
texture_image_free(&img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,10 +404,11 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height,
|
||||||
bool force_full, bool allow_rotate);
|
bool force_full, bool allow_rotate);
|
||||||
|
|
||||||
void gl_load_texture_data(GLuint id,
|
void gl_load_texture_data(GLuint id,
|
||||||
const struct texture_image *img,
|
|
||||||
enum gfx_wrap_type wrap_type,
|
enum gfx_wrap_type wrap_type,
|
||||||
enum texture_filter_type filter_type,
|
enum texture_filter_type filter_type,
|
||||||
unsigned alignment);
|
unsigned alignment,
|
||||||
|
unsigned width, unsigned height,
|
||||||
|
const void *frame);
|
||||||
|
|
||||||
bool gl_load_luts(const struct video_shader *generic_shader,
|
bool gl_load_luts(const struct video_shader *generic_shader,
|
||||||
GLuint *lut_textures);
|
GLuint *lut_textures);
|
||||||
|
|
|
@ -30,7 +30,8 @@ static void menu_texture_png_load_gl(struct texture_image *ti,
|
||||||
/* Generate the OpenGL texture object */
|
/* Generate the OpenGL texture object */
|
||||||
glGenTextures(1, id);
|
glGenTextures(1, id);
|
||||||
gl_load_texture_data((GLuint)*id,
|
gl_load_texture_data((GLuint)*id,
|
||||||
ti, RARCH_WRAP_EDGE, filter_type, 4 /* TODO/FIXME - dehardcode */);
|
RARCH_WRAP_EDGE, filter_type, 4 /* TODO/FIXME - dehardcode */,
|
||||||
|
ti->width, ti->height, ti->pixels);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue