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

Skeleton2D not supported on devices with GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, should replace texture2DLod by software logic (like for 3D) [GLES2] #35143

Closed
akien-mga opened this issue Jan 15, 2020 · 6 comments

Comments

@akien-mga
Copy link
Member

Godot version:
3.2 master (bab91bd)

OS/device including version:
Samsung Galaxy S3, Mali 400: http://opengles.gpuinfo.org/displayreport.php?id=3407
Old GLES2-only device, running LineageOS 14 (Android 7.1.2).

Issue description:
Follow-up to GLES3 issue in similar configuration (#27919).

On the above described device, the Polygon2D character with textures and assigned Skeleton2D fails to render completely. It works OK on a newer device (Xiaomi Pocophone F1) with GLES2.

adb logcat points to a shader compilation error due to missing support for textureLod:

01-15 09:25:17.124  6469  6487 E godot   : **ERROR**: CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.124  6469  6487 E godot   : 3:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.124  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:129:_display_error_with_code() - CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.124  6469  6487 E godot   : 3:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Method/Function Failed, returning: __null
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:284:get_current_version() - Method/Function Failed, returning: __null
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: false
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:88:bind() - Condition ' !version ' is true. returned: false
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1

Full error log with for some reason two shader dumps with slightly different amount of errors (but they seem to be the same):

01-15 09:25:17.067  6469  6487 I godot   : 523: 
01-15 09:25:17.067  6469  6487 I godot   : 524: 	return ret;
01-15 09:25:17.067  6469  6487 I godot   : 525: }
01-15 09:25:17.067  6469  6487 I godot   : 526: 
01-15 09:25:17.068  6469  6487 I godot   : 527: void main() {
01-15 09:25:17.068  6469  6487 I godot   : 528: 
01-15 09:25:17.068  6469  6487 I godot   : 529: 	vec4 color = color_attrib;
01-15 09:25:17.068  6469  6487 I godot   : 530: 	vec2 uv;
01-15 09:25:17.068  6469  6487 I godot   : 531: 
01-15 09:25:17.068  6469  6487 I godot   : 532: #ifdef USE_INSTANCING
01-15 09:25:17.068  6469  6487 I godot   : 533: 	mat4 extra_matrix_instance = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)));
01-15 09:25:17.068  6469  6487 I godot   : 534: 	color *= instance_color;
01-15 09:25:17.068  6469  6487 I godot   : 535: 
01-15 09:25:17.068  6469  6487 I godot   : 536: #ifdef USE_INSTANCE_CUSTOM
01-15 09:25:17.068  6469  6487 I godot   : 537: 	vec4 instance_custom = instance_custom_data;
01-15 09:25:17.068  6469  6487 I godot   : 538: #else
01-15 09:25:17.068  6469  6487 I godot   : 539: 	vec4 instance_custom = vec4(0.0);
01-15 09:25:17.068  6469  6487 I godot   : 540: #endif
01-15 09:25:17.068  6469  6487 I godot   : 541: 
01-15 09:25:17.068  6469  6487 I godot   : 542: #else
01-15 09:25:17.068  6469  6487 I godot   : 543: 	mat4 extra_matrix_instance = extra_matrix;
01-15 09:25:17.069  6469  6487 I godot   : 544: 	vec4 instance_custom = vec4(0.0);
01-15 09:25:17.069  6469  6487 I godot   : 545: #endif
01-15 09:25:17.069  6469  6487 I godot   : 546: 
01-15 09:25:17.069  6469  6487 I godot   : 547: #ifdef USE_TEXTURE_RECT
01-15 09:25:17.069  6469  6487 I godot   : 548: 
01-15 09:25:17.069  6469  6487 I godot   : 549: 	if (dst_rect.z < 0.0) { // Transpose is encoded as negative dst_rect.z
01-15 09:25:17.069  6469  6487 I godot   : 550: 		uv = src_rect.xy + abs(src_rect.zw) * vertex.yx;
01-15 09:25:17.069  6469  6487 I godot   : 551: 	} else {
01-15 09:25:17.069  6469  6487 I godot   : 552: 		uv = src_rect.xy + abs(src_rect.zw) * vertex;
01-15 09:25:17.069  6469  6487 I godot   : 553: 	}
01-15 09:25:17.070  6469  6487 I godot   : 554: 
01-15 09:25:17.070  6469  6487 I godot   : 555: 	vec4 outvec = vec4(0.0, 0.0, 0.0, 1.0);
01-15 09:25:17.070  6469  6487 I godot   : 556: 
01-15 09:25:17.070  6469  6487 I godot   : 557: 	// This is what is done in the GLES 3 bindings and should
01-15 09:25:17.070  6469  6487 I godot   : 558: 	// take care of flipped rects.
01-15 09:25:17.070  6469  6487 I godot   : 559: 	//
01-15 09:25:17.070  6469  6487 I godot   : 560: 	// But it doesn't.
01-15 09:25:17.070  6469  6487 I godot   : 561: 	// I don't know why, will need to investigate further.
01-15 09:25:17.070  6469  6487 I godot   : 562: 
01-15 09:25:17.070  6469  6487 I godot   : 563: 	outvec.xy = dst_rect.xy + abs(dst_rect.zw) * select(vertex, vec2(1.0, 1.0) - vertex, lessThan(src_rect.zw, vec2(0.0, 0.0)));
01-15 09:25:17.070  6469  6487 I godot   : 564: 
01-15 09:25:17.070  6469  6487 I godot   : 565: 	// outvec.xy = dst_rect.xy + abs(dst_rect.zw) * vertex;
01-15 09:25:17.070  6469  6487 I godot   : 566: #else
01-15 09:25:17.070  6469  6487 I godot   : 567: 	vec4 outvec = vec4(vertex.xy, 0.0, 1.0);
01-15 09:25:17.070  6469  6487 I godot   : 568: 
01-15 09:25:17.070  6469  6487 I godot   : 569: 	uv = uv_attrib;
01-15 09:25:17.070  6469  6487 I godot   : 570: #endif
01-15 09:25:17.071  6469  6487 I godot   : 571: 
01-15 09:25:17.071  6469  6487 I godot   : 572: 	float point_size = 1.0;
01-15 09:25:17.071  6469  6487 I godot   : 573: 
01-15 09:25:17.071  6469  6487 I godot   : 574: 	{
01-15 09:25:17.071  6469  6487 I godot   : 575: 		vec2 src_vtx = outvec.xy;
01-15 09:25:17.071  6469  6487 I godot   : 576: 		/* clang-format off */
01-15 09:25:17.071  6469  6487 I godot   : 577: 
01-15 09:25:17.071  6469  6487 I godot   : 578: 
01-15 09:25:17.071  6469  6487 I godot   : 579: 		/* clang-format on */
01-15 09:25:17.071  6469  6487 I godot   : 580: 	}
01-15 09:25:17.071  6469  6487 I godot   : 581: 
01-15 09:25:17.071  6469  6487 I godot   : 582: 	gl_PointSize = point_size;
01-15 09:25:17.071  6469  6487 I godot   : 583: 
01-15 09:25:17.071  6469  6487 I godot   : 584: #if !defined(SKIP_TRANSFORM_USED)
01-15 09:25:17.071  6469  6487 I godot   : 585: 	outvec = extra_matrix_instance * outvec;
01-15 09:25:17.071  6469  6487 I godot   : 586: 	outvec = modelview_matrix * outvec;
01-15 09:25:17.071  6469  6487 I godot   : 587: #endif
01-15 09:25:17.071  6469  6487 I godot   : 588: 
01-15 09:25:17.071  6469  6487 I godot   : 589: 	color_interp = color;
01-15 09:25:17.071  6469  6487 I godot   : 590: 
01-15 09:25:17.071  6469  6487 I godot   : 591: #ifdef USE_PIXEL_SNAP
01-15 09:25:17.071  6469  6487 I godot   : 592: 	outvec.xy = floor(outvec + 0.5).xy;
01-15 09:25:17.072  6469  6487 I godot   : 593: 	// precision issue on some hardware creates artifacts within texture
01-15 09:25:17.072  6469  6487 I godot   : 594: 	// offset uv by a small amount to avoid
01-15 09:25:17.072  6469  6487 I godot   : 595: 	uv += 1e-5;
01-15 09:25:17.072  6469  6487 I godot   : 596: #endif
01-15 09:25:17.072  6469  6487 I godot   : 597: 
01-15 09:25:17.072  6469  6487 I godot   : 598: #ifdef USE_SKELETON
01-15 09:25:17.072  6469  6487 I godot   : 599: 
01-15 09:25:17.072  6469  6487 I godot   : 600: 	// look up transform from the "pose texture"
01-15 09:25:17.072  6469  6487 I godot   : 601: 	if (bone_weights != vec4(0.0)) {
01-15 09:25:17.072  6469  6487 I godot   : 602: 
01-15 09:25:17.072  6469  6487 I godot   : 603: 		highp mat4 bone_transform = mat4(0.0);
01-15 09:25:17.072  6469  6487 I godot   : 604: 
01-15 09:25:17.072  6469  6487 I godot   : 605: 		for (int i = 0; i < 4; i++) {
01-15 09:25:17.072  6469  6487 I godot   : 606: 			ivec2 tex_ofs = ivec2(int(bone_indices[i]) * 2, 0);
01-15 09:25:17.072  6469  6487 I godot   : 607: 
01-15 09:25:17.072  6469  6487 I godot   : 608: 			highp mat4 b = mat4(
01-15 09:25:17.072  6469  6487 I godot   : 609: 					texel2DFetch(skeleton_texture, skeleton_texture_size, tex_ofs + ivec2(0, 0)),
01-15 09:25:17.072  6469  6487 I godot   : 610: 					texel2DFetch(skeleton_texture, skeleton_texture_size, tex_ofs + ivec2(1, 0)),
01-15 09:25:17.072  6469  6487 I godot   : 611: 					vec4(0.0, 0.0, 1.0, 0.0),
01-15 09:25:17.072  6469  6487 I godot   : 612: 					vec4(0.0, 0.0, 0.0, 1.0));
01-15 09:25:17.072  6469  6487 I godot   : 613: 
01-15 09:25:17.073  6469  6487 I godot   : 614: 			bone_transform += b * bone_weights[i];
01-15 09:25:17.073  6469  6487 I godot   : 615: 		}
01-15 09:25:17.073  6469  6487 I godot   : 616: 
01-15 09:25:17.073  6469  6487 I godot   : 617: 		mat4 bone_matrix = skeleton_transform * transpose(bone_transform) * skeleton_transform_inverse;
01-15 09:25:17.073  6469  6487 I godot   : 618: 
01-15 09:25:17.073  6469  6487 I godot   : 619: 		outvec = bone_matrix * outvec;
01-15 09:25:17.073  6469  6487 I godot   : 620: 	}
01-15 09:25:17.073  6469  6487 I godot   : 621: 
01-15 09:25:17.073  6469  6487 I godot   : 622: #endif
01-15 09:25:17.073  6469  6487 I godot   : 623: 
01-15 09:25:17.073  6469  6487 I godot   : 624: 	uv_interp = uv;
01-15 09:25:17.073  6469  6487 I godot   : 625: 	gl_Position = projection_matrix * outvec;
01-15 09:25:17.073  6469  6487 I godot   : 626: 
01-15 09:25:17.073  6469  6487 I godot   : 627: #ifdef USE_LIGHTING
01-15 09:25:17.073  6469  6487 I godot   : 628: 
01-15 09:25:17.073  6469  6487 I godot   : 629: 	light_uv_interp.xy = (light_matrix * outvec).xy;
01-15 09:25:17.073  6469  6487 I godot   : 630: 	light_uv_interp.zw = (light_local_matrix * outvec).xy;
01-15 09:25:17.073  6469  6487 I godot   : 631: 
01-15 09:25:17.073  6469  6487 I godot   : 632: 	transformed_light_uv = (mat3(light_matrix_inverse) * vec3(light_uv_interp.zw, 0.0)).xy; //for normal mapping
01-15 09:25:17.073  6469  6487 I godot   : 633: 
01-15 09:25:17.073  6469  6487 I godot   : 634: #ifdef USE_SHADOWS
01-15 09:25:17.073  6469  6487 I godot   : 635: 	pos = outvec.xy;
01-15 09:25:17.074  6469  6487 I godot   : 636: #endif
01-15 09:25:17.074  6469  6487 I godot   : 637: 
01-15 09:25:17.074  6469  6487 I godot   : 638: 	local_rot.xy = normalize((modelview_matrix * (extra_matrix_instance * vec4(1.0, 0.0, 0.0, 0.0))).xy);
01-15 09:25:17.074  6469  6487 I godot   : 639: 	local_rot.zw = normalize((modelview_matrix * (extra_matrix_instance * vec4(0.0, 1.0, 0.0, 0.0))).xy);
01-15 09:25:17.074  6469  6487 I godot   : 640: #ifdef USE_TEXTURE_RECT
01-15 09:25:17.074  6469  6487 I godot   : 641: 	local_rot.xy *= sign(src_rect.z);
01-15 09:25:17.074  6469  6487 I godot   : 642: 	local_rot.zw *= sign(src_rect.w);
01-15 09:25:17.074  6469  6487 I godot   : 643: #endif
01-15 09:25:17.074  6469  6487 I godot   : 644: 
01-15 09:25:17.074  6469  6487 I godot   : 645: #endif
01-15 09:25:17.074  6469  6487 I godot   : 646: }
01-15 09:25:17.074  6469  6487 I godot   : 647: 
01-15 09:25:17.074  6469  6487 I godot   : 648: /* clang-format off */
01-15 09:25:17.074  6469  6487 I godot   : 649: 
01-15 09:25:17.074  6469  6487 E godot   : **ERROR**: CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.074  6469  6487 E godot   : 4:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.074  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:129:_display_error_with_code() - CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.074  6469  6487 E godot   : 4:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.076  6469  6487 E godot   : **ERROR**: Method/Function Failed, returning: __null
01-15 09:25:17.076  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:284:get_current_version() - Method/Function Failed, returning: __null
01-15 09:25:17.076  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: false
01-15 09:25:17.076  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:88:bind() - Condition ' !version ' is true. returned: false
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.077  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.088  6469  6487 W BlobCache: set: not caching because valueSize is 0
01-15 09:25:17.093  6469  6487 I godot   : 1: #version 100
01-15 09:25:17.093  6469  6487 I godot   : 2: #define USE_SKELETON
01-15 09:25:17.093  6469  6487 I godot   : 3: #define USE_RGBA_SHADOWS
01-15 09:25:17.094  6469  6487 I godot   : 4: 
01-15 09:25:17.094  6469  6487 I godot   : 5: #ifdef USE_GLES_OVER_GL
01-15 09:25:17.094  6469  6487 I godot   : 6: #define lowp
01-15 09:25:17.094  6469  6487 I godot   : 7: #define mediump
01-15 09:25:17.094  6469  6487 I godot   : 8: #define highp
01-15 09:25:17.094  6469  6487 I godot   : 9: #else
01-15 09:25:17.094  6469  6487 I godot   : 10: precision highp float;
01-15 09:25:17.094  6469  6487 I godot   : 11: precision highp int;
01-15 09:25:17.094  6469  6487 I godot   : 12: #endif
01-15 09:25:17.094  6469  6487 I godot   : 13: 
01-15 09:25:17.094  6469  6487 I godot   : 14: uniform highp mat4 projection_matrix;
01-15 09:25:17.094  6469  6487 I godot   : 15: /* clang-format on */
01-15 09:25:17.094  6469  6487 I godot   : 16: 
01-15 09:25:17.094  6469  6487 I godot   : 17: 
01-15 09:25:17.094  6469  6487 I godot   : 18: vec2 select2(vec2 a, vec2 b, bvec2 c) {
01-15 09:25:17.094  6469  6487 I godot   : 19: 	vec2 ret;
01-15 09:25:17.094  6469  6487 I godot   : 20: 
01-15 09:25:17.094  6469  6487 I godot   : 21: 	ret.x = c.x ? b.x : a.x;
01-15 09:25:17.094  6469  6487 I godot   : 22: 	ret.y = c.y ? b.y : a.y;
01-15 09:25:17.094  6469  6487 I godot   : 23: 
01-15 09:25:17.095  6469  6487 I godot   : 24: 	return ret;
01-15 09:25:17.095  6469  6487 I godot   : 25: }
01-15 09:25:17.095  6469  6487 I godot   : 26: 
01-15 09:25:17.095  6469  6487 I godot   : 27: vec3 select3(vec3 a, vec3 b, bvec3 c) {
01-15 09:25:17.095  6469  6487 I godot   : 28: 	vec3 ret;
01-15 09:25:17.095  6469  6487 I godot   : 29: 
01-15 09:25:17.095  6469  6487 I godot   : 30: 	ret.x = c.x ? b.x : a.x;
01-15 09:25:17.095  6469  6487 I godot   : 31: 	ret.y = c.y ? b.y : a.y;
01-15 09:25:17.095  6469  6487 I godot   : 32: 	ret.z = c.z ? b.z : a.z;
01-15 09:25:17.095  6469  6487 I godot   : 33: 
01-15 09:25:17.095  6469  6487 I godot   : 34: 	return ret;
01-15 09:25:17.095  6469  6487 I godot   : 35: }
01-15 09:25:17.095  6469  6487 I godot   : 36: 
01-15 09:25:17.095  6469  6487 I godot   : 37: vec4 select4(vec4 a, vec4 b, bvec4 c) {
01-15 09:25:17.095  6469  6487 I godot   : 38: 	vec4 ret;
01-15 09:25:17.095  6469  6487 I godot   : 39: 
01-15 09:25:17.095  6469  6487 I godot   : 40: 	ret.x = c.x ? b.x : a.x;
01-15 09:25:17.095  6469  6487 I godot   : 41: 	ret.y = c.y ? b.y : a.y;
01-15 09:25:17.095  6469  6487 I godot   : 42: 	ret.z = c.z ? b.z : a.z;
01-15 09:25:17.095  6469  6487 I godot   : 43: 	ret.w = c.w ? b.w : a.w;
01-15 09:25:17.095  6469  6487 I godot   : 44: 
01-15 09:25:17.096  6469  6487 I godot   : 45: 	return ret;
01-15 09:25:17.096  6469  6487 I godot   : 46: }
01-15 09:25:17.096  6469  6487 I godot   : 47: 
01-15 09:25:17.096  6469  6487 I godot   : 48: highp vec4 texel2DFetch(highp sampler2D tex, ivec2 size, ivec2 coord) {
01-15 09:25:17.096  6469  6487 I godot   : 49: 	float x_coord = float(2 * coord.x + 1) / float(size.x * 2);
01-15 09:25:17.096  6469  6487 I godot   : 50: 	float y_coord = float(2 * coord.y + 1) / float(size.y * 2);
01-15 09:25:17.096  6469  6487 I godot   : 51: 
01-15 09:25:17.096  6469  6487 I godot   : 52: 	return texture2DLod(tex, vec2(x_coord, y_coord), 0.0);
01-15 09:25:17.096  6469  6487 I godot   : 53: }
01-15 09:25:17.096  6469  6487 I godot   : 54: 
01-15 09:25:17.096  6469  6487 I godot   : 55: #if defined(SINH_USED)
01-15 09:25:17.096  6469  6487 I godot   : 56: 
01-15 09:25:17.096  6469  6487 I godot   : 57: highp float sinh(highp float x) {
01-15 09:25:17.096  6469  6487 I godot   : 58: 	return 0.5 * (exp(x) - exp(-x));
01-15 09:25:17.096  6469  6487 I godot   : 59: }
01-15 09:25:17.096  6469  6487 I godot   : 60: 
01-15 09:25:17.096  6469  6487 I godot   : 61: highp vec2 sinh(highp vec2 x) {
01-15 09:25:17.096  6469  6487 I godot   : 62: 	return 0.5 * vec2(exp(x.x) - exp(-x.x), exp(x.y) - exp(-x.y));
01-15 09:25:17.096  6469  6487 I godot   : 63: }
01-15 09:25:17.096  6469  6487 I godot   : 64: 
01-15 09:25:17.096  6469  6487 I godot   : 65: highp vec3 sinh(highp vec3 x) {
01-15 09:25:17.096  6469  6487 I godot   : 66: 	return 0.5 * vec3(exp(x.x) - exp(-x.x), exp(x.y) - exp(-x.y), exp(x.z) - exp(-x.z));
01-15 09:25:17.096  6469  6487 I godot   : 67: }
01-15 09:25:17.096  6469  6487 I godot   : 68: 
01-15 09:25:17.096  6469  6487 I godot   : 69: highp vec4 sinh(highp vec4 x) {
01-15 09:25:17.097  6469  6487 I godot   : 70: 	return 0.5 * vec4(exp(x.x) - exp(-x.x), exp(x.y) - exp(-x.y), exp(x.z) - exp(-x.z), exp(x.w) - exp(-x.w));
01-15 09:25:17.097  6469  6487 I godot   : 71: }
01-15 09:25:17.097  6469  6487 I godot   : 72: 
01-15 09:25:17.097  6469  6487 I godot   : 73: #endif
01-15 09:25:17.097  6469  6487 I godot   : 74: 
01-15 09:25:17.097  6469  6487 I godot   : 75: #if defined(COSH_USED)
01-15 09:25:17.097  6469  6487 I godot   : 76: 
01-15 09:25:17.097  6469  6487 I godot   : 77: highp float cosh(highp float x) {
01-15 09:25:17.097  6469  6487 I godot   : 78: 	return 0.5 * (exp(x) + exp(-x));
01-15 09:25:17.097  6469  6487 I godot   : 79: }
01-15 09:25:17.097  6469  6487 I godot   : 80: 
01-15 09:25:17.097  6469  6487 I godot   : 81: highp vec2 cosh(highp vec2 x) {
01-15 09:25:17.097  6469  6487 I godot   : 82: 	return 0.5 * vec2(exp(x.x) + exp(-x.x), exp(x.y) + exp(-x.y));
01-15 09:25:17.097  6469  6487 I godot   : 83: }
01-15 09:25:17.097  6469  6487 I godot   : 84: 
01-15 09:25:17.097  6469  6487 I godot   : 85: highp vec3 cosh(highp vec3 x) {
01-15 09:25:17.097  6469  6487 I godot   : 86: 	return 0.5 * vec3(exp(x.x) + exp(-x.x), exp(x.y) + exp(-x.y), exp(x.z) + exp(-x.z));
01-15 09:25:17.097  6469  6487 I godot   : 87: }
01-15 09:25:17.097  6469  6487 I godot   : 88: 
01-15 09:25:17.097  6469  6487 I godot   : 89: highp vec4 cosh(highp vec4 x) {
01-15 09:25:17.097  6469  6487 I godot   : 90: 	return 0.5 * vec4(exp(x.x) + exp(-x.x), exp(x.y) + exp(-x.y), exp(x.z) + exp(-x.z), exp(x.w) + exp(-x.w));
01-15 09:25:17.097  6469  6487 I godot   : 91: }
01-15 09:25:17.097  6469  6487 I godot   : 92: 
01-15 09:25:17.097  6469  6487 I godot   : 93: #endif
01-15 09:25:17.098  6469  6487 I godot   : 94: 
01-15 09:25:17.098  6469  6487 I godot   : 95: #if defined(TANH_USED)
01-15 09:25:17.098  6469  6487 I godot   : 96: 
01-15 09:25:17.098  6469  6487 I godot   : 97: highp float tanh(highp float x) {
01-15 09:25:17.098  6469  6487 I godot   : 98: 	highp float exp2x = exp(2.0 * x);
01-15 09:25:17.098  6469  6487 I godot   : 99: 	return (exp2x - 1.0) / (exp2x + 1.0);
01-15 09:25:17.098  6469  6487 I godot   : 100: }
01-15 09:25:17.098  6469  6487 I godot   : 101: 
01-15 09:25:17.098  6469  6487 I godot   : 102: highp vec2 tanh(highp vec2 x) {
01-15 09:25:17.098  6469  6487 I godot   : 103: 	highp float exp2x = exp(2.0 * x.x);
01-15 09:25:17.098  6469  6487 I godot   : 104: 	highp float exp2y = exp(2.0 * x.y);
01-15 09:25:17.098  6469  6487 I godot   : 105: 	return vec2((exp2x - 1.0) / (exp2x + 1.0), (exp2y - 1.0) / (exp2y + 1.0));
01-15 09:25:17.098  6469  6487 I godot   : 106: }
01-15 09:25:17.098  6469  6487 I godot   : 107: 
01-15 09:25:17.098  6469  6487 I godot   : 108: highp vec3 tanh(highp vec3 x) {
01-15 09:25:17.098  6469  6487 I godot   : 109: 	highp float exp2x = exp(2.0 * x.x);
01-15 09:25:17.098  6469  6487 I godot   : 110: 	highp float exp2y = exp(2.0 * x.y);
01-15 09:25:17.098  6469  6487 I godot   : 111: 	highp float exp2z = exp(2.0 * x.z);
01-15 09:25:17.098  6469  6487 I godot   : 112: 	return vec3((exp2x - 1.0) / (exp2x + 1.0), (exp2y - 1.0) / (exp2y + 1.0), (exp2z - 1.0) / (exp2z + 1.0));
01-15 09:25:17.098  6469  6487 I godot   : 113: }
01-15 09:25:17.098  6469  6487 I godot   : 114: 
01-15 09:25:17.098  6469  6487 I godot   : 115: highp vec4 tanh(highp vec4 x) {
01-15 09:25:17.098  6469  6487 I godot   : 116: 	highp float exp2x = exp(2.0 * x.x);
01-15 09:25:17.099  6469  6487 I godot   : 117: 	highp float exp2y = exp(2.0 * x.y);
01-15 09:25:17.099  6469  6487 I godot   : 118: 	highp float exp2z = exp(2.0 * x.z);
01-15 09:25:17.099  6469  6487 I godot   : 119: 	highp float exp2w = exp(2.0 * x.w);
01-15 09:25:17.099  6469  6487 I godot   : 120: 	return vec4((exp2x - 1.0) / (exp2x + 1.0), (exp2y - 1.0) / (exp2y + 1.0), (exp2z - 1.0) / (exp2z + 1.0), (exp2w - 1.0) / (exp2w + 1.0));
01-15 09:25:17.099  6469  6487 I godot   : 121: }
01-15 09:25:17.099  6469  6487 I godot   : 122: 
01-15 09:25:17.099  6469  6487 I godot   : 123: #endif
01-15 09:25:17.099  6469  6487 I godot   : 124: 
01-15 09:25:17.099  6469  6487 I godot   : 125: #if defined(ASINH_USED)
01-15 09:25:17.099  6469  6487 I godot   : 126: 
01-15 09:25:17.099  6469  6487 I godot   : 127: highp float asinh(highp float x) {
01-15 09:25:17.099  6469  6487 I godot   : 128: 	return sign(x) * log(abs(x) + sqrt(1.0 + x * x));
01-15 09:25:17.099  6469  6487 I godot   : 129: }
01-15 09:25:17.099  6469  6487 I godot   : 130: 
01-15 09:25:17.099  6469  6487 I godot   : 131: highp vec2 asinh(highp vec2 x) {
01-15 09:25:17.099  6469  6487 I godot   : 132: 	return vec2(sign(x.x) * log(abs(x.x) + sqrt(1.0 + x.x * x.x)), sign(x.y) * log(abs(x.y) + sqrt(1.0 + x.y * x.y)));
01-15 09:25:17.099  6469  6487 I godot   : 133: }
01-15 09:25:17.099  6469  6487 I godot   : 134: 
01-15 09:25:17.099  6469  6487 I godot   : 135: highp vec3 asinh(highp vec3 x) {
01-15 09:25:17.099  6469  6487 I godot   : 136: 	return vec3(sign(x.x) * log(abs(x.x) + sqrt(1.0 + x.x * x.x)), sign(x.y) * log(abs(x.y) + sqrt(1.0 + x.y * x.y)), sign(x.z) * log(abs(x.z) + sqrt(1.0 + x.z * x.z)));
01-15 09:25:17.099  6469  6487 I godot   : 137: }
01-15 09:25:17.101  6469  6487 I godot   : 138: 
01-15 09:25:17.102  6469  6487 I godot   : 139: highp vec4 asinh(highp vec4 x) {
01-15 09:25:17.102  6469  6487 I godot   : 140: 	return vec4(sign(x.x) * log(abs(x.x) + sqrt(1.0 + x.x * x.x)), sign(x.y) * log(abs(x.y) + sqrt(1.0 + x.y * x.y)), sign(x.z) * log(abs(x.z) + sqrt(1.0 + x.z * x.z)), sign(x.w) * log(abs(x.w) + sqrt(1.0 + x.w * x.w)));
01-15 09:25:17.102  6469  6487 I godot   : 141: }
01-15 09:25:17.102  6469  6487 I godot   : 142: 
01-15 09:25:17.102  6469  6487 I godot   : 143: #endif
01-15 09:25:17.102  6469  6487 I godot   : 144: 
01-15 09:25:17.102  6469  6487 I godot   : 145: #if defined(ACOSH_USED)
01-15 09:25:17.102  6469  6487 I godot   : 146: 
01-15 09:25:17.102  6469  6487 I godot   : 147: highp float acosh(highp float x) {
01-15 09:25:17.102  6469  6487 I godot   : 148: 	return log(x + sqrt(x * x - 1.0));
01-15 09:25:17.102  6469  6487 I godot   : 149: }
01-15 09:25:17.102  6469  6487 I godot   : 150: 
01-15 09:25:17.102  6469  6487 I godot   : 151: highp vec2 acosh(highp vec2 x) {
01-15 09:25:17.102  6469  6487 I godot   : 152: 	return vec2(log(x.x + sqrt(x.x * x.x - 1.0)), log(x.y + sqrt(x.y * x.y - 1.0)));
01-15 09:25:17.102  6469  6487 I godot   : 153: }
01-15 09:25:17.102  6469  6487 I godot   : 154: 
01-15 09:25:17.102  6469  6487 I godot   : 155: highp vec3 acosh(highp vec3 x) {
01-15 09:25:17.102  6469  6487 I godot   : 156: 	return vec3(log(x.x + sqrt(x.x * x.x - 1.0)), log(x.y + sqrt(x.y * x.y - 1.0)), log(x.z + sqrt(x.z * x.z - 1.0)));
01-15 09:25:17.102  6469  6487 I godot   : 157: }
01-15 09:25:17.102  6469  6487 I godot   : 158: 
01-15 09:25:17.102  6469  6487 I godot   : 159: highp vec4 acosh(highp vec4 x) {
01-15 09:25:17.102  6469  6487 I godot   : 160: 	return vec4(log(x.x + sqrt(x.x * x.x - 1.0)), log(x.y + sqrt(x.y * x.y - 1.0)), log(x.z + sqrt(x.z * x.z - 1.0)), log(x.w + sqrt(x.w * x.w - 1.0)));
01-15 09:25:17.102  6469  6487 I godot   : 161: }
01-15 09:25:17.102  6469  6487 I godot   : 162: 
01-15 09:25:17.103  6469  6487 I godot   : 163: #endif
01-15 09:25:17.103  6469  6487 I godot   : 164: 
01-15 09:25:17.103  6469  6487 I godot   : 165: #if defined(ATANH_USED)
01-15 09:25:17.103  6469  6487 I godot   : 166: 
01-15 09:25:17.103  6469  6487 I godot   : 167: highp float atanh(highp float x) {
01-15 09:25:17.103  6469  6487 I godot   : 168: 	return 0.5 * log((1.0 + x) / (1.0 - x));
01-15 09:25:17.103  6469  6487 I godot   : 169: }
01-15 09:25:17.103  6469  6487 I godot   : 170: 
01-15 09:25:17.103  6469  6487 I godot   : 171: highp vec2 atanh(highp vec2 x) {
01-15 09:25:17.103  6469  6487 I godot   : 172: 	return 0.5 * vec2(log((1.0 + x.x) / (1.0 - x.x)), log((1.0 + x.y) / (1.0 - x.y)));
01-15 09:25:17.103  6469  6487 I godot   : 173: }
01-15 09:25:17.103  6469  6487 I godot   : 174: 
01-15 09:25:17.103  6469  6487 I godot   : 175: highp vec3 atanh(highp vec3 x) {
01-15 09:25:17.103  6469  6487 I godot   : 176: 	return 0.5 * vec3(log((1.0 + x.x) / (1.0 - x.x)), log((1.0 + x.y) / (1.0 - x.y)), log((1.0 + x.z) / (1.0 - x.z)));
01-15 09:25:17.103  6469  6487 I godot   : 177: }
01-15 09:25:17.103  6469  6487 I godot   : 178: 
01-15 09:25:17.103  6469  6487 I godot   : 179: highp vec4 atanh(highp vec4 x) {
01-15 09:25:17.103  6469  6487 I godot   : 180: 	return 0.5 * vec4(log((1.0 + x.x) / (1.0 - x.x)), log((1.0 + x.y) / (1.0 - x.y)), log((1.0 + x.z) / (1.0 - x.z)), log((1.0 + x.w) / (1.0 - x.w)));
01-15 09:25:17.103  6469  6487 I godot   : 181: }
01-15 09:25:17.103  6469  6487 I godot   : 182: 
01-15 09:25:17.103  6469  6487 I godot   : 183: #endif
01-15 09:25:17.103  6469  6487 I godot   : 184: 
01-15 09:25:17.103  6469  6487 I godot   : 185: #if defined(ROUND_USED)
01-15 09:25:17.103  6469  6487 I godot   : 186: 
01-15 09:25:17.104  6469  6487 I godot   : 187: highp float round(highp float x) {
01-15 09:25:17.104  6469  6487 I godot   : 188: 	return floor(x + 0.5);
01-15 09:25:17.104  6469  6487 I godot   : 189: }
01-15 09:25:17.104  6469  6487 I godot   : 190: 
01-15 09:25:17.104  6469  6487 I godot   : 191: highp vec2 round(highp vec2 x) {
01-15 09:25:17.104  6469  6487 I godot   : 192: 	return floor(x + vec2(0.5));
01-15 09:25:17.104  6469  6487 I godot   : 193: }
01-15 09:25:17.104  6469  6487 I godot   : 194: 
01-15 09:25:17.104  6469  6487 I godot   : 195: highp vec3 round(highp vec3 x) {
01-15 09:25:17.104  6469  6487 I godot   : 196: 	return floor(x + vec3(0.5));
01-15 09:25:17.104  6469  6487 I godot   : 197: }
01-15 09:25:17.104  6469  6487 I godot   : 198: 
01-15 09:25:17.104  6469  6487 I godot   : 199: highp vec4 round(highp vec4 x) {
01-15 09:25:17.104  6469  6487 I godot   : 200: 	return floor(x + vec4(0.5));
01-15 09:25:17.104  6469  6487 I godot   : 201: }
01-15 09:25:17.104  6469  6487 I godot   : 202: 
01-15 09:25:17.104  6469  6487 I godot   : 203: #endif
01-15 09:25:17.104  6469  6487 I godot   : 204: 
01-15 09:25:17.104  6469  6487 I godot   : 205: #if defined(ROUND_EVEN_USED)
01-15 09:25:17.104  6469  6487 I godot   : 206: 
01-15 09:25:17.104  6469  6487 I godot   : 207: highp float roundEven(highp float x) {
01-15 09:25:17.104  6469  6487 I godot   : 208: 	highp float t = x + 0.5;
01-15 09:25:17.104  6469  6487 I godot   : 209: 	highp float f = floor(t);
01-15 09:25:17.105  6469  6487 I godot   : 210: 	highp float r;
01-15 09:25:17.105  6469  6487 I godot   : 211: 	if (t == f) {
01-15 09:25:17.105  6469  6487 I godot   : 212: 		if (x > 0)
01-15 09:25:17.105  6469  6487 I godot   : 213: 			r = f - mod(f, 2);
01-15 09:25:17.105  6469  6487 I godot   : 214: 		else
01-15 09:25:17.105  6469  6487 I godot   : 215: 			r = f + mod(f, 2);
01-15 09:25:17.105  6469  6487 I godot   : 216: 	} else
01-15 09:25:17.105  6469  6487 I godot   : 217: 		r = f;
01-15 09:25:17.105  6469  6487 I godot   : 218: 	return r;
01-15 09:25:17.105  6469  6487 I godot   : 219: }
01-15 09:25:17.105  6469  6487 I godot   : 220: 
01-15 09:25:17.105  6469  6487 I godot   : 221: highp vec2 roundEven(highp vec2 x) {
01-15 09:25:17.105  6469  6487 I godot   : 222: 	return vec2(roundEven(x.x), roundEven(x.y));
01-15 09:25:17.105  6469  6487 I godot   : 223: }
01-15 09:25:17.105  6469  6487 I godot   : 224: 
01-15 09:25:17.105  6469  6487 I godot   : 225: highp vec3 roundEven(highp vec3 x) {
01-15 09:25:17.105  6469  6487 I godot   : 226: 	return vec3(roundEven(x.x), roundEven(x.y), roundEven(x.z));
01-15 09:25:17.105  6469  6487 I godot   : 227: }
01-15 09:25:17.105  6469  6487 I godot   : 228: 
01-15 09:25:17.105  6469  6487 I godot   : 229: highp vec4 roundEven(highp vec4 x) {
01-15 09:25:17.105  6469  6487 I godot   : 230: 	return vec4(roundEven(x.x), roundEven(x.y), roundEven(x.z), roundEven(x.w));
01-15 09:25:17.105  6469  6487 I godot   : 231: }
01-15 09:25:17.105  6469  6487 I godot   : 232: 
01-15 09:25:17.105  6469  6487 I godot   : 233: #endif
01-15 09:25:17.106  6469  6487 I godot   : 234: 
01-15 09:25:17.106  6469  6487 I godot   : 235: #if defined(IS_INF_USED)
01-15 09:25:17.106  6469  6487 I godot   : 236: 
01-15 09:25:17.106  6469  6487 I godot   : 237: bool isinf(highp float x) {
01-15 09:25:17.106  6469  6487 I godot   : 238: 	return (2 * x == x) && (x != 0);
01-15 09:25:17.106  6469  6487 I godot   : 239: }
01-15 09:25:17.106  6469  6487 I godot   : 240: 
01-15 09:25:17.106  6469  6487 I godot   : 241: bvec2 isinf(highp vec2 x) {
01-15 09:25:17.106  6469  6487 I godot   : 242: 	return bvec2((2 * x.x == x.x) && (x.x != 0), (2 * x.y == x.y) && (x.y != 0));
01-15 09:25:17.106  6469  6487 I godot   : 243: }
01-15 09:25:17.106  6469  6487 I godot   : 244: 
01-15 09:25:17.106  6469  6487 I godot   : 245: bvec3 isinf(highp vec3 x) {
01-15 09:25:17.106  6469  6487 I godot   : 246: 	return bvec3((2 * x.x == x.x) && (x.x != 0), (2 * x.y == x.y) && (x.y != 0), (2 * x.z == x.z) && (x.z != 0));
01-15 09:25:17.106  6469  6487 I godot   : 247: }
01-15 09:25:17.106  6469  6487 I godot   : 248: 
01-15 09:25:17.106  6469  6487 I godot   : 249: bvec4 isinf(highp vec4 x) {
01-15 09:25:17.106  6469  6487 I godot   : 250: 	return bvec4((2 * x.x == x.x) && (x.x != 0), (2 * x.y == x.y) && (x.y != 0), (2 * x.z == x.z) && (x.z != 0), (2 * x.w == x.w) && (x.w != 0));
01-15 09:25:17.106  6469  6487 I godot   : 251: }
01-15 09:25:17.106  6469  6487 I godot   : 252: 
01-15 09:25:17.106  6469  6487 I godot   : 253: #endif
01-15 09:25:17.106  6469  6487 I godot   : 254: 
01-15 09:25:17.106  6469  6487 I godot   : 255: #if defined(IS_NAN_USED)
01-15 09:25:17.106  6469  6487 I godot   : 256: 
01-15 09:25:17.106  6469  6487 I godot   : 257: bool isnan(highp float x) {
01-15 09:25:17.106  6469  6487 I godot   : 258: 	return x != x;
01-15 09:25:17.107  6469  6487 I godot   : 259: }
01-15 09:25:17.107  6469  6487 I godot   : 260: 
01-15 09:25:17.107  6469  6487 I godot   : 261: bvec2 isnan(highp vec2 x) {
01-15 09:25:17.107  6469  6487 I godot   : 262: 	return bvec2(x.x != x.x, x.y != x.y);
01-15 09:25:17.107  6469  6487 I godot   : 263: }
01-15 09:25:17.107  6469  6487 I godot   : 264: 
01-15 09:25:17.107  6469  6487 I godot   : 265: bvec3 isnan(highp vec3 x) {
01-15 09:25:17.107  6469  6487 I godot   : 266: 	return bvec3(x.x != x.x, x.y != x.y, x.z != x.z);
01-15 09:25:17.107  6469  6487 I godot   : 267: }
01-15 09:25:17.107  6469  6487 I godot   : 268: 
01-15 09:25:17.107  6469  6487 I godot   : 269: bvec4 isnan(highp vec4 x) {
01-15 09:25:17.107  6469  6487 I godot   : 270: 	return bvec4(x.x != x.x, x.y != x.y, x.z != x.z, x.w != x.w);
01-15 09:25:17.107  6469  6487 I godot   : 271: }
01-15 09:25:17.107  6469  6487 I godot   : 272: 
01-15 09:25:17.107  6469  6487 I godot   : 273: #endif
01-15 09:25:17.107  6469  6487 I godot   : 274: 
01-15 09:25:17.107  6469  6487 I godot   : 275: #if defined(TRUNC_USED)
01-15 09:25:17.107  6469  6487 I godot   : 276: 
01-15 09:25:17.107  6469  6487 I godot   : 277: highp float trunc(highp float x) {
01-15 09:25:17.107  6469  6487 I godot   : 278: 	return x < 0 ? -floor(-x) : floor(x);
01-15 09:25:17.107  6469  6487 I godot   : 279: }
01-15 09:25:17.107  6469  6487 I godot   : 280: 
01-15 09:25:17.107  6469  6487 I godot   : 281: highp vec2 trunc(highp vec2 x) {
01-15 09:25:17.107  6469  6487 I godot   : 282: 	return vec2(x.x < 0 ? -floor(-x.x) : floor(x.x), x.y < 0 ? -floor(-x.y) : floor(x.y));
01-15 09:25:17.108  6469  6487 I godot   : 283: }
01-15 09:25:17.108  6469  6487 I godot   : 284: 
01-15 09:25:17.108  6469  6487 I godot   : 285: highp vec3 trunc(highp vec3 x) {
01-15 09:25:17.108  6469  6487 I godot   : 286: 	return vec3(x.x < 0 ? -floor(-x.x) : floor(x.x), x.y < 0 ? -floor(-x.y) : floor(x.y), x.z < 0 ? -floor(-x.z) : floor(x.z));
01-15 09:25:17.108  6469  6487 I godot   : 287: }
01-15 09:25:17.108  6469  6487 I godot   : 288: 
01-15 09:25:17.108  6469  6487 I godot   : 289: highp vec4 trunc(highp vec4 x) {
01-15 09:25:17.108  6469  6487 I godot   : 290: 	return vec4(x.x < 0 ? -floor(-x.x) : floor(x.x), x.y < 0 ? -floor(-x.y) : floor(x.y), x.z < 0 ? -floor(-x.z) : floor(x.z), x.w < 0 ? -floor(-x.w) : floor(x.w));
01-15 09:25:17.108  6469  6487 I godot   : 291: }
01-15 09:25:17.108  6469  6487 I godot   : 292: 
01-15 09:25:17.108  6469  6487 I godot   : 293: #endif
01-15 09:25:17.108  6469  6487 I godot   : 294: 
01-15 09:25:17.108  6469  6487 I godot   : 295: #if defined(DETERMINANT_USED)
01-15 09:25:17.108  6469  6487 I godot   : 296: 
01-15 09:25:17.108  6469  6487 I godot   : 297: highp float determinant(highp mat2 m) {
01-15 09:25:17.108  6469  6487 I godot   : 298: 	return m[0].x * m[1].y - m[1].x * m[0].y;
01-15 09:25:17.108  6469  6487 I godot   : 299: }
01-15 09:25:17.108  6469  6487 I godot   : 300: 
01-15 09:25:17.108  6469  6487 I godot   : 301: highp float determinant(highp mat3 m) {
01-15 09:25:17.108  6469  6487 I godot   : 302: 	return m[0].x * (m[1].y * m[2].z - m[2].y * m[1].z) - m[1].x * (m[0].y * m[2].z - m[2].y * m[0].z) + m[2].x * (m[0].y * m[1].z - m[1].y * m[0].z);
01-15 09:25:17.108  6469  6487 I godot   : 303: }
01-15 09:25:17.108  6469  6487 I godot   : 304: 
01-15 09:25:17.108  6469  6487 I godot   : 305: highp float determinant(highp mat4 m) {
01-15 09:25:17.108  6469  6487 I godot   : 306: 	highp float s00 = m[2].z * m[3].w - m[3].z * m[2].w;
01-15 09:25:17.109  6469  6487 I godot   : 307: 	highp float s01 = m[2].y * m[3].w - m[3].y * m[2].w;
01-15 09:25:17.109  6469  6487 I godot   : 308: 	highp float s02 = m[2].y * m[3].z - m[3].y * m[2].z;
01-15 09:25:17.109  6469  6487 I godot   : 309: 	highp float s03 = m[2].x * m[3].w - m[3].x * m[2].w;
01-15 09:25:17.109  6469  6487 I godot   : 310: 	highp float s04 = m[2].x * m[3].z - m[3].x * m[2].z;
01-15 09:25:17.109  6469  6487 I godot   : 311: 	highp float s05 = m[2].x * m[3].y - m[3].x * m[2].y;
01-15 09:25:17.109  6469  6487 I godot   : 312: 	highp vec4 c = vec4((m[1].y * s00 - m[1].z * s01 + m[1].w * s02), -(m[1].x * s00 - m[1].z * s03 + m[1].w * s04), (m[1].x * s01 - m[1].y * s03 + m[1].w * s05), -(m[1].x * s02 - m[1].y * s04 + m[1].z * s05));
01-15 09:25:17.109  6469  6487 I godot   : 313: 	return m[0].x * c.x + m[0].y * c.y + m[0].z * c.z + m[0].w * c.w;
01-15 09:25:17.109  6469  6487 I godot   : 314: }
01-15 09:25:17.109  6469  6487 I godot   : 315: 
01-15 09:25:17.109  6469  6487 I godot   : 316: #endif
01-15 09:25:17.109  6469  6487 I godot   : 317: 
01-15 09:25:17.109  6469  6487 I godot   : 318: #if defined(INVERSE_USED)
01-15 09:25:17.109  6469  6487 I godot   : 319: 
01-15 09:25:17.109  6469  6487 I godot   : 320: highp mat2 inverse(highp mat2 m) {
01-15 09:25:17.109  6469  6487 I godot   : 321: 	highp float d = 1.0 / (m[0].x * m[1].y - m[1].x * m[0].y);
01-15 09:25:17.109  6469  6487 I godot   : 322: 	return mat2(
01-15 09:25:17.109  6469  6487 I godot   : 323: 			vec2(m[1].y * d, -m[0].y * d),
01-15 09:25:17.109  6469  6487 I godot   : 324: 			vec2(-m[1].x * d, m[0].x * d));
01-15 09:25:17.109  6469  6487 I godot   : 325: }
01-15 09:25:17.109  6469  6487 I godot   : 326: 
01-15 09:25:17.109  6469  6487 I godot   : 327: highp mat3 inverse(highp mat3 m) {
01-15 09:25:17.110  6469  6487 I godot   : 328: 	highp float d = 1.0 / (m[0].x * (m[1].y * m[2].z - m[2].y * m[1].z) - m[1].x * (m[0].y * m[2].z - m[2].y * m[0].z) + m[2].x * (m[0].y * m[1].z - m[1].y * m[0].z));
01-15 09:25:17.110  6469  6487 I godot   : 329: 	return mat3(
01-15 09:25:17.110  6469  6487 I godot   : 330: 			vec3((m[1].y * m[2].z - m[2].y * m[1].z), -(m[1].x * m[2].z - m[2].x * m[1].z), (m[1].x * m[2].y - m[2].x * m[1].y)) * d,
01-15 09:25:17.110  6469  6487 I godot   : 331: 			vec3(-(m[0].y * m[2].z - m[2].y * m[0].z), (m[0].x * m[2].z - m[2].x * m[0].z), -(m[0].x * m[2].y - m[2].x * m[0].y)) * d,
01-15 09:25:17.110  6469  6487 I godot   : 332: 			vec3((m[0].y * m[1].z - m[1].y * m[0].z), -(m[0].x * m[1].z - m[1].x * m[0].z), (m[0].x * m[1].y - m[1].x * m[0].y)) * d);
01-15 09:25:17.110  6469  6487 I godot   : 333: }
01-15 09:25:17.110  6469  6487 I godot   : 334: 
01-15 09:25:17.111  6469  6487 I godot   : 335: highp mat4 inverse(highp mat4 m) {
01-15 09:25:17.111  6469  6487 I godot   : 336: 	highp float c00 = m[2].z * m[3].w - m[3].z * m[2].w;
01-15 09:25:17.111  6469  6487 I godot   : 337: 	highp float c02 = m[1].z * m[3].w - m[3].z * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 338: 	highp float c03 = m[1].z * m[2].w - m[2].z * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 339: 
01-15 09:25:17.111  6469  6487 I godot   : 340: 	highp float c04 = m[2].y * m[3].w - m[3].y * m[2].w;
01-15 09:25:17.111  6469  6487 I godot   : 341: 	highp float c06 = m[1].y * m[3].w - m[3].y * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 342: 	highp float c07 = m[1].y * m[2].w - m[2].y * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 343: 
01-15 09:25:17.111  6469  6487 I godot   : 344: 	highp float c08 = m[2].y * m[3].z - m[3].y * m[2].z;
01-15 09:25:17.111  6469  6487 I godot   : 345: 	highp float c10 = m[1].y * m[3].z - m[3].y * m[1].z;
01-15 09:25:17.111  6469  6487 I godot   : 346: 	highp float c11 = m[1].y * m[2].z - m[2].y * m[1].z;
01-15 09:25:17.111  6469  6487 I godot   : 347: 
01-15 09:25:17.111  6469  6487 I godot   : 348: 	highp float c12 = m[2].x * m[3].w - m[3].x * m[2].w;
01-15 09:25:17.111  6469  6487 I godot   : 349: 	highp float c14 = m[1].x * m[3].w - m[3].x * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 350: 	highp float c15 = m[1].x * m[2].w - m[2].x * m[1].w;
01-15 09:25:17.111  6469  6487 I godot   : 351: 
01-15 09:25:17.111  6469  6487 I godot   : 352: 	highp float c16 = m[2].x * m[3].z - m[3].x * m[2].z;
01-15 09:25:17.111  6469  6487 I godot   : 353: 	highp float c18 = m[1].x * m[3].z - m[3].x * m[1].z;
01-15 09:25:17.111  6469  6487 I godot   : 354: 	highp float c19 = m[1].x * m[2].z - m[2].x * m[1].z;
01-15 09:25:17.111  6469  6487 I godot   : 355: 
01-15 09:25:17.111  6469  6487 I godot   : 356: 	highp float c20 = m[2].x * m[3].y - m[3].x * m[2].y;
01-15 09:25:17.112  6469  6487 I godot   : 357: 	highp float c22 = m[1].x * m[3].y - m[3].x * m[1].y;
01-15 09:25:17.112  6469  6487 I godot   : 358: 	highp float c23 = m[1].x * m[2].y - m[2].x * m[1].y;
01-15 09:25:17.112  6469  6487 I godot   : 359: 
01-15 09:25:17.112  6469  6487 I godot   : 360: 	vec4 f0 = vec4(c00, c00, c02, c03);
01-15 09:25:17.112  6469  6487 I godot   : 361: 	vec4 f1 = vec4(c04, c04, c06, c07);
01-15 09:25:17.112  6469  6487 I godot   : 362: 	vec4 f2 = vec4(c08, c08, c10, c11);
01-15 09:25:17.112  6469  6487 I godot   : 363: 	vec4 f3 = vec4(c12, c12, c14, c15);
01-15 09:25:17.112  6469  6487 I godot   : 364: 	vec4 f4 = vec4(c16, c16, c18, c19);
01-15 09:25:17.112  6469  6487 I godot   : 365: 	vec4 f5 = vec4(c20, c20, c22, c23);
01-15 09:25:17.112  6469  6487 I godot   : 366: 
01-15 09:25:17.112  6469  6487 I godot   : 367: 	vec4 v0 = vec4(m[1].x, m[0].x, m[0].x, m[0].x);
01-15 09:25:17.112  6469  6487 I godot   : 368: 	vec4 v1 = vec4(m[1].y, m[0].y, m[0].y, m[0].y);
01-15 09:25:17.112  6469  6487 I godot   : 369: 	vec4 v2 = vec4(m[1].z, m[0].z, m[0].z, m[0].z);
01-15 09:25:17.112  6469  6487 I godot   : 370: 	vec4 v3 = vec4(m[1].w, m[0].w, m[0].w, m[0].w);
01-15 09:25:17.112  6469  6487 I godot   : 371: 
01-15 09:25:17.112  6469  6487 I godot   : 372: 	vec4 inv0 = vec4(v1 * f0 - v2 * f1 + v3 * f2);
01-15 09:25:17.112  6469  6487 I godot   : 373: 	vec4 inv1 = vec4(v0 * f0 - v2 * f3 + v3 * f4);
01-15 09:25:17.112  6469  6487 I godot   : 374: 	vec4 inv2 = vec4(v0 * f1 - v1 * f3 + v3 * f5);
01-15 09:25:17.112  6469  6487 I godot   : 375: 	vec4 inv3 = vec4(v0 * f2 - v1 * f4 + v2 * f5);
01-15 09:25:17.112  6469  6487 I godot   : 376: 
01-15 09:25:17.112  6469  6487 I godot   : 377: 	vec4 sa = vec4(+1, -1, +1, -1);
01-15 09:25:17.112  6469  6487 I godot   : 378: 	vec4 sb = vec4(-1, +1, -1, +1);
01-15 09:25:17.112  6469  6487 I godot   : 379: 
01-15 09:25:17.112  6469  6487 I godot   : 380: 	mat4 inv = mat4(inv0 * sa, inv1 * sb, inv2 * sa, inv3 * sb);
01-15 09:25:17.113  6469  6487 I godot   : 381: 
01-15 09:25:17.113  6469  6487 I godot   : 382: 	vec4 r0 = vec4(inv[0].x, inv[1].x, inv[2].x, inv[3].x);
01-15 09:25:17.113  6469  6487 I godot   : 383: 	vec4 d0 = vec4(m[0] * r0);
01-15 09:25:17.113  6469  6487 I godot   : 384: 
01-15 09:25:17.113  6469  6487 I godot   : 385: 	highp float d1 = (d0.x + d0.y) + (d0.z + d0.w);
01-15 09:25:17.113  6469  6487 I godot   : 386: 	highp float d = 1.0 / d1;
01-15 09:25:17.113  6469  6487 I godot   : 387: 
01-15 09:25:17.113  6469  6487 I godot   : 388: 	return inv * d;
01-15 09:25:17.113  6469  6487 I godot   : 389: }
01-15 09:25:17.113  6469  6487 I godot   : 390: 
01-15 09:25:17.113  6469  6487 I godot   : 391: #endif
01-15 09:25:17.113  6469  6487 I godot   : 392: 
01-15 09:25:17.113  6469  6487 I godot   : 393: #ifndef USE_GLES_OVER_GL
01-15 09:25:17.113  6469  6487 I godot   : 394: 
01-15 09:25:17.113  6469  6487 I godot   : 395: #if defined(TRANSPOSE_USED)
01-15 09:25:17.113  6469  6487 I godot   : 396: 
01-15 09:25:17.113  6469  6487 I godot   : 397: highp mat2 transpose(highp mat2 m) {
01-15 09:25:17.113  6469  6487 I godot   : 398: 	return mat2(
01-15 09:25:17.113  6469  6487 I godot   : 399: 			vec2(m[0].x, m[1].x),
01-15 09:25:17.113  6469  6487 I godot   : 400: 			vec2(m[0].y, m[1].y));
01-15 09:25:17.113  6469  6487 I godot   : 401: }
01-15 09:25:17.113  6469  6487 I godot   : 402: 
01-15 09:25:17.113  6469  6487 I godot   : 403: highp mat3 transpose(highp mat3 m) {
01-15 09:25:17.113  6469  6487 I godot   : 404: 	return mat3(
01-15 09:25:17.113  6469  6487 I godot   : 405: 			vec3(m[0].x, m[1].x, m[2].x),
01-15 09:25:17.114  6469  6487 I godot   : 406: 			vec3(m[0].y, m[1].y, m[2].y),
01-15 09:25:17.114  6469  6487 I godot   : 407: 			vec3(m[0].z, m[1].z, m[2].z));
01-15 09:25:17.114  6469  6487 I godot   : 408: }
01-15 09:25:17.114  6469  6487 I godot   : 409: 
01-15 09:25:17.114  6469  6487 I godot   : 410: #endif
01-15 09:25:17.114  6469  6487 I godot   : 411: 
01-15 09:25:17.114  6469  6487 I godot   : 412: highp mat4 transpose(highp mat4 m) {
01-15 09:25:17.114  6469  6487 I godot   : 413: 	return mat4(
01-15 09:25:17.114  6469  6487 I godot   : 414: 			vec4(m[0].x, m[1].x, m[2].x, m[3].x),
01-15 09:25:17.114  6469  6487 I godot   : 415: 			vec4(m[0].y, m[1].y, m[2].y, m[3].y),
01-15 09:25:17.114  6469  6487 I godot   : 416: 			vec4(m[0].z, m[1].z, m[2].z, m[3].z),
01-15 09:25:17.114  6469  6487 I godot   : 417: 			vec4(m[0].w, m[1].w, m[2].w, m[3].w));
01-15 09:25:17.114  6469  6487 I godot   : 418: }
01-15 09:25:17.114  6469  6487 I godot   : 419: 
01-15 09:25:17.114  6469  6487 I godot   : 420: #if defined(OUTER_PRODUCT_USED)
01-15 09:25:17.114  6469  6487 I godot   : 421: 
01-15 09:25:17.114  6469  6487 I godot   : 422: highp mat2 outerProduct(highp vec2 c, highp vec2 r) {
01-15 09:25:17.114  6469  6487 I godot   : 423: 	return mat2(c * r.x, c * r.y);
01-15 09:25:17.114  6469  6487 I godot   : 424: }
01-15 09:25:17.114  6469  6487 I godot   : 425: 
01-15 09:25:17.114  6469  6487 I godot   : 426: highp mat3 outerProduct(highp vec3 c, highp vec3 r) {
01-15 09:25:17.114  6469  6487 I godot   : 427: 	return mat3(c * r.x, c * r.y, c * r.z);
01-15 09:25:17.115  6469  6487 I godot   : 428: }
01-15 09:25:17.115  6469  6487 I godot   : 429: 
01-15 09:25:17.115  6469  6487 I godot   : 430: highp mat4 outerProduct(highp vec4 c, highp vec4 r) {
01-15 09:25:17.115  6469  6487 I godot   : 431: 	return mat4(c * r.x, c * r.y, c * r.z, c * r.w);
01-15 09:25:17.115  6469  6487 I godot   : 432: }
01-15 09:25:17.115  6469  6487 I godot   : 433: 
01-15 09:25:17.115  6469  6487 I godot   : 434: #endif
01-15 09:25:17.115  6469  6487 I godot   : 435: 
01-15 09:25:17.115  6469  6487 I godot   : 436: #endif
01-15 09:25:17.115  6469  6487 I godot   : 437: 
01-15 09:25:17.115  6469  6487 I godot   : 438: uniform highp mat4 modelview_matrix;
01-15 09:25:17.115  6469  6487 I godot   : 439: uniform highp mat4 extra_matrix;
01-15 09:25:17.115  6469  6487 I godot   : 440: attribute highp vec2 vertex; // attrib:0
01-15 09:25:17.115  6469  6487 I godot   : 441: attribute vec4 color_attrib; // attrib:3
01-15 09:25:17.115  6469  6487 I godot   : 442: attribute vec2 uv_attrib; // attrib:4
01-15 09:25:17.115  6469  6487 I godot   : 443: 
01-15 09:25:17.115  6469  6487 I godot   : 444: #ifdef USE_SKELETON
01-15 09:25:17.115  6469  6487 I godot   : 445: attribute highp vec4 bone_indices; // attrib:6
01-15 09:25:17.115  6469  6487 I godot   : 446: attribute highp vec4 bone_weights; // attrib:7
01-15 09:25:17.115  6469  6487 I godot   : 447: #endif
01-15 09:25:17.115  6469  6487 I godot   : 448: 
01-15 09:25:17.115  6469  6487 I godot   : 449: #ifdef USE_INSTANCING
01-15 09:25:17.115  6469  6487 I godot   : 450: 
01-15 09:25:17.115  6469  6487 I godot   : 451: attribute highp vec4 instance_xform0; //attrib:8
01-15 09:25:17.116  6469  6487 I godot   : 452: attribute highp vec4 instance_xform1; //attrib:9
01-15 09:25:17.116  6469  6487 I godot   : 453: attribute highp vec4 instance_xform2; //attrib:10
01-15 09:25:17.116  6469  6487 I godot   : 454: attribute highp vec4 instance_color; //attrib:11
01-15 09:25:17.116  6469  6487 I godot   : 455: 
01-15 09:25:17.116  6469  6487 I godot   : 456: #ifdef USE_INSTANCE_CUSTOM
01-15 09:25:17.116  6469  6487 I godot   : 457: attribute highp vec4 instance_custom_data; //attrib:12
01-15 09:25:17.116  6469  6487 I godot   : 458: #endif
01-15 09:25:17.116  6469  6487 I godot   : 459: 
01-15 09:25:17.116  6469  6487 I godot   : 460: #endif
01-15 09:25:17.116  6469  6487 I godot   : 461: 
01-15 09:25:17.116  6469  6487 I godot   : 462: #ifdef USE_SKELETON
01-15 09:25:17.116  6469  6487 I godot   : 463: uniform highp sampler2D skeleton_texture; // texunit:-3
01-15 09:25:17.116  6469  6487 I godot   : 464: uniform highp ivec2 skeleton_texture_size;
01-15 09:25:17.116  6469  6487 I godot   : 465: uniform highp mat4 skeleton_transform;
01-15 09:25:17.116  6469  6487 I godot   : 466: uniform highp mat4 skeleton_transform_inverse;
01-15 09:25:17.116  6469  6487 I godot   : 467: #endif
01-15 09:25:17.116  6469  6487 I godot   : 468: 
01-15 09:25:17.116  6469  6487 I godot   : 469: varying vec2 uv_interp;
01-15 09:25:17.116  6469  6487 I godot   : 470: varying vec4 color_interp;
01-15 09:25:17.116  6469  6487 I godot   : 471: 
01-15 09:25:17.116  6469  6487 I godot   : 472: uniform highp vec2 color_texpixel_size;
01-15 09:25:17.116  6469  6487 I godot   : 473: 
01-15 09:25:17.116  6469  6487 I godot   : 474: #ifdef USE_TEXTURE_RECT
01-15 09:25:17.116  6469  6487 I godot   : 475: 
01-15 09:25:17.117  6469  6487 I godot   : 476: uniform vec4 dst_rect;
01-15 09:25:17.117  6469  6487 I godot   : 477: uniform vec4 src_rect;
01-15 09:25:17.117  6469  6487 I godot   : 478: 
01-15 09:25:17.117  6469  6487 I godot   : 479: #endif
01-15 09:25:17.117  6469  6487 I godot   : 480: 
01-15 09:25:17.117  6469  6487 I godot   : 481: uniform highp float time;
01-15 09:25:17.117  6469  6487 I godot   : 482: 
01-15 09:25:17.117  6469  6487 I godot   : 483: #ifdef USE_LIGHTING
01-15 09:25:17.117  6469  6487 I godot   : 484: 
01-15 09:25:17.117  6469  6487 I godot   : 485: // light matrices
01-15 09:25:17.117  6469  6487 I godot   : 486: uniform highp mat4 light_matrix;
01-15 09:25:17.117  6469  6487 I godot   : 487: uniform highp mat4 light_matrix_inverse;
01-15 09:25:17.117  6469  6487 I godot   : 488: uniform highp mat4 light_local_matrix;
01-15 09:25:17.117  6469  6487 I godot   : 489: uniform highp mat4 shadow_matrix;
01-15 09:25:17.117  6469  6487 I godot   : 490: uniform highp vec4 light_color;
01-15 09:25:17.117  6469  6487 I godot   : 491: uniform highp vec4 light_shadow_color;
01-15 09:25:17.117  6469  6487 I godot   : 492: uniform highp vec2 light_pos;
01-15 09:25:17.117  6469  6487 I godot   : 493: uniform highp float shadowpixel_size;
01-15 09:25:17.117  6469  6487 I godot   : 494: uniform highp float shadow_gradient;
01-15 09:25:17.117  6469  6487 I godot   : 495: uniform highp float light_height;
01-15 09:25:17.117  6469  6487 I godot   : 496: uniform highp float light_outside_alpha;
01-15 09:25:17.117  6469  6487 I godot   : 497: uniform highp float shadow_distance_mult;
01-15 09:25:17.117  6469  6487 I godot   : 498: 
01-15 09:25:17.118  6469  6487 I godot   : 499: varying vec4 light_uv_interp;
01-15 09:25:17.118  6469  6487 I godot   : 500: varying vec2 transformed_light_uv;
01-15 09:25:17.118  6469  6487 I godot   : 501: varying vec4 local_rot;
01-15 09:25:17.118  6469  6487 I godot   : 502: 
01-15 09:25:17.118  6469  6487 I godot   : 503: #ifdef USE_SHADOWS
01-15 09:25:17.118  6469  6487 I godot   : 504: varying highp vec2 pos;
01-15 09:25:17.118  6469  6487 I godot   : 505: #endif
01-15 09:25:17.118  6469  6487 I godot   : 506: 
01-15 09:25:17.118  6469  6487 I godot   : 507: const bool at_light_pass = true;
01-15 09:25:17.118  6469  6487 I godot   : 508: #else
01-15 09:25:17.118  6469  6487 I godot   : 509: const bool at_light_pass = false;
01-15 09:25:17.118  6469  6487 I godot   : 510: #endif
01-15 09:25:17.118  6469  6487 I godot   : 511: 
01-15 09:25:17.118  6469  6487 I godot   : 512: /* clang-format off */
01-15 09:25:17.118  6469  6487 I godot   : 513: 
01-15 09:25:17.118  6469  6487 I godot   : 514: 
01-15 09:25:17.118  6469  6487 I godot   : 515: /* clang-format on */
01-15 09:25:17.118  6469  6487 I godot   : 516: 
01-15 09:25:17.118  6469  6487 I godot   : 517: vec2 select(vec2 a, vec2 b, bvec2 c) {
01-15 09:25:17.118  6469  6487 I godot   : 518: 	vec2 ret;
01-15 09:25:17.118  6469  6487 I godot   : 519: 
01-15 09:25:17.118  6469  6487 I godot   : 520: 	ret.x = c.x ? b.x : a.x;
01-15 09:25:17.118  6469  6487 I godot   : 521: 	ret.y = c.y ? b.y : a.y;
01-15 09:25:17.119  6469  6487 I godot   : 522: 
01-15 09:25:17.119  6469  6487 I godot   : 523: 	return ret;
01-15 09:25:17.119  6469  6487 I godot   : 524: }
01-15 09:25:17.119  6469  6487 I godot   : 525: 
01-15 09:25:17.119  6469  6487 I godot   : 526: void main() {
01-15 09:25:17.119  6469  6487 I godot   : 527: 
01-15 09:25:17.119  6469  6487 I godot   : 528: 	vec4 color = color_attrib;
01-15 09:25:17.119  6469  6487 I godot   : 529: 	vec2 uv;
01-15 09:25:17.119  6469  6487 I godot   : 530: 
01-15 09:25:17.119  6469  6487 I godot   : 531: #ifdef USE_INSTANCING
01-15 09:25:17.119  6469  6487 I godot   : 532: 	mat4 extra_matrix_instance = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)));
01-15 09:25:17.119  6469  6487 I godot   : 533: 	color *= instance_color;
01-15 09:25:17.119  6469  6487 I godot   : 534: 
01-15 09:25:17.119  6469  6487 I godot   : 535: #ifdef USE_INSTANCE_CUSTOM
01-15 09:25:17.119  6469  6487 I godot   : 536: 	vec4 instance_custom = instance_custom_data;
01-15 09:25:17.119  6469  6487 I godot   : 537: #else
01-15 09:25:17.119  6469  6487 I godot   : 538: 	vec4 instance_custom = vec4(0.0);
01-15 09:25:17.119  6469  6487 I godot   : 539: #endif
01-15 09:25:17.119  6469  6487 I godot   : 540: 
01-15 09:25:17.119  6469  6487 I godot   : 541: #else
01-15 09:25:17.119  6469  6487 I godot   : 542: 	mat4 extra_matrix_instance = extra_matrix;
01-15 09:25:17.119  6469  6487 I godot   : 543: 	vec4 instance_custom = vec4(0.0);
01-15 09:25:17.120  6469  6487 I godot   : 544: #endif
01-15 09:25:17.120  6469  6487 I godot   : 545: 
01-15 09:25:17.120  6469  6487 I godot   : 546: #ifdef USE_TEXTURE_RECT
01-15 09:25:17.120  6469  6487 I godot   : 547: 
01-15 09:25:17.120  6469  6487 I godot   : 548: 	if (dst_rect.z < 0.0) { // Transpose is encoded as negative dst_rect.z
01-15 09:25:17.120  6469  6487 I godot   : 549: 		uv = src_rect.xy + abs(src_rect.zw) * vertex.yx;
01-15 09:25:17.120  6469  6487 I godot   : 550: 	} else {
01-15 09:25:17.120  6469  6487 I godot   : 551: 		uv = src_rect.xy + abs(src_rect.zw) * vertex;
01-15 09:25:17.120  6469  6487 I godot   : 552: 	}
01-15 09:25:17.120  6469  6487 I godot   : 553: 
01-15 09:25:17.120  6469  6487 I godot   : 554: 	vec4 outvec = vec4(0.0, 0.0, 0.0, 1.0);
01-15 09:25:17.120  6469  6487 I godot   : 555: 
01-15 09:25:17.120  6469  6487 I godot   : 556: 	// This is what is done in the GLES 3 bindings and should
01-15 09:25:17.120  6469  6487 I godot   : 557: 	// take care of flipped rects.
01-15 09:25:17.120  6469  6487 I godot   : 558: 	//
01-15 09:25:17.120  6469  6487 I godot   : 559: 	// But it doesn't.
01-15 09:25:17.120  6469  6487 I godot   : 560: 	// I don't know why, will need to investigate further.
01-15 09:25:17.120  6469  6487 I godot   : 561: 
01-15 09:25:17.120  6469  6487 I godot   : 562: 	outvec.xy = dst_rect.xy + abs(dst_rect.zw) * select(vertex, vec2(1.0, 1.0) - vertex, lessThan(src_rect.zw, vec2(0.0, 0.0)));
01-15 09:25:17.120  6469  6487 I godot   : 563: 
01-15 09:25:17.120  6469  6487 I godot   : 564: 	// outvec.xy = dst_rect.xy + abs(dst_rect.zw) * vertex;
01-15 09:25:17.120  6469  6487 I godot   : 565: #else
01-15 09:25:17.121  6469  6487 I godot   : 566: 	vec4 outvec = vec4(vertex.xy, 0.0, 1.0);
01-15 09:25:17.121  6469  6487 I godot   : 567: 
01-15 09:25:17.121  6469  6487 I godot   : 568: 	uv = uv_attrib;
01-15 09:25:17.121  6469  6487 I godot   : 569: #endif
01-15 09:25:17.121  6469  6487 I godot   : 570: 
01-15 09:25:17.121  6469  6487 I godot   : 571: 	float point_size = 1.0;
01-15 09:25:17.121  6469  6487 I godot   : 572: 
01-15 09:25:17.121  6469  6487 I godot   : 573: 	{
01-15 09:25:17.121  6469  6487 I godot   : 574: 		vec2 src_vtx = outvec.xy;
01-15 09:25:17.121  6469  6487 I godot   : 575: 		/* clang-format off */
01-15 09:25:17.121  6469  6487 I godot   : 576: 
01-15 09:25:17.121  6469  6487 I godot   : 577: 
01-15 09:25:17.121  6469  6487 I godot   : 578: 		/* clang-format on */
01-15 09:25:17.121  6469  6487 I godot   : 579: 	}
01-15 09:25:17.121  6469  6487 I godot   : 580: 
01-15 09:25:17.121  6469  6487 I godot   : 581: 	gl_PointSize = point_size;
01-15 09:25:17.121  6469  6487 I godot   : 582: 
01-15 09:25:17.121  6469  6487 I godot   : 583: #if !defined(SKIP_TRANSFORM_USED)
01-15 09:25:17.121  6469  6487 I godot   : 584: 	outvec = extra_matrix_instance * outvec;
01-15 09:25:17.121  6469  6487 I godot   : 585: 	outvec = modelview_matrix * outvec;
01-15 09:25:17.121  6469  6487 I godot   : 586: #endif
01-15 09:25:17.121  6469  6487 I godot   : 587: 
01-15 09:25:17.121  6469  6487 I godot   : 588: 	color_interp = color;
01-15 09:25:17.121  6469  6487 I godot   : 589: 
01-15 09:25:17.122  6469  6487 I godot   : 590: #ifdef USE_PIXEL_SNAP
01-15 09:25:17.122  6469  6487 I godot   : 591: 	outvec.xy = floor(outvec + 0.5).xy;
01-15 09:25:17.122  6469  6487 I godot   : 592: 	// precision issue on some hardware creates artifacts within texture
01-15 09:25:17.122  6469  6487 I godot   : 593: 	// offset uv by a small amount to avoid
01-15 09:25:17.122  6469  6487 I godot   : 594: 	uv += 1e-5;
01-15 09:25:17.122  6469  6487 I godot   : 595: #endif
01-15 09:25:17.122  6469  6487 I godot   : 596: 
01-15 09:25:17.122  6469  6487 I godot   : 597: #ifdef USE_SKELETON
01-15 09:25:17.122  6469  6487 I godot   : 598: 
01-15 09:25:17.122  6469  6487 I godot   : 599: 	// look up transform from the "pose texture"
01-15 09:25:17.122  6469  6487 I godot   : 600: 	if (bone_weights != vec4(0.0)) {
01-15 09:25:17.122  6469  6487 I godot   : 601: 
01-15 09:25:17.122  6469  6487 I godot   : 602: 		highp mat4 bone_transform = mat4(0.0);
01-15 09:25:17.122  6469  6487 I godot   : 603: 
01-15 09:25:17.122  6469  6487 I godot   : 604: 		for (int i = 0; i < 4; i++) {
01-15 09:25:17.122  6469  6487 I godot   : 605: 			ivec2 tex_ofs = ivec2(int(bone_indices[i]) * 2, 0);
01-15 09:25:17.122  6469  6487 I godot   : 606: 
01-15 09:25:17.122  6469  6487 I godot   : 607: 			highp mat4 b = mat4(
01-15 09:25:17.122  6469  6487 I godot   : 608: 					texel2DFetch(skeleton_texture, skeleton_texture_size, tex_ofs + ivec2(0, 0)),
01-15 09:25:17.122  6469  6487 I godot   : 609: 					texel2DFetch(skeleton_texture, skeleton_texture_size, tex_ofs + ivec2(1, 0)),
01-15 09:25:17.122  6469  6487 I godot   : 610: 					vec4(0.0, 0.0, 1.0, 0.0),
01-15 09:25:17.122  6469  6487 I godot   : 611: 					vec4(0.0, 0.0, 0.0, 1.0));
01-15 09:25:17.122  6469  6487 I godot   : 612: 
01-15 09:25:17.122  6469  6487 I godot   : 613: 			bone_transform += b * bone_weights[i];
01-15 09:25:17.123  6469  6487 I godot   : 614: 		}
01-15 09:25:17.123  6469  6487 I godot   : 615: 
01-15 09:25:17.123  6469  6487 I godot   : 616: 		mat4 bone_matrix = skeleton_transform * transpose(bone_transform) * skeleton_transform_inverse;
01-15 09:25:17.123  6469  6487 I godot   : 617: 
01-15 09:25:17.123  6469  6487 I godot   : 618: 		outvec = bone_matrix * outvec;
01-15 09:25:17.123  6469  6487 I godot   : 619: 	}
01-15 09:25:17.123  6469  6487 I godot   : 620: 
01-15 09:25:17.123  6469  6487 I godot   : 621: #endif
01-15 09:25:17.123  6469  6487 I godot   : 622: 
01-15 09:25:17.123  6469  6487 I godot   : 623: 	uv_interp = uv;
01-15 09:25:17.123  6469  6487 I godot   : 624: 	gl_Position = projection_matrix * outvec;
01-15 09:25:17.123  6469  6487 I godot   : 625: 
01-15 09:25:17.123  6469  6487 I godot   : 626: #ifdef USE_LIGHTING
01-15 09:25:17.123  6469  6487 I godot   : 627: 
01-15 09:25:17.123  6469  6487 I godot   : 628: 	light_uv_interp.xy = (light_matrix * outvec).xy;
01-15 09:25:17.123  6469  6487 I godot   : 629: 	light_uv_interp.zw = (light_local_matrix * outvec).xy;
01-15 09:25:17.123  6469  6487 I godot   : 630: 
01-15 09:25:17.123  6469  6487 I godot   : 631: 	transformed_light_uv = (mat3(light_matrix_inverse) * vec3(light_uv_interp.zw, 0.0)).xy; //for normal mapping
01-15 09:25:17.123  6469  6487 I godot   : 632: 
01-15 09:25:17.123  6469  6487 I godot   : 633: #ifdef USE_SHADOWS
01-15 09:25:17.123  6469  6487 I godot   : 634: 	pos = outvec.xy;
01-15 09:25:17.123  6469  6487 I godot   : 635: #endif
01-15 09:25:17.123  6469  6487 I godot   : 636: 
01-15 09:25:17.123  6469  6487 I godot   : 637: 	local_rot.xy = normalize((modelview_matrix * (extra_matrix_instance * vec4(1.0, 0.0, 0.0, 0.0))).xy);
01-15 09:25:17.124  6469  6487 I godot   : 638: 	local_rot.zw = normalize((modelview_matrix * (extra_matrix_instance * vec4(0.0, 1.0, 0.0, 0.0))).xy);
01-15 09:25:17.124  6469  6487 I godot   : 639: #ifdef USE_TEXTURE_RECT
01-15 09:25:17.124  6469  6487 I godot   : 640: 	local_rot.xy *= sign(src_rect.z);
01-15 09:25:17.124  6469  6487 I godot   : 641: 	local_rot.zw *= sign(src_rect.w);
01-15 09:25:17.124  6469  6487 I godot   : 642: #endif
01-15 09:25:17.124  6469  6487 I godot   : 643: 
01-15 09:25:17.124  6469  6487 I godot   : 644: #endif
01-15 09:25:17.124  6469  6487 I godot   : 645: }
01-15 09:25:17.124  6469  6487 I godot   : 646: 
01-15 09:25:17.124  6469  6487 I godot   : 647: /* clang-format off */
01-15 09:25:17.124  6469  6487 I godot   : 648: 
01-15 09:25:17.124  6469  6487 E godot   : **ERROR**: CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.124  6469  6487 E godot   : 3:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.124  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:129:_display_error_with_code() - CanvasShaderGLES2: Vertex shader compilation failed:
01-15 09:25:17.124  6469  6487 E godot   : 3:49: L0002: Function 'texture2DLod' not supported on target
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Method/Function Failed, returning: __null
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:284:get_current_version() - Method/Function Failed, returning: __null
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: false
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.cpp:88:bind() - Condition ' !version ' is true. returned: false
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   : **ERROR**: Condition ' !version ' is true. returned: -1
01-15 09:25:17.125  6469  6487 E godot   :    At: drivers/gles2/shader_gles2.h:257:_get_uniform() - Condition ' !version ' is true. returned: -1

