Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How could I use GL_OES_EGL_image_external extension on Unity5.1?

Discussion in 'Shaders' started by nean224, Jul 22, 2015.

  1. nean224

    nean224

    Joined:
    May 22, 2015
    Posts:
    2
    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!
     
  2. lumacode

    lumacode

    Joined:
    Mar 25, 2014
    Posts:
    8
    Hi,

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

    Thanks,
    Pascal.
     
  3. Ajr_1

    Ajr_1

    Joined:
    May 22, 2013
    Posts:
    20
    Did either of you have any luck? I'm having the same issue at the moment.