Refactor gl_load_texture_data

This commit is contained in:
twinaphex 2015-02-11 15:53:37 +01:00
parent 77f6b98aa9
commit 118ce66dec
4 changed files with 16 additions and 11 deletions

View File

@ -2783,9 +2783,9 @@ static bool gl_overlay_load(void *data,
* sizeof(uint32_t));
gl_load_texture_data(gl->overlay_tex[i],
&images[i],
RARCH_WRAP_EDGE, TEXTURE_FILTER_LINEAR,
alignment);
alignment,
images[i].width, images[i].height, images[i].pixels);
/* Default. Stretch to whole screen. */
gl_overlay_tex_geom(gl, i, 0, 0, 1, 1);

View File

@ -17,10 +17,11 @@
#include "gl_common.h"
void gl_load_texture_data(GLuint id,
const struct texture_image *img,
enum gfx_wrap_type wrap_type,
enum texture_filter_type filter_type,
unsigned alignment)
unsigned alignment,
unsigned width, unsigned height,
const void *frame)
{
GLint mag_filter, min_filter;
GLenum wrap;
@ -69,9 +70,9 @@ void gl_load_texture_data(GLuint id,
glTexImage2D(GL_TEXTURE_2D,
0,
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,
RARCH_GL_FORMAT32, img->pixels);
RARCH_GL_FORMAT32, frame);
if (want_mipmap)
glGenerateMipmap(GL_TEXTURE_2D);
@ -117,9 +118,11 @@ bool gl_load_luts(const struct video_shader *generic_shader,
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,
filter_type, 4);
filter_type, 4,
img.width, img.height,
img.pixels);
texture_image_free(&img);
}

View File

@ -404,10 +404,11 @@ void gl_set_viewport(gl_t *gl, unsigned width, unsigned height,
bool force_full, bool allow_rotate);
void gl_load_texture_data(GLuint id,
const struct texture_image *img,
enum gfx_wrap_type wrap_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,
GLuint *lut_textures);

View File

@ -30,7 +30,8 @@ static void menu_texture_png_load_gl(struct texture_image *ti,
/* Generate the OpenGL texture object */
glGenTextures(1, 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