Steps to reproduce:

  • Run MRP on an ancient Android device that doesn't support textureLod in GLES2

Minimal reproduction project:
SkeletonBug.zip (from #27919)

@akien-mga
Copy link
Member Author

The error is surprising as it happens in the vertex shader, where texture2DLod should be available as per the GLSL ES 1.00 specification (page 87): https://www.khronos.org/files/opengles_shading_language.pdf

Might be a driver bug? I'll see if I can find any reference to textureLod being missing from Mali 400 drivers.

@akien-mga
Copy link
Member Author

The funny thing is that the Mali-400 MP I have has support for GL_EXT_shader_texture_lod, which adds texture2DLodEXT in fragment shaders to complement the texture2DLod of the vertex shader...

@akien-mga akien-mga changed the title Polygon2D with assigned Skeleton2D cause shader error on Android Mali 400 [GLES2] Polygon2D with assigned Skeleton2D cause shader error on Android Mali 400 [GLES2], no texture2DLod support in vertex shader Jan 15, 2020
@akien-mga
Copy link
Member Author

See https://stackoverflow.com/a/14503063 - my device has GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS set to 0, which means no texture access allowed at all in the vertex shader.

So we need to check that and disable/work around the relevant code path.

It's probably not worth to spend too much effort for such old devices, so I'd suggest to just add a validation, print an error if texture access in vertex shader was requested by the user and disable relevant code.

@akien-mga
Copy link
Member Author

Looks like we already check for this capability in 3D, and we have USE_SKELETON_SOFTWARE in scene.glsl:

// the use skeleton software path should be used if either float texture is not supported,
// OR max_vertex_texture_image_units is zero
config.use_skeleton_software = (config.float_texture_supported == false) || (config.max_vertex_texture_image_units == 0);

The same logic needs to be ported to canvas.glsl / rasterizer_canvas_gles2.cpp.

I started looking into it for canvas.glsl, but modifying rasterizer_canvas_gles2.cpp to do the proper software computations for the bone_matrix (which in 2D seems to be somewhat different to the 3D bone_transform) is still needed. Won't work on it for now though.

diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index afce403a9f..76b0f73ce2 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -22,9 +22,25 @@ attribute vec4 color_attrib; // attrib:3
 attribute vec2 uv_attrib; // attrib:4
 
 #ifdef USE_SKELETON
+
+#ifdef USE_SKELETON_SOFTWARE
+
+attribute highp vec4 bone_transform_row_0; // attrib:13
+attribute highp vec4 bone_transform_row_1; // attrib:14
+
+#else
+
 attribute highp vec4 bone_indices; // attrib:6
 attribute highp vec4 bone_weights; // attrib:7
-#endif
+
+uniform highp sampler2D skeleton_texture; // texunit:-3
+uniform highp ivec2 skeleton_texture_size;
+uniform highp mat4 skeleton_transform;
+uniform highp mat4 skeleton_transform_inverse;
+
+#endif // USE_SKELETON_SOFTWARE
+
+#endif // USE_SKELETON
 
 #ifdef USE_INSTANCING
 
@@ -37,14 +53,7 @@ attribute highp vec4 instance_color; //attrib:11
 attribute highp vec4 instance_custom_data; //attrib:12
 #endif
 
-#endif
-
-#ifdef USE_SKELETON
-uniform highp sampler2D skeleton_texture; // texunit:-3
-uniform highp ivec2 skeleton_texture_size;
-uniform highp mat4 skeleton_transform;
-uniform highp mat4 skeleton_transform_inverse;
-#endif
+#endif // USE_INSTANCING
 
 varying vec2 uv_interp;
 varying vec4 color_interp;
@@ -178,9 +187,18 @@ VERTEX_SHADER_CODE
 
 #ifdef USE_SKELETON
 
+	highp mat4 bone_matrix = mat4(0.0);
+
+#ifdef USE_SKELETON_SOFTWARE
+	// passing the transform as attributes
+	bone_matrix[0] = vec4(bone_matrix_row_0.x, bone_matrix_row_1.x, 0.0, 0.0);
+	bone_matrix[1] = vec4(bone_matrix_row_0.y, bone_matrix_row_1.y, 0.0, 0.0);
+	bone_matrix[2] = vec4(bone_matrix_row_0.z, bone_matrix_row_1.z, 1.0, 0.0);
+	bone_matrix[3] = vec4(bone_matrix_row_0.w, bone_matrix_row_1.w, 0.0, 1.0);
+
+#else
 	// look up transform from the "pose texture"
 	if (bone_weights != vec4(0.0)) {
-
 		highp mat4 bone_transform = mat4(0.0);
 
 		for (int i = 0; i < 4; i++) {
@@ -195,12 +213,14 @@ VERTEX_SHADER_CODE
 			bone_transform += b * bone_weights[i];
 		}
 
-		mat4 bone_matrix = skeleton_transform * transpose(bone_transform) * skeleton_transform_inverse;
-
-		outvec = bone_matrix * outvec;
+		bone_matrix = skeleton_transform * transpose(bone_transform) * skeleton_transform_inverse;
 	}
 
-#endif
+#endif // USE_SKELETON_SOFTWARE
+
+	outvec = bone_matrix * outvec;
+
+#endif // USE_SKELETON
 
 	uv_interp = uv;
 	gl_Position = projection_matrix * outvec;
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 63eee4eb87..901c86cbfc 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -59,9 +59,9 @@ attribute highp vec4 bone_weights; // attrib:7
 uniform highp sampler2D bone_transforms; // texunit:-1
 uniform ivec2 skeleton_texture_size;
 
-#endif
+#endif // USE_SKELETON_SOFTWARE
 
-#endif
+#endif // USE_SKELETON
 
 #ifdef USE_INSTANCING
 
@@ -379,7 +379,6 @@ void main() {
 
 #ifdef USE_SKELETON_SOFTWARE
 	// passing the transform as attributes
-
 	bone_transform[0] = vec4(bone_transform_row_0.x, bone_transform_row_1.x, bone_transform_row_2.x, 0.0);
 	bone_transform[1] = vec4(bone_transform_row_0.y, bone_transform_row_1.y, bone_transform_row_2.y, 0.0);
 	bone_transform[2] = vec4(bone_transform_row_0.z, bone_transform_row_1.z, bone_transform_row_2.z, 0.0);
@@ -387,8 +386,7 @@ void main() {
 
 #else
 	// look up transform from the "pose texture"
-	{
-
+	if (bone_weights != vec4(0.0)) {
 		for (int i = 0; i < 4; i++) {
 			ivec2 tex_ofs = ivec2(int(bone_ids[i]) * 3, 0);
 
@@ -402,11 +400,11 @@ void main() {
 		}
 	}
 
-#endif
+#endif // USE_SKELETON_SOFTWARE
 
 	world_matrix = world_matrix * bone_transform;
 
-#endif
+#endif // USE_SKELETON
 
 #ifdef USE_INSTANCING
 	vec4 instance_custom = instance_custom_data;

@akien-mga akien-mga changed the title Polygon2D with assigned Skeleton2D cause shader error on Android Mali 400 [GLES2], no texture2DLod support in vertex shader Skeleton2D not supported on devices with GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, should replace texture2DLod by software logic (like for 3D) Jan 15, 2020
@akien-mga akien-mga changed the title Skeleton2D not supported on devices with GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, should replace texture2DLod by software logic (like for 3D) Skeleton2D not supported on devices with GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, should replace texture2DLod by software logic (like for 3D) [GLES2] Jan 15, 2020
@akien-mga akien-mga modified the milestones: 3.2, 4.0 Jan 15, 2020
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 15, 2020
@KoBeWi
Copy link
Member

KoBeWi commented Nov 29, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Dec 10, 2020
@akien-mga akien-mga removed this from the 4.0 milestone Nov 10, 2021
@akien-mga
Copy link
Member Author

I haven't tested but I assume this might still be reproducible, it would probably need software skinning as implemented by @pouleyKetchoupp in #40313 extended to 2D. But it's probably not worth the hassle at this point and the situation will be different with Godot 4.0 and Vulkan/GLES3, so I think we can close this issue as WONTFIX. Contributors still welcome if anyone wants to tackle it.

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

No branches or pull requests

3 participants