Search
lxdream.org :: lxdream :: r1256:a9d29fe74bf3
lxdream 0.9.1
released Jun 29
Download Now
changeset1256:a9d29fe74bf3
parent1255:d63f73cc586f
child1257:e1314ad3e7cc
authornkeynes
dateSun Mar 04 21:10:12 2012 +1000 (7 years ago)
Move glsl loading into common gl code, and set a display capability flag
src/display.h
src/drivers/video_egl.c
src/drivers/video_gl.c
src/drivers/video_glx.c
src/drivers/video_nsgl.m
src/pvr2/gl_sl.c
src/pvr2/glrender.c
src/pvr2/glutil.h
src/pvr2/pvr2.h
src/pvr2/texcache.c
1.1 --- a/src/display.h Sun Mar 04 20:56:40 2012 +1000
1.2 +++ b/src/display.h Sun Mar 04 21:10:12 2012 +1000
1.3 @@ -110,6 +110,7 @@
1.4
1.5 struct display_capabilities {
1.6 gboolean has_gl;
1.7 + gboolean has_sl;
1.8 int depth_bits;
1.9 int stencil_bits; /* 0 = no stencil buffer */
1.10 };
2.1 --- a/src/drivers/video_egl.c Sun Mar 04 20:56:40 2012 +1000
2.2 +++ b/src/drivers/video_egl.c Sun Mar 04 21:10:12 2012 +1000
2.3 @@ -126,6 +126,7 @@
2.4 display_egl_driver.capabilities.depth_bits = 16; /* TODO: get from config info */
2.5 gl_fbo_init(&display_egl_driver);
2.6 gl_vbo_init(&display_egl_driver);
2.7 + glsl_init(&display_egl_driver);
2.8 fbo_created = TRUE;
2.9 } else {
2.10 ERROR( "Display does not support FBO" );
3.1 --- a/src/drivers/video_gl.c Sun Mar 04 20:56:40 2012 +1000
3.2 +++ b/src/drivers/video_gl.c Sun Mar 04 21:10:12 2012 +1000
3.3 @@ -272,6 +272,7 @@
3.4 display_gl_driver.capabilities.has_gl = TRUE;
3.5 gl_fbo_init(&display_gl_driver);
3.6 gl_vbo_init(&display_gl_driver);
3.7 + glsl_init(&display_gl_driver);
3.8 return TRUE;
3.9 } else {
3.10 return FALSE;
4.1 --- a/src/drivers/video_glx.c Sun Mar 04 20:56:40 2012 +1000
4.2 +++ b/src/drivers/video_glx.c Sun Mar 04 21:10:12 2012 +1000
4.3 @@ -250,6 +250,7 @@
4.4 return FALSE;
4.5 }
4.6 gl_vbo_init(driver);
4.7 + glsl_init(driver);
4.8 return TRUE;
4.9 }
4.10
5.1 --- a/src/drivers/video_nsgl.m Sun Mar 04 20:56:40 2012 +1000
5.2 +++ b/src/drivers/video_nsgl.m Sun Mar 04 21:10:12 2012 +1000
5.3 @@ -54,6 +54,7 @@
5.4 return FALSE;
5.5 }
5.6 gl_vbo_init(driver);
5.7 + glsl_init(driver);
5.8
5.9 return TRUE;
5.10 }
6.1 --- a/src/pvr2/gl_sl.c Sun Mar 04 20:56:40 2012 +1000
6.2 +++ b/src/pvr2/gl_sl.c Sun Mar 04 21:10:12 2012 +1000
6.3 @@ -492,3 +492,21 @@
6.4 glsl_use_program(0);
6.5 }
6.6
6.7 +gboolean glsl_init( display_driver_t driver )
6.8 +{
6.9 + gboolean result;
6.10 + if( glsl_is_supported() && isGLMultitextureSupported() ) {
6.11 + if( !glsl_load_shaders( ) ) {
6.12 + WARN( "Unable to load GL shaders" );
6.13 + result = FALSE;
6.14 + } else {
6.15 + INFO( "Shaders loaded successfully" );
6.16 + result = TRUE;
6.17 + }
6.18 + } else {
6.19 + INFO( "Shaders not supported" );
6.20 + result = FALSE;
6.21 + }
6.22 + driver->capabilities.has_sl = result;
6.23 + return result;
6.24 +}
7.1 --- a/src/pvr2/glrender.c Sun Mar 04 20:56:40 2012 +1000
7.2 +++ b/src/pvr2/glrender.c Sun Mar 04 21:10:12 2012 +1000
7.3 @@ -115,21 +115,10 @@
7.4 */
7.5 void pvr2_setup_gl_context()
7.6 {
7.7 - if( glsl_is_supported() && isGLMultitextureSupported() ) {
7.8 - if( !glsl_load_shaders( ) ) {
7.9 - WARN( "Unable to load GL shaders" );
7.10 - } else {
7.11 - INFO( "Shaders loaded successfully" );
7.12 - have_shaders = TRUE;
7.13 - }
7.14 - } else {
7.15 - INFO( "Shaders not supported" );
7.16 - }
7.17 -
7.18 #ifdef APPLE_BUILD
7.19 CGL_MACRO_CONTEXT = CGLGetCurrentContext();
7.20 #endif
7.21 - texcache_gl_init(have_shaders); // Allocate texture IDs
7.22 + texcache_gl_init(); // Allocate texture IDs
7.23
7.24 /* Global settings */
7.25 glDisable( GL_CULL_FACE );
8.1 --- a/src/pvr2/glutil.h Sun Mar 04 20:56:40 2012 +1000
8.2 +++ b/src/pvr2/glutil.h Sun Mar 04 21:10:12 2012 +1000
8.3 @@ -136,6 +136,7 @@
8.4
8.5
8.6 /****** Shader handling (gl_sl.c) *****/
8.7 +gboolean glsl_init( display_driver_t driver );
8.8 gboolean glsl_is_supported(void);
8.9 const char *glsl_get_version(void);
8.10 gboolean glsl_load_shaders( );
9.1 --- a/src/pvr2/pvr2.h Sun Mar 04 20:56:40 2012 +1000
9.2 +++ b/src/pvr2/pvr2.h Sun Mar 04 21:10:12 2012 +1000
9.3 @@ -316,7 +316,7 @@
9.4 /**
9.5 * Initialize the GL side of the texture cache (texture ids and such).
9.6 */
9.7 -void texcache_gl_init( gboolean withShaders );
9.8 +void texcache_gl_init( );
9.9
9.10 /**
9.11 * Flush all textures and delete. The cache will be non-functional until
10.1 --- a/src/pvr2/texcache.c Sun Mar 04 20:56:40 2012 +1000
10.2 +++ b/src/pvr2/texcache.c Sun Mar 04 21:10:12 2012 +1000
10.3 @@ -89,12 +89,12 @@
10.4 * Setup the initial texture ids (must be called after the GL context is
10.5 * prepared)
10.6 */
10.7 -void texcache_gl_init( gboolean withShaders )
10.8 +void texcache_gl_init( )
10.9 {
10.10 int i;
10.11 GLuint texids[MAX_TEXTURES];
10.12
10.13 - if( withShaders ) {
10.14 + if( display_driver->capabilities.has_sl ) {
10.15 texcache_have_palette_shader = TRUE;
10.16 texcache_palette_valid = FALSE;
10.17 glGenTextures(1, &texcache_palette_texid );
.