Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader compilation failed on macOS with openGL #131

Open
SergeevPavel opened this issue Sep 16, 2021 · 1 comment
Open

Shader compilation failed on macOS with openGL #131

SergeevPavel opened this issue Sep 16, 2021 · 1 comment

Comments

@SergeevPavel
Copy link
Collaborator

SergeevPavel commented Sep 16, 2021

macOS: 11.6
That's look a bit strange because isinf for float should be supported from glsl1.10.
maybe it's bug in macOS OpenGL support.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/isinf.xhtml

Shader compilation error
------------------------
   1	#version 110
   2	
   3	const float PRECISION = 4.0;
   4	const float MAX_FIXED_RESOLVE_LEVEL = 5.0;
   5	const float MAX_FIXED_SEGMENTS = 32.0;
   6	uniform vec4 sk_RTAdjust;
   7	uniform vec4 uaffineMatrix_Stage0;
   8	uniform vec2 utranslate_Stage0;
   9	attribute vec2 resolveLevel_and_idx;
  10	attribute vec4 p01;
  11	attribute vec4 p23;
  12	attribute vec2 fanPoint;
  13	float wangs_formula_max_fdiff_pow2_ff2f2f2f2f22(vec2 p0, vec2 p1, vec2 p2, vec2 p3, mat2 matrix) {
  14	    vec2 d0 = matrix * (((vec2(-2.0)) * (p1) + (p2)) + p0);
  15	    vec2 d1 = matrix * (((vec2(-2.0)) * (p2) + (p3)) + p1);
  16	    return max(dot(d0, d0), dot(d1, d1));
  17	}
  18	float wangs_formula_conic_pow2_fff2f2f2f(float _precision_, vec2 p0, vec2 p1, vec2 p2, float w) {
  19	    vec2 C = (min(min(p0, p1), p2) + max(max(p0, p1), p2)) * 0.5;
  20	    p0 -= C;
  21	    p1 -= C;
  22	    p2 -= C;
  23	    float m = sqrt(max(max(dot(p0, p0), dot(p1, p1)), dot(p2, p2)));
  24	    vec2 dp = ((vec2(-2.0 * w)) * (p1) + (p0)) + p2;
  25	    float dw = abs(((-2.0) * (w) + (2.0)));
  26	    float rp_minus_1 = max(0.0, ((m) * (_precision_) + (-1.0)));
  27	    float numer = length(dp) * _precision_ + rp_minus_1 * dw;
  28	    float denom = 4.0 * min(w, 1.0);
  29	    return numer / denom;
  30	}
  31	void main() {
  32	    mat2 AFFINE_MATRIX = mat2(uaffineMatrix_Stage0);
  33	    vec2 TRANSLATE = utranslate_Stage0;
  34	    float resolveLevel = resolveLevel_and_idx.x;
  35	    float idxInResolveLevel = resolveLevel_and_idx.y;
  36	    vec2 localcoord;
  37	    if (resolveLevel < 0.0) {
  38	        localcoord = fanPoint;
  39	    } else {
  40	        if (isinf(p23.z)) {
  41	            localcoord = resolveLevel != 0.0 ? p01.zw : (idxInResolveLevel != 0.0 ? p23.xy : p01.xy);
  42	        } else {
  43	            vec2 p0 = p01.xy;
  44	            vec2 p1 = p01.zw;
  45	            vec2 p2 = p23.xy;
  46	            vec2 p3 = p23.zw;
  47	            float w = -1.0;
  48	            float maxResolveLevel;
  49	            if (isinf(p23.w)) {
  50	                w = p3.x;
  51	                float _0_n2 = wangs_formula_conic_pow2_fff2f2f2f(PRECISION, AFFINE_MATRIX * p0, AFFINE_MATRIX * p1, AFFINE_MATRIX * p2, w);
  52	                maxResolveLevel = ceil(log2(max(_0_n2, 1.0)) * 0.5);
  53	                p1 *= w;
  54	                p3 = p2;
  55	            } else {
  56	                float _1_m = wangs_formula_max_fdiff_pow2_ff2f2f2f2f22(p0, p1, p2, p3, AFFINE_MATRIX);
  57	                maxResolveLevel = ceil(log2(max(9.0 * _1_m, 1.0)) * 0.25);
  58	            }
  59	            if (resolveLevel > maxResolveLevel) {
  60	                idxInResolveLevel = floor(idxInResolveLevel * exp2(maxResolveLevel - resolveLevel));
  61	                resolveLevel = maxResolveLevel;
  62	            }
  63	            float fixedVertexID = floor(0.5 + idxInResolveLevel * exp2(MAX_FIXED_RESOLVE_LEVEL - resolveLevel));
  64	            if (0.0 < fixedVertexID && fixedVertexID < MAX_FIXED_SEGMENTS) {
  65	                float T = fixedVertexID * 0.03125;
  66	                vec2 ab = mix(p0, p1, T);
  67	                vec2 bc = mix(p1, p2, T);
  68	                vec2 cd = mix(p2, p3, T);
  69	                vec2 abc = mix(ab, bc, T);
  70	                vec2 bcd = mix(bc, cd, T);
  71	                vec2 abcd = mix(abc, bcd, T);
  72	                float u = mix(1.0, w, T);
  73	                float v = (w + 1.0) - u;
  74	                float uv = mix(u, v, T);
  75	                localcoord = w < 0.0 ? abcd : abc / uv;
  76	            } else {
  77	                localcoord = fixedVertexID == 0.0 ? p0 : p3;
  78	            }
  79	        }
  80	    }
  81	    vec2 vertexpos = AFFINE_MATRIX * localcoord + TRANSLATE;
  82	    gl_Position = vec4(vertexpos, 0.0, 1.0);
  83	    gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w);
  84	}
  85	
Errors:
ERROR: 0:40: Invalid call of undeclared identifier 'isinf'
ERROR: 0:49: Invalid call of undeclared identifier 'isinf'
@tonsky
Copy link
Collaborator

tonsky commented Sep 16, 2021

Have you tried reporting to https://bugs.chromium.org/p/skia/issues/list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants