# BUG: defining an empty macro in glsl

**URL:** <https://forums.imgtec.com/t/bug-defining-an-empty-macro-in-glsl/460>\
**Category:** PowerVR Insider\
**Tags:** pvrvframe\
**Created:** [August 30, 2009, 4:57am UTC](https://forums.imgtec.com/t/bug-defining-an-empty-macro-in-glsl/460 "2009-08-30T04:57:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jglazer](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jglazer](https://forums.imgtec.com/u/jglazer)\
**Post date:** [August 30, 2009, 4:57am UTC](https://forums.imgtec.com/t/bug-defining-an-empty-macro-in-glsl/460/1 "2009-08-30T04:57:43Z")

</div>

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.&nbsp; 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.&nbsp; 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.&nbsp; I would assume it was the same shader compiler, but maybe it's not?  
  
Thanks,  
Josh  
  
  
JGlazer2009-08-30 07:03:37

---

<div class="post-metadata">

**Author:** ![xmas](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@xmas](https://forums.imgtec.com/u/xmas)\
**Post date:** [September 1, 2009, 9:38am UTC](https://forums.imgtec.com/t/bug-defining-an-empty-macro-in-glsl/460/2 "2009-09-01T09:38:23Z")

</div>

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.
