heebie
[vg.git] / vg_build_utils_shader.h
index 77ce897e4f32297706aa692b2b9ff670b10742c5..1c81c41822dd0532a4273c14bebdae3d97a3ea54 100644 (file)
@@ -35,6 +35,8 @@ static void vg_shader_set_include_dir( char *dir )
 static void parse_uniform_name( char *start, struct uniform *uf )
 {
    uf->array = 0;
+   int type_set = 0;
+
    for( int i=0;; i++ )
    {
       if( start[i] == '\0' )
@@ -56,7 +58,12 @@ static void parse_uniform_name( char *start, struct uniform *uf )
       if( start[i] == ' ' )
       {
          start[i] = '\0';
-         strncpy( uf->type, start, sizeof(uf->type) );
+
+         if( !type_set )
+         {
+            strncpy( uf->type, start, sizeof(uf->type) );
+            type_set = 1;
+         }
          start = start+i+1;
          i=0;
       }
@@ -80,7 +87,9 @@ static int compile_subshader( FILE *header, char *name )
    else
    {
       fprintf( header, "{\n"
-                       ".static_src = \n" );
+                       ".orig_file = \"%s\",\n" 
+                       ".static_src = \n",
+                       name );
 
       char *cur = full, *start = full;
       while( 1 )
@@ -199,7 +208,8 @@ int vg_build_shader( char *src_vert, /* path/to/vert.vs    */
    for( int i=0; i<vg_shaderbuild.uniform_count; i++ )
    {
       struct uniform *uf = &vg_shaderbuild.uniform_buffer[i];
-      if( uf->array ) continue;
+      if( uf->array ) 
+         continue;
 
       for( int j=0; j<vg_list_size(types); j ++ )
       {