Search
lxdream.org :: lxdream/src/pvr2/gl_sl.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/gl_sl.c
changeset 1140:7dc1c71ece76
prev1134:f502f3d32f90
next1166:f405d42a9786
author nkeynes
date Tue Oct 26 08:39:02 2010 +1000 (12 years ago)
permissions -rw-r--r--
last change Implement fragment shader to support palette textures 'directly', and
therefore avoid having to reload all palette textures whenever the palette
changes.
file annotate diff log raw
1.1 --- a/src/pvr2/gl_sl.c Fri Oct 22 20:55:32 2010 +1000
1.2 +++ b/src/pvr2/gl_sl.c Tue Oct 26 08:39:02 2010 +1000
1.3 @@ -152,6 +152,16 @@
1.4 glDeleteObjectARB(program);
1.5 }
1.6
1.7 +static inline GLint glsl_get_uniform_location_prim(gl_program_t program, const char *name)
1.8 +{
1.9 + return glGetUniformLocationARB(program, name);
1.10 +}
1.11 +
1.12 +static inline void glsl_set_uniform_int_prim(GLint location, GLint value)
1.13 +{
1.14 + glUniform1iARB(location,value);
1.15 +}
1.16 +
1.17 #elif HAVE_OPENGL_SHADER
1.18
1.19 gboolean glsl_is_supported()
1.20 @@ -260,6 +270,15 @@
1.21 glDeleteProgram(program);
1.22 }
1.23
1.24 +static inline GLint glsl_get_uniform_location_prim(gl_program_t program, const char *name)
1.25 +{
1.26 + return glGetUniformLocation(program, name);
1.27 +}
1.28 +static inline void glsl_set_uniform_int_prim(GLint location, GLint value)
1.29 +{
1.30 + glUniform1i(location, value);
1.31 +}
1.32 +
1.33 #else
1.34 gboolean glsl_is_supported()
1.35 {
1.36 @@ -297,6 +316,15 @@
1.37 void glsl_destroy_program(gl_program_t program)
1.38 {
1.39 }
1.40 +
1.41 +static inline GLint glsl_get_uniform_location_prim(gl_program_t program, const char *name)
1.42 +{
1.43 + return 0;
1.44 +}
1.45 +
1.46 +static inline void glsl_set_uniform_int_prim(GLint location, GLint value)
1.47 +{
1.48 +}
1.49 #endif
1.50
1.51 /****************************************************************************/
1.52 @@ -394,6 +422,20 @@
1.53 }
1.54 }
1.55
1.56 +GLint glsl_get_uniform_location( unsigned program, const char *name )
1.57 +{
1.58 + assert( program >= 0 && program <= GLSL_LAST_PROGRAM );
1.59 +
1.60 + return glsl_get_uniform_location_prim(program_array[program], name);
1.61 +}
1.62 +
1.63 +void glsl_set_uniform_int( unsigned program, const char *name, GLint value )
1.64 +{
1.65 + assert( program >= 0 && program <= GLSL_LAST_PROGRAM );
1.66 + GLint location = glsl_get_uniform_location_prim(program_array[program], name);
1.67 + glsl_set_uniform_int_prim(location, value);
1.68 +}
1.69 +
1.70 void glsl_clear_shader()
1.71 {
1.72 glsl_use_program(0);
.