Re: [G3D] "Shader Compilation Failed" due to UniversalSurface_*.vrt macros being out of sync with UniversalSurface.cpp, fix included

13 views
Skip to first unread message

Morgan McGuire

unread,
Jan 31, 2013, 9:07:41 AM1/31/13
to g3d-...@googlegroups.com
>>> ./buildg3d update
>
> For what it's worth, I set my G3D9DATA environment variable to
> g3d-code/G3D9/build/data. While I'm on the subject, is it intended behavior
> that the enet.lib libraries and headers are not copied into
> g3d-code/G3D9/build like all the other headers and libraries?

That's a bug. I'll fix it this weekend. The ice.txt file for
enet.lib must be missing the build directory path.

> Anyway, back to the main bug. I compiled the starter sample app by doing:
>
>>> icompile
>
> I tried to run it (from the terminal only - double clicking on starterd in
> finder hangs),

I would not recommend trying to run a default compiled program by
double clicking. You have to use icompile --deploy on the mac to
create a resource bundle, etc. that can be double-clicked on. We
don't do that by default because it doesn't leave you in a good
position to debug.

> and I got an error message about undefined macros in the
> UniversalSurface_*.vrt files (screenshot attached).
>
> As far as I can tell, this error happens because UniversalSurface_*.vrt
> files refer to macros that are not always set in UniversalSurface.cpp. I
> made a couple of very minor tweaks to UniversalSurface.cpp, which allow the
> starter app to run as expected. I'm not sure if my workaround is the correct
> solution, but at least it helps to understand the problem. Here is my
> workaround:
>
>
>
> dn0a21025a:G3D9 mike$ svn diff
> Index: GLG3D.lib/source/UniversalSurface.cpp
> ===================================================================
> --- GLG3D.lib/source/UniversalSurface.cpp (revision 2813)
> +++ GLG3D.lib/source/UniversalSurface.cpp (working copy)
> @@ -129,6 +129,8 @@
> if (thisSurfaceNeedsAlphaTest) {
> args.setUniform(SYMBOL_lambertianMap, lambertian);
> args.setMacro(SYMBOL_HAS_ALPHA, 1);
> + } else {
> + args.setMacro(SYMBOL_HAS_ALPHA, 0);
> }
> if (thisSurfaceNeedsAlphaTest && isParallaxMapped) {
> args.setUniform(SYMBOL_normalBumpMap,
> bumpMap->normalBumpMap()->texture());
> @@ -764,6 +766,7 @@
> G3D_DECLARE_SYMBOL(g3d_PackedTangent);
> G3D_DECLARE_SYMBOL(g3d_BoneIndices);
> G3D_DECLARE_SYMBOL(g3d_BoneWeights);
> +G3D_DECLARE_SYMBOL(USE_BONES);
> void UniversalSurface::GPUGeom::setShaderArgs(Args& args) const {
> debugAssert(normal.valid());
> debugAssert(index.valid());
> @@ -789,6 +792,8 @@
> args.setStream(SYMBOL_g3d_BoneWeights, boneWeights);
> }
>
> + args.setMacro(SYMBOL_USE_BONES, 0);
> +
> args.setIndexStream(index);
> args.geometryInput = primitive;
> }
> dn0a21025a:G3D9 mike$

Thanks for the patch. We'll verify and integrate it.

-m


> Cheers,
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "G3D Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to g3d-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages