[retro-gtk/wip/aplazas/gl-errors] simplify shader management
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/gl-errors] simplify shader management
- Date: Thu, 16 Nov 2017 12:14:41 +0000 (UTC)
commit a2d7c45e97184119bed0127061d30ee891a7f2ee
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Nov 16 13:14:23 2017 +0100
simplify shader management
retro-gtk/retro-gl-display.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index a4a43aa..95d9f04 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -122,9 +122,14 @@ retro_gl_display_realize (RetroGLDisplay *self)
for (filter = 0; filter < RETRO_VIDEO_FILTER_COUNT; filter++) {
self->glsl_filter[filter] = retro_glsl_filter_new (filter_uris[filter], NULL);
retro_glsl_filter_prepare_program (self->glsl_filter[filter], &inner_error);
- if (G_UNLIKELY (inner_error) != NULL) {
- g_message ("%s", inner_error->message);
+ if (G_UNLIKELY (inner_error != NULL)) {
+ g_critical ("Shader program %s creation failed: %s",
+ filter_uris[filter],
+ inner_error->message);
+ g_clear_object (&self->glsl_filter[filter]);
g_clear_error (&inner_error);
+
+ continue;
}
retro_glsl_filter_set_attribute_pointer (self->glsl_filter[filter],
@@ -172,10 +177,6 @@ retro_gl_display_unrealize (RetroGLDisplay *self)
static gboolean
retro_gl_display_render (RetroGLDisplay *self)
{
- gdouble w = 0.0;
- gdouble h = 0.0;
- gdouble x = 0.0;
- gdouble y = 0.0;
GLfloat source_width, source_height;
GLfloat target_width, target_height;
GLfloat output_width, output_height;
@@ -183,19 +184,20 @@ retro_gl_display_render (RetroGLDisplay *self)
g_return_val_if_fail (self != NULL, FALSE);
- retro_gl_display_get_video_box (self, &w, &h, &x, &y);
+ glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
filter = self->filter >= RETRO_VIDEO_FILTER_COUNT ?
RETRO_VIDEO_FILTER_SMOOTH :
self->filter;
- retro_glsl_filter_use_program (self->glsl_filter[filter]);
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ if (self->glsl_filter[filter] == NULL)
+ return FALSE;
if (self->pixbuf == NULL)
return FALSE;
+ retro_glsl_filter_use_program (self->glsl_filter[filter]);
+
glTexImage2D (GL_TEXTURE_2D,
0,
GL_RGB,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]