BUG: defining an empty macro in glsl

This topic contains 1 reply, has 2 voices, and was last updated by  Xmas 8 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29907

    JGlazer
    Member

    Hi! I’m defining some macros so that my shaders will compile in glsl and hlsl. Because of that, I need the following macro in my glsl code:

    #define BEGIN_DECLARE_VERTEX_INTERPOLATORS( inVIStructType )

    then later in the code, I have a line like

    BEGIN_DECLARE_VERTEX_INTERPOLATORS( VS_IN )

    which should end up preprocessing down to nothing because of the define.  however, when I have these two lines in the glsl, the shader compiler gives me an error that it unexpectedly finds the end of the file.  I can work around it with some ugly hacks by doing this:

    #define BEGIN_DECLARE_VERTEX_INTERPOLATORS( inVIStructType ) float inVIStructType() { return 1.0; }

    but this ugly and it worries me that other bad things might be happening.

    EDIT: I’ve noticed this happens even without the param- it’s worse than I thought, because I can’t then use the param to define a unique dummy function as a work around, and thus I have to add fake params to be macros that don’t even need them. 🙁

    Also worth noting is that this bug happens ONLY when running in the PVRFRame emulator on windows. When I run on the apple’s iphone emulator on the mac, the shader’s compile fine.  I would assume it was the same shader compiler, but maybe it’s not?

    Thanks,
    Josh

    JGlazer2009-08-30 07:03:37

    #33359

    Xmas
    Member
    JGlazer wrote:
    Also worth noting is that this bug happens ONLY when running in the PVRFRame emulator on windows. When I run on the apple’s iphone emulator on the mac, the shader’s compile fine.  I would assume it was the same shader compiler, but maybe it’s not?

    PVRVFrame is a thin layer on top of desktop OpenGL, i.e. it essentially translates OpenGL ES to OpenGL calls, and therefore relies on your graphics card’s OpenGL drivers. What graphics card and drivers are you using, and what error do you get from the shader compiler?

    I don’t think the iPhone emulator works the same way.

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.