mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 07:13:35 +00:00
(GL1) Inline gl1_bind_texture
This commit is contained in:
parent
19705a3453
commit
087e3ec974
@ -110,14 +110,4 @@ typedef struct gl1
|
|||||||
bool overlay_full_screen;
|
bool overlay_full_screen;
|
||||||
} gl1_t;
|
} gl1_t;
|
||||||
|
|
||||||
static INLINE void gl1_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter,
|
|
||||||
GLint min_filter)
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, id);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_mode);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_mode);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1298,29 +1298,31 @@ static void gl1_load_texture_data(
|
|||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
const void *frame, unsigned base_size)
|
const void *frame, unsigned base_size)
|
||||||
{
|
{
|
||||||
GLint mag_filter, min_filter;
|
GLint filter;
|
||||||
bool use_rgba = video_driver_supports_rgba();
|
bool use_rgba = video_driver_supports_rgba();
|
||||||
bool rgb32 = (base_size == (sizeof(uint32_t)));
|
bool rgb32 = (base_size == (sizeof(uint32_t)));
|
||||||
GLenum wrap = gl1_wrap_type_to_enum(wrap_type);
|
GLenum wrap = gl1_wrap_type_to_enum(wrap_type);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, id);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
|
||||||
|
|
||||||
/* GL1.x does not have mipmapping support. */
|
/* GL1.x does not have mipmapping support. */
|
||||||
switch (filter_type)
|
switch (filter_type)
|
||||||
{
|
{
|
||||||
case TEXTURE_FILTER_MIPMAP_NEAREST:
|
case TEXTURE_FILTER_MIPMAP_NEAREST:
|
||||||
case TEXTURE_FILTER_NEAREST:
|
case TEXTURE_FILTER_NEAREST:
|
||||||
min_filter = GL_NEAREST;
|
filter = GL_NEAREST;
|
||||||
mag_filter = GL_NEAREST;
|
|
||||||
break;
|
break;
|
||||||
case TEXTURE_FILTER_MIPMAP_LINEAR:
|
case TEXTURE_FILTER_MIPMAP_LINEAR:
|
||||||
case TEXTURE_FILTER_LINEAR:
|
case TEXTURE_FILTER_LINEAR:
|
||||||
default:
|
default:
|
||||||
min_filter = GL_LINEAR;
|
filter = GL_LINEAR;
|
||||||
mag_filter = GL_LINEAR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl1_bind_texture(id, wrap, mag_filter, min_filter);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||||
#ifndef VITA
|
#ifndef VITA
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
@ -1328,13 +1330,21 @@ static void gl1_load_texture_data(
|
|||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
(use_rgba || !rgb32) ? GL_RGBA : RARCH_GL1_INTERNAL_FORMAT32,
|
(use_rgba || !rgb32)
|
||||||
width, height, 0,
|
? GL_RGBA
|
||||||
(use_rgba || !rgb32) ? GL_RGBA : RARCH_GL1_TEXTURE_TYPE32,
|
: RARCH_GL1_INTERNAL_FORMAT32,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
0,
|
||||||
|
(use_rgba || !rgb32)
|
||||||
|
? GL_RGBA
|
||||||
|
: RARCH_GL1_TEXTURE_TYPE32,
|
||||||
#ifdef MSB_FIRST
|
#ifdef MSB_FIRST
|
||||||
GL_UNSIGNED_INT_8_8_8_8_REV,
|
GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||||
#else
|
#else
|
||||||
(rgb32) ? RARCH_GL1_FORMAT32 : GL_UNSIGNED_BYTE,
|
(rgb32)
|
||||||
|
? RARCH_GL1_FORMAT32
|
||||||
|
: GL_UNSIGNED_BYTE,
|
||||||
#endif
|
#endif
|
||||||
frame);
|
frame);
|
||||||
}
|
}
|
||||||
@ -1360,10 +1370,14 @@ static void video_texture_load_gl1(
|
|||||||
pixels = ti->pixels;
|
pixels = ti->pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl1_load_texture_data(id,
|
gl1_load_texture_data(
|
||||||
RARCH_WRAP_EDGE, filter_type,
|
id,
|
||||||
|
RARCH_WRAP_EDGE,
|
||||||
|
filter_type,
|
||||||
4 /* TODO/FIXME - dehardcode */,
|
4 /* TODO/FIXME - dehardcode */,
|
||||||
width, height, pixels,
|
width,
|
||||||
|
height,
|
||||||
|
pixels,
|
||||||
sizeof(uint32_t) /* TODO/FIXME - dehardcode */
|
sizeof(uint32_t) /* TODO/FIXME - dehardcode */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1372,7 +1386,6 @@ static void video_texture_load_gl1(
|
|||||||
static int video_texture_load_wrap_gl1(void *data)
|
static int video_texture_load_wrap_gl1(void *data)
|
||||||
{
|
{
|
||||||
uintptr_t id = 0;
|
uintptr_t id = 0;
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
video_texture_load_gl1((struct texture_image*)data,
|
video_texture_load_gl1((struct texture_image*)data,
|
||||||
|
@ -148,8 +148,11 @@ static void *gl1_raster_font_init(void *data,
|
|||||||
font->gl->ctx_driver->make_current(false);
|
font->gl->ctx_driver->make_current(false);
|
||||||
|
|
||||||
glGenTextures(1, &font->tex);
|
glGenTextures(1, &font->tex);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, font->tex);
|
||||||
gl1_bind_texture(font->tex, GL_CLAMP, GL_LINEAR, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
font->atlas = font->font_driver->get_atlas(font->font_data);
|
font->atlas = font->font_driver->get_atlas(font->font_data);
|
||||||
font->tex_width = next_pow2(font->atlas->width);
|
font->tex_width = next_pow2(font->atlas->width);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user