- Home /
Question by
yatagarasu · Jan 28, 2014 at 04:03 PM ·
shadersmacosx
Why my shaders are not working on MacBook Pro?
I know this is stupid question but why my shaders are not working on MacBook Pro? They are working on PC, on iPad, on iPhone, on various Android devices. And only Mac Book shows white rectangles.
I have MacBook Pro Retina 2012 with geforce gt 650m. Not a worst videocard i think. I don't know where to start debugging. Maybe any hints or usefull links?
thanx.
Comment
Answer by yatagarasu · Jan 29, 2014 at 01:09 PM
Here is the shader code
Shader "Custom/Cutoff"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_MaskTex ("Cutoff Mask Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_Cutoff ("Cutoff value", Float) = 0.5
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile DUMMY PIXELSNAP_ON
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
fixed4 _Color;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
sampler2D _MainTex;
sampler2D _MaskTex;
float _Cutoff;
fixed4 frag(v2f IN) : COLOR
{
float4 mc = tex2D(_MaskTex, IN.texcoord).a;
clip(_Cutoff - mc.a);
return tex2D(_MainTex, IN.texcoord) * IN.color;
}
ENDCG
}
}
FallBack "Sprites/Default"
}
It works everywhere except MacBook pro. Maybe anybody can help? It is simple cutoff shader derived from sprite shader.
Your answer
![](https://koobas.hobune.stream/wayback/20220613131923im_/https://answers.unity.com/themes/thub/images/avi.jpg)