Search
lxdream.org :: lxdream :: r1209:e606e65eaf54
lxdream 0.9.1
released Jun 29
Download Now
changeset1209:e606e65eaf54
parent1208:6955202d6408
child1210:79bbd30363f4
authornkeynes
dateTue Feb 07 11:59:07 2012 +1000 (7 years ago)
Add enable/disable vertex attribute calls when making a shader active
Add vec3 uniform setter
src/pvr2/gl_sl.c
src/tools/genglsl.c
1.1 --- a/src/pvr2/gl_sl.c Tue Feb 07 11:44:19 2012 +1000
1.2 +++ b/src/pvr2/gl_sl.c Tue Feb 07 11:59:07 2012 +1000
1.3 @@ -167,6 +167,7 @@
1.4
1.5 #define glsl_set_uniform_sampler1D(id,v) glUniform1iARB(id,v)
1.6 #define glsl_set_uniform_sampler2D(id,v) glUniform1iARB(id,v)
1.7 +#define glsl_set_uniform_vec3(id,v) glUniform3fvARB(id,1,v)
1.8 #define glsl_set_uniform_vec4(id,v) glUniform4fvARB(id,1,v)
1.9 #define glsl_set_uniform_mat4(id,v) glUniformMatrix4fvARB(id,1,GL_FALSE,v)
1.10 #define glsl_set_attrib_vec3(id,stride,v) glVertexAttribPointerARB(id, 3, GL_FLOAT, GL_FALSE, stride, v)
1.11 @@ -293,6 +294,7 @@
1.12
1.13 #define glsl_set_uniform_sampler1D(id,v) glUniform1i(id,v)
1.14 #define glsl_set_uniform_sampler2D(id,v) glUniform1i(id,v)
1.15 +#define glsl_set_uniform_vec3(id,v) glUniform3fv(id,1,v)
1.16 #define glsl_set_uniform_vec4(id,v) glUniform4fv(id,1,v)
1.17 #define glsl_set_uniform_mat4(id,v) glUniformMatrix4fv(id,1,GL_FALSE,v)
1.18 #define glsl_set_attrib_vec3(id,stride,v) glVertexAttribPointer(id, 3, GL_FLOAT, GL_FALSE, stride, v)
1.19 @@ -350,6 +352,7 @@
1.20 }
1.21
1.22 #define glsl_set_uniform_sampler2D(id,v)
1.23 +#define glsl_set_uniform_vec3(id,v)
1.24 #define glsl_set_uniform_vec4(id,v)
1.25 #define glsl_set_uniform_mat4(id,v)
1.26 #define glsl_set_attrib_vec3(id,stride,v)
2.1 --- a/src/tools/genglsl.c Tue Feb 07 11:44:19 2012 +1000
2.2 +++ b/src/tools/genglsl.c Tue Feb 07 11:59:07 2012 +1000
2.3 @@ -317,6 +317,9 @@
2.4 fprintf( f, "void glsl_set_%s_%s(%s value); /* uniform %s %s */ \n", program->name, var->name, getCType(var->type,var->uniform), var->type, var->name );
2.5 } else {
2.6 fprintf( f, "void glsl_set_%s_%s_pointer(%s ptr, GLint stride); /* attribute %s %s */ \n", program->name, var->name, getCType(var->type,var->uniform), var->type, var->name);
2.7 + if( strcmp(var->type,"vec4") == 0 ) { /* Special case */
2.8 + fprintf( f, "void glsl_set_%s_%s_vec3_pointer(%s ptr, GLint stride); /* attribute %s %s */ \n", program->name, var->name, getCType(var->type,var->uniform), var->type, var->name);
2.9 + }
2.10 }
2.11 }
2.12 }
2.13 @@ -402,6 +405,10 @@
2.14 } else {
2.15 fprintf( f, "void glsl_set_%s_%s_pointer(%s ptr, GLsizei stride){ /* attribute %s %s */ \n", program->name, var->name, getCType(var->type,var->uniform), var->type, var->name);
2.16 fprintf( f, " glsl_set_attrib_%s(var_%s_%s_loc,stride, ptr);\n}\n", var->type, program->name, var->name );
2.17 + if( strcmp(var->type,"vec4") == 0 ) { /* Special case to load vec3 arrays into a vec4 */
2.18 + fprintf( f, "void glsl_set_%s_%s_vec3_pointer(%s ptr, GLsizei stride){ /* attribute %s %s */ \n", program->name, var->name, getCType(var->type,var->uniform), var->type, var->name);
2.19 + fprintf( f, " glsl_set_attrib_vec3(var_%s_%s_loc,stride, ptr);\n}\n", program->name, var->name );
2.20 + }
2.21 }
2.22 }
2.23 }
.