How could I use GL_OES_EGL_image_external extension on Unity5.1?

I am using my own shaders which is used to display videos.At the beginning of fragment shader, I need to add this line “#extension GL_OES_EGL_image_external : require” to make sure my shader works.

this shader works perfect on Unity4.6,but on Unity5.1,compile error occurs.

07-21 13:02:32.756: D/Unity(32680): #version 100
07-21 13:02:32.756: D/Unity(32680): precision mediump float;
07-21 13:02:32.756: D/Unity(32680): precision highp float;
07-21 13:02:32.756: D/Unity(32680): #ifndef SHADER_TARGET
07-21 13:02:32.756: D/Unity(32680): #define SHADER_TARGET 30
07-21 13:02:32.756: D/Unity(32680): #endif
07-21 13:02:32.756: D/Unity(32680): #ifndef SHADER_API_GLES
07-21 13:02:32.756: D/Unity(32680): #define SHADER_API_GLES 1
07-21 13:02:32.756: D/Unity(32680): #endif
07-21 13:02:32.756: D/Unity(32680): #ifndef SHADER_API_MOBILE
07-21 13:02:32.756: D/Unity(32680): #define SHADER_API_MOBILE 1
07-21 13:02:32.756: D/Unity(32680): #endif
07-21 13:02:32.756: D/Unity(32680): #line 9
07-21 13:02:32.756: D/Unity(32680): #ifdef DUMMY_PREPROCESSOR_TO_WORK_AROUND_HLSL_COMPILER_LINE_HANDLING
07-21 13:02:32.756: D/Unity(32680): #endif
07-21 13:02:32.756: D/Unity(32680): #line 9
07-21 13:02:32.756: D/Unity(32680): #ifdef DUMMY_PREPROCESSOR_TO_WORK_AROUND_HLSL_COMPILER_LINE_HANDLING
07-21 13:02:32.756: D/Unity(32680): #endif
07-21 13:02:32.756: D/Unity(32680):
07-21 13:02:32.756: D/Unity(32680):
07-21 13:02:32.756: D/Unity(32680):
07-21 13:02:32.756: D/Unity(32680): #extension GL_OES_EGL_image_external : require
07-21 13:02:32.756: D/Unity(32680): #define gl_TexCoord _glesTexCoord
07-21 13:02:32.756: D/Unity(32680): varying highp vec4 _glesTexCoord[1];
07-21 13:02:32.756: D/Unity(32680): precision mediump float;
07-21 13:02:32.756: D/Unity(32680): uniform samplerExternalOES texSampler;
07-21 13:02:32.757: D/Unity(32680): void main()
07-21 13:02:32.757: D/Unity(32680): {
07-21 13:02:32.757: D/Unity(32680): gl_FragColor = texture2D(texSampler,vc2);
07-21 13:02:32.757: D/Unity(32680): }
07-21 13:02:32.757: D/Unity(32680): -------- failed compiling:
07-21 13:02:32.757: D/Unity(32680): fragment evaluation shader
07-21 13:02:32.757: D/Unity(32680): -------- GLSL error:
07-21 13:02:32.757: D/Unity(32680): Compile failed.
07-21 13:02:32.757: D/Unity(32680): ERROR: 0:20: Unexpected extension directive encountered after non-preprocessor tokens;
07-21 13:02:32.757: D/Unity(32680): ERROR: 1 compilation errors. No code generated.
07-21 13:02:32.759: D/Unity(32680): -------- Shader compilation failed

Is there anyone who can tell me how to solve this error?Thanks!

Hi,

Did you even find a way around this, i’m having the exact same problem.

Thanks,
Pascal.

Did either of you have any luck? I’m having the same issue at the moment.