Shader not compiling on mac but will on windows


#1

I wrote a fragment shader on my windows machine and it worked fine. But when I try to build it on my late 2012 macbook pro i get the following errors.

Incompatible types in initialization (and no available implicit conversion)

Is this a result from the version differences of OpenGL? Is there a way to force to a specific version of OpenGL?


#2

It’s said that apple will drop opengl?


#3

Do you get a line number as well? Did you search for the error? Maybe this will help: https://gamedev.stackexchange.com/questions/92158/glsl-incompatible-types-at-initialisation-and-no-available-implicit-conversion


#4

Yes, that is true, but not for quite some time. We’re working on a Metal compatible render pipeline.


#5

The shader compiler on mac may be more picky than the one on windows. Please post the log that contains the error, there should be a line number to the offending code.


#6

One common mistake is assigning an int to a float lvalue in GLSL:

float a = 1.0; // OK
int b = 1; // OK
float c = 1; // Wrong

But yeah, look at the code at the line number reported by the error.


#7

All my shaders written on a Mac, work on Windows. So Windows is more permissive in your case.


#8

@britzl
Thank you for the reply it did give me a line number. I dont have my laptop with me this morning but ill post it all latter today.

@Johan_Beck-Noren
Thank you, I will later today.

@dapetcu21
I see. If I remember correctly my code is written correctly as you show it.