Permalink
Browse files

show progress bar for shader variant loading

  • Loading branch information...
1 parent e1dc782 commit 5954e4f70c8b22302fdbc581068c51989a53bcb3 @lsalzman committed May 16, 2012
Showing with 10 additions and 5 deletions.
  1. +1 −1 data/glsl.cfg
  2. +9 −4 src/engine/shader.cpp
View
@@ -1500,7 +1500,7 @@ deferredlightvariantshader = [
])
]])
}
- ]
+ ] 32
]
deferredlightshader = [
View
@@ -828,7 +828,7 @@ void shader(int *type, char *name, char *vs, char *ps)
slotparams.shrink(0);
}
-void variantshader(int *type, char *name, int *row, char *vs, char *ps)
+void variantshader(int *type, char *name, int *row, char *vs, char *ps, int *maxvariants)
{
if(*row < 0)
{
@@ -840,8 +840,13 @@ void variantshader(int *type, char *name, int *row, char *vs, char *ps)
if(!s) return;
defformatstring(varname)("<variant:%d,%d>%s", s->variants[*row].length(), *row, name);
- //defformatstring(info)("shader %s", varname);
- //renderprogress(loadprogress, info);
+ if(*maxvariants > 0)
+ {
+ int numvariants = 0;
+ loopi(MAXVARIANTROWS) numvariants += s->variants[i].length();
+ defformatstring(info)("shader %s", name);
+ renderprogress(numvariants / float(*maxvariants), info);
+ }
vector<char> vsbuf, psbuf, vsbak, psbak;
GENSHADER(s->defaultparams.length(), genuniformdefs(vsbuf, psbuf, vs, ps, s));
GENSHADER(strstr(vs, "#pragma CUBE2_fog") || strstr(ps, "#pragma CUBE2_fog"), genfogshader(vsbuf, psbuf, vs, ps));
@@ -969,7 +974,7 @@ void fastshader(char *nice, char *fast, int *detail)
}
COMMAND(shader, "isss");
-COMMAND(variantshader, "isiss");
+COMMAND(variantshader, "isissi");
COMMAND(setshader, "s");
COMMAND(altshader, "ss");
COMMAND(fastshader, "ssi");

0 comments on commit 5954e4f

Please sign in to comment.