Bug 238111 - ANGLE Metal: error during glLinkProgram (Internal error compiling shader with Metal backend)
Summary: ANGLE Metal: error during glLinkProgram (Internal error compiling shader with...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: WebKit Local Build
Hardware: Mac (Intel) macOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-19 06:03 PDT by Christoph
Modified: 2022-03-21 22:41 PDT (History)
4 users (show)

See Also:


Attachments
skeleton for the reproduction test (1.36 KB, text/html)
2022-03-21 22:30 PDT, Kimmo Kinnunen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph 2022-03-19 06:03:47 PDT
I am receiving the following error when calling "glLinkProgram" (so here I am):

> Internal error compiling shader with Metal backend.
> Please submit this shader, or website as a bug to https://bugs.webkit.org

I am trying compile and link an OpenGL ES 2.0 shader via ANGLE to Metal 
on Mac OS X. The same shader works fine via OpenGL ES directly (Mac OS X 
without ANGLE to Metal). Also, the same shader works fine for ANGLE to 
DirectX (Windows 10).

Something goes wrong when trying to link the shader via ANGLE to Metal!? 

**** VERTEX SHADER PART: 

#ifdef GL_ES                                         
  precision mediump float;                           
  #define TEXP mediump                               
  #define COLP lowp                                  
#else                                                
  #define TEXP                                       
  #define COLP                                       
#endif                                               
attribute vec4 a_pos;                                
attribute TEXP vec2 a_tex_uv;                        
attribute COLP vec4 a_col;                           
varying TEXP vec2 v_tex_uv;                          
varying COLP vec4 v_col;                             
void main()                                          
{                                                    
   gl_Position = a_pos;                              
   v_tex_uv = a_tex_uv;                              
   v_col = a_col;                                    
}                                                    

**** FRAGMENT SHADER PART:

#ifdef GL_ES                                         
  precision mediump float;                           
  #define TEXP mediump                               
  #define COLP lowp                                  
#else                                                
  #define TEXP                                       
  #define COLP                                       
#endif                                               
uniform sampler2D s_tex;                             
uniform float u_val;                                 
varying TEXP vec2 v_tex_uv;                          
varying COLP vec4 v_col;                             
void main()                                           
{                                                     
  gl_FragColor = texture2D(s_tex, v_tex_uv);          
  gl_FragColor *= v_col;                              
}                                                     
\
Comment 1 Christoph 2022-03-19 19:41:08 PDT
Please ignore the '\' at the end of my code samples (it's not in the code). I think I pressed the \-key instead of backspace on the keyboard when I submitted the bug.

I also run some additional test. I seems no matter how simple the code is, the error message still comes up. Also, the code seems to compile just fine. Adding a syntax error also is properly indicated when compiling, i.e. an error is outputted.

Is there another reason beside the GLGS code why this error message comes up during linking?
Comment 2 Kimmo Kinnunen 2022-03-21 22:30:58 PDT
Created attachment 455333 [details]
skeleton for the reproduction test
Comment 3 Radar WebKit Bug Importer 2022-03-21 22:31:09 PDT
<rdar://problem/90614282>
Comment 4 Kimmo Kinnunen 2022-03-21 22:41:12 PDT
Thank you for the report.
If you are using WebGL via Safari, please use provide more information:
- operating system version
- device type

Additionally you can use the skeleton reproduction test case to add your content and see if the bug appears. If it does, please attach a modified version. I could not immediately reproduce your problem.

If you are using ANGLE directly as part of C++ application, it would be best to:
1) have a simple project that reproduces the problem
2) file this issue in issue in ANGLE bug tracker directly https://bugs.chromium.org/p/angleproject/issues/list .

If you don't want to attach it to ANGLE bug tracker, you can of course attach it here too and I can forward it to ANGLE.

For the direct ANGLE case, you can query the shader info log (similar to what WebGL does) to get the translated shader and the error.