{"action":"created","issue":{"url":"https://api.github.com/repos/hrydgard/ppsspp/issues/1816","labels_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/1816/labels{/name}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/1816/comments","events_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/1816/events","html_url":"https://github.com/hrydgard/ppsspp/issues/1816","id":14387055,"number":1816,"title":"Mali-400 max shader complexity error","user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hrydgard/ppsspp/labels/Hardware%20Transform","name":"Hardware Transform","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2013-05-16T01:17:25Z","updated_at":"2015-03-08T06:25:48Z","closed_at":null,"body":"From reporting, it looks like sometimes we generate very complex shaders.  Affected games seem to include Assassin's Creed: Bloodlines™, The 3rd Birthday, Tony Hawk's Underground 2 Remix, and SOULCALIBUR: Broken Destiny.  This may be responsible for missing or broken graphics that occur only on Mali-400 GPU devices (although maybe other mobile GPUs may have a similar issue.)\r\n\r\n```\r\nError in shader compilation: info: 0:1: F0003: Shader too long. This shader is 541 instruction words long, but\r\n            Mali-400 GP only supports up to 512 instruction words.\r\n / code: precision highp float;\r\nattribute vec4 a_weight0123;\r\nattribute vec4 a_weight4567;\r\nattribute vec3 a_position;\r\nattribute vec2 a_texcoord;\r\nattribute mediump vec3 a_normal;\r\nuniform mat4 u_proj;\r\nuniform lowp vec4 u_matambientalpha;\r\nuniform vec2 u_fogcoef;\r\nuniform mat4 u_world;\r\nuniform mat4 u_view;\r\nuniform vec4 u_uvscaleoffset;\r\nuniform mat4 u_bone0;\r\nuniform mat4 u_bone1;\r\nuniform mat4 u_bone2;\r\nuniform mat4 u_bone3;\r\nuniform mat4 u_bone4;\r\nuniform mat4 u_bone5;\r\nuniform mat4 u_bone6;\r\nuniform mat4 u_bone7;\r\nuniform lowp vec4 u_ambient;\r\nuniform lowp vec3 u_matdiffuse;\r\nuniform lowp vec4 u_matspecular;\r\nuniform lowp vec3 u_matemissive;\r\nuniform vec3 u_lightpos0;\r\nuniform vec3 u_lightdir0;\r\nuniform vec3 u_lightatt0;\r\nuniform float u_lightangle0;\r\nuniform float u_lightspotCoef0;\r\nuniform lowp vec3 u_lightambient0;\r\nuniform lowp vec3 u_lightdiffuse0;\r\nuniform lowp vec3 u_lightspecular0;\r\nuniform vec3 u_lightpos1;\r\nuniform vec3 u_lightdir1;\r\nuniform vec3 u_lightatt1;\r\nuniform float u_lightangle1;\r\nuniform float u_lightspotCoef1;\r\nuniform lowp vec3 u_lightambient1;\r\nuniform lowp vec3 u_lightdiffuse1;\r\nuniform lowp vec3 u_lightspecular1;\r\nuniform vec3 u_lightpos2;\r\nuniform vec3 u_lightdir2;\r\nuniform vec3 u_lightatt2;\r\nuniform float u_lightangle2;\r\nuniform float u_lightspotCoef2;\r\nuniform lowp vec3 u_lightambient2;\r\nuniform lowp vec3 u_lightdiffuse2;\r\nuniform lowp vec3 u_lightspecular2;\r\nvarying lowp vec4 v_color0;\r\nvarying vec2 v_texcoord;\r\nvarying float v_fogdepth;\r\nvoid main() {\r\n  vec3 worldpos = vec3(0.0);\r\n  vec3 worldnormal = vec3(0.0);\r\n  worldpos += a_weight0123.x * (u_bone0 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight0123.x * (u_bone0 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight0123.y * (u_bone1 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight0123.y * (u_bone1 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight0123.z * (u_bone2 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight0123.z * (u_bone2 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight0123.w * (u_bone3 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight0123.w * (u_bone3 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight4567.x * (u_bone4 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight4567.x * (u_bone4 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight4567.y * (u_bone5 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight4567.y * (u_bone5 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight4567.z * (u_bone6 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight4567.z * (u_bone6 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos += a_weight4567.w * (u_bone7 * vec4(a_position.xyz, 1.0)).xyz;\r\n  worldnormal += a_weight4567.w * (u_bone7 * vec4(a_normal, 0.0)).xyz;\r\n  worldpos = (u_world * vec4(worldpos * 1.992188, 1.0)).xyz;\r\n  worldnormal = (u_world * vec4(worldnormal, 0.0)).xyz;\r\n  worldnormal = normalize(worldnormal);\r\n  vec4 viewPos = u_view * vec4(worldpos, 1.0);\r\n  lowp vec3 unlitColor = u_matambientalpha.rgb;\r\n  lowp vec4 lightSum0 = u_ambient * u_matambientalpha + vec4(u_matemissive, 0.0);\r\n  lowp vec3 lightSum1 = vec3(0.0);\r\n  vec3 toLight0 = u_lightpos0;\r\n  float dot0 = dot(normalize(toLight0), worldnormal);\r\n  float distance0 = length(toLight0);\r\n  float lightScale0 = 0.0;\r\n  float angle0 = 0.0;\r\n  lightScale0 = 1.0;\r\n  vec3 diffuse0 = (u_lightdiffuse0 * u_matdiffuse) * max(dot0, 0.0);\r\n  lightSum0 += vec4((u_lightambient0 + diffuse0)*lightScale0, 0.0);\r\n  vec3 toLight1 = u_lightpos1;\r\n  float dot1 = dot(normalize(toLight1), worldnormal);\r\n  float distance1 = length(toLight1);\r\n  float lightScale1 = 0.0;\r\n  float angle1 = 0.0;\r\n  lightScale1 = 1.0;\r\n  vec3 diffuse1 = (u_lightdiffuse1 * u_matdiffuse) * max(dot1, 0.0);\r\n  lightSum0 += vec4((u_lightambient1 + diffuse1)*lightScale1, 0.0);\r\n  vec3 toLight2 = u_lightpos2;\r\n  float dot2 = dot(normalize(toLight2), worldnormal);\r\n  float distance2 = length(toLight2);\r\n  float lightScale2 = 0.0;\r\n  float angle2 = 0.0;\r\n  lightScale2 = 1.0;\r\n  vec3 diffu\r\n```\r\n(unfortunately, the full shader is truncated, but it seems relatively clear why it is so many instructions.)\r\n\r\n-[Unknown]"},"comment":{"url":"https://api.github.com/repos/hrydgard/ppsspp/issues/comments/77735543","html_url":"https://github.com/hrydgard/ppsspp/issues/1816#issuecomment-77735543","issue_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/1816","id":77735543,"user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"created_at":"2015-03-08T06:25:48Z","updated_at":"2015-03-08T06:25:48Z","body":"So, actually, there are some reports of shader failures even without any bones.  So software skinning doesn't solve this completely, although it does help it.\r\n\r\nOne failing shader had all 4 lights enabled, diffuse, fog, and u_uvscaleoffset (so maybe prescale would help, at least shave off one vec4.)\r\n\r\n-[Unknown]"}}