Use RGB565 in VC context.

This commit is contained in:
Themaister 2012-10-20 11:22:10 +01:00
parent 3bcbc605d7
commit 2145d1c4e2
3 changed files with 17 additions and 14 deletions

View File

@ -445,12 +445,12 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
if (!eglBuffer[index] || !g_egl_vgimage[index])
{
g_egl_vgimage[index] = vgCreateImage(VG_sXRGB_8888, g_egl_res, g_egl_res, g_smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
g_egl_vgimage[index] = vgCreateImage(rgb32 ? VG_sXRGB_8888 : VG_sRGB_565, g_egl_res, g_egl_res, VG_IMAGE_QUALITY_NONANTIALIASED);
eglBuffer[index] = peglCreateImageKHR(g_egl_dpy, g_eglimage_ctx, EGL_VG_PARENT_IMAGE_KHR, (EGLClientBuffer)g_egl_vgimage[index], NULL);
ret = true;
}
vgImageSubData(g_egl_vgimage[index], frame, pitch, (rgb32 ? VG_sXRGB_8888 : VG_sARGB_1555), 0, 0, width, height);
vgImageSubData(g_egl_vgimage[index], frame, pitch, (rgb32 ? VG_sXRGB_8888 : VG_sRGB_565), 0, 0, width, height);
*image_handle = eglBuffer[index];
gfx_ctx_bind_api(g_api);

View File

@ -995,8 +995,14 @@ static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, un
#endif
}
static void gl_init_textures(gl_t *gl)
static void gl_init_textures(gl_t *gl, const video_info_t *video)
{
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
gl->egl_images = load_eglimage_proc(gl) && gl->ctx_driver->init_egl_image_buffer(video);
#else
(void)video;
#endif
glGenTextures(TEXTURES, gl->texture);
for (unsigned i = 0; i < TEXTURES; i++)
{
@ -1007,9 +1013,12 @@ static void gl_init_textures(gl_t *gl)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl->tex_filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl->tex_filter);
glTexImage2D(GL_TEXTURE_2D,
0, gl->internal_fmt, gl->tex_w, gl->tex_h, 0, gl->texture_type,
gl->texture_fmt, gl->empty_buf ? gl->empty_buf : NULL);
if (!gl->egl_images)
{
glTexImage2D(GL_TEXTURE_2D,
0, gl->internal_fmt, gl->tex_w, gl->tex_h, 0, gl->texture_type,
gl->texture_fmt, gl->empty_buf ? gl->empty_buf : NULL);
}
}
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
@ -1381,7 +1390,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
}
#endif
gl_init_textures(gl);
gl_init_textures(gl, video);
for (unsigned i = 0; i < TEXTURES; i++)
{
@ -1409,10 +1418,6 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
return NULL;
}
#ifdef HAVE_EGL
gl->egl_images = load_eglimage_proc(gl) && gl->ctx_driver->init_egl_image_buffer(video);
#endif
return gl;
}

View File

@ -158,7 +158,7 @@ struct gl_coords
#define MAX_SHADERS 16
#if defined(HAVE_GLSL) || defined(HAVE_CG)
#if (defined(HAVE_GLSL) || defined(HAVE_CG))
#define TEXTURES 8
#else
#define TEXTURES 1
@ -238,9 +238,7 @@ typedef struct gl
GLuint menu_texture_id;
#endif
#ifdef HAVE_EGL
bool egl_images;
#endif
} gl_t;
// Windows ... <_<