Give shaders in Effects files a unique main function name.
This lets you generate Metal shaders that won't conflict in the same library.
--- a/mojoshader_effects.c Sat May 28 22:08:22 2016 -0400
+++ b/mojoshader_effects.c Sat May 28 22:25:43 2016 -0400
@@ -622,9 +622,11 @@
else if (object->type == MOJOSHADER_SYMTYPE_PIXELSHADER
|| object->type == MOJOSHADER_SYMTYPE_VERTEXSHADER)
{
+ char mainfn[32];
+ snprintf(mainfn, sizeof (mainfn), "ShaderFunction%u", (unsigned int) index);
object->shader.technique = -1;
object->shader.pass = -1;
- object->shader.shader = MOJOSHADER_parse(profile, NULL, *ptr, length,
+ object->shader.shader = MOJOSHADER_parse(profile, mainfn, *ptr, length,
swiz, swizcount, smap, smapcount,
m, f, d);
// !!! FIXME: check for errors.
@@ -745,7 +747,9 @@
} // if
else
{
- object->shader.shader = MOJOSHADER_parse(emitter, NULL, *ptr, length,
+ char mainfn[32];
+ snprintf(mainfn, sizeof (mainfn), "ShaderFunction%u", (unsigned int) objectIndex);
+ object->shader.shader = MOJOSHADER_parse(emitter, mainfn, *ptr, length,
swiz, swizcount, smap, smapcount,
m, f, d);
// !!! FIXME: check for errors.