[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50365] branches/ge_harmony/source/blender /gpu/intern/gpu_material.c: Fixed a bug where a shader that had main on the first line wouldn' t load correctly.

Daniel Stokes kupomail at gmail.com
Mon Sep 3 22:36:27 CEST 2012


Revision: 50365
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50365
Author:   kupoman
Date:     2012-09-03 20:36:26 +0000 (Mon, 03 Sep 2012)
Log Message:
-----------
Fixed a bug where a shader that had main on the first line wouldn't load correctly.

Modified Paths:
--------------
    branches/ge_harmony/source/blender/gpu/intern/gpu_material.c

Modified: branches/ge_harmony/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/ge_harmony/source/blender/gpu/intern/gpu_material.c	2012-09-03 18:51:02 UTC (rev 50364)
+++ branches/ge_harmony/source/blender/gpu/intern/gpu_material.c	2012-09-03 20:36:26 UTC (rev 50365)
@@ -245,11 +245,13 @@
 
 			else if (cs->shader->type & SHADER_TYPE_FRAGMENT) {
 				char *source = cs->shader->source;
-				char *split = strstr(source, "void main") - 1;
+				char *split = strstr(source, "void main");
 				fname[13] = '0' + fcount++;
 				BLI_dynstr_nappend(frag_vars, source, split-source);
 				BLI_dynstr_append(frag_funcs, fname);
-				BLI_dynstr_append(frag_funcs, split+10);
+				BLI_dynstr_append(frag_funcs, "()");
+				split = strstr(split, "{");
+				BLI_dynstr_append(frag_funcs, split);
 				BLI_dynstr_appendf(frag_main, "\t%s();\n", fname+5);
 			}
 




More information about the Bf-blender-cvs mailing list