projects
/
vg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bad char
[vg.git]
/
src
/
shader.c
diff --git
a/src/shader.c
b/src/shader.c
index 2f7c16790fe6d81d900b9c2d535157b8d74ce3ec..934d30d28c1ee2ead86f7a16632a136c637540ea 100644
(file)
--- a/
src/shader.c
+++ b/
src/shader.c
@@
-8,6
+8,8
@@
struct uniform
{
char name[30];
char type[20];
{
char name[30];
char type[20];
+
+ int array;
}
uniform_buffer[100];
static int uniform_count;
}
uniform_buffer[100];
static int uniform_count;
@@
-27,7
+29,7
@@
static int compile_subshader( FILE *header, char *name )
/* VG */
fprintf( header, "{\n"
/* VG */
fprintf( header, "{\n"
- ".orig_file = \"../shaders/%s\",\n"
+ ".orig_file = \"../
../
shaders/%s\",\n"
".static_src = \n", name );
char *cur = full, *start = full;
".static_src = \n", name );
char *cur = full, *start = full;
@@
-44,6
+46,7
@@
static int compile_subshader( FILE *header, char *name )
{
start += 8;
struct uniform *uf = &uniform_buffer[ uniform_count ++ ];
{
start += 8;
struct uniform *uf = &uniform_buffer[ uniform_count ++ ];
+ uf->array = 0;
for( int i=0;; i++ )
{
if( start[i] == '\0' )
for( int i=0;; i++ )
{
if( start[i] == '\0' )
@@
-54,6
+57,13
@@
static int compile_subshader( FILE *header, char *name )
start[i] = '\0';
strncpy( uf->name, start, sizeof(uf->name) );
}
start[i] = '\0';
strncpy( uf->name, start, sizeof(uf->name) );
}
+
+ if( start[i] == '[' )
+ {
+ start[i] = '\0';
+ strncpy( uf->name, start, sizeof(uf->name) );
+ uf->array = 1;
+ }
if( start[i] == ' ' )
{
if( start[i] == ' ' )
{
@@
-143,6
+153,8
@@
int main( int argc, char *argv[] )
for( int i=0; i<uniform_count; i++ )
{
struct uniform *uf = &uniform_buffer[i];
for( int i=0; i<uniform_count; i++ )
{
struct uniform *uf = &uniform_buffer[i];
+ if( uf->array ) continue;
+
if( !strcmp(uf->type,"vec2") )
{
fprintf( header, "static void shader_%s_%s(v2f v){\n"
if( !strcmp(uf->type,"vec2") )
{
fprintf( header, "static void shader_%s_%s(v2f v){\n"