{"action":"created","issue":{"url":"https://api.github.com/repos/FNA-XNA/FNA/issues/24","repository_url":"https://api.github.com/repos/FNA-XNA/FNA","labels_url":"https://api.github.com/repos/FNA-XNA/FNA/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/FNA-XNA/FNA/issues/24/comments","events_url":"https://api.github.com/repos/FNA-XNA/FNA/issues/24/events","html_url":"https://github.com/FNA-XNA/FNA/issues/24","id":153449516,"number":24,"title":"Mojoshader missing variable, and assertion in preShader","user":{"login":"jeffphilp","id":8654118,"avatar_url":"https://avatars.githubusercontent.com/u/8654118?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffphilp","html_url":"https://github.com/jeffphilp","followers_url":"https://api.github.com/users/jeffphilp/followers","following_url":"https://api.github.com/users/jeffphilp/following{/other_user}","gists_url":"https://api.github.com/users/jeffphilp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffphilp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffphilp/subscriptions","organizations_url":"https://api.github.com/users/jeffphilp/orgs","repos_url":"https://api.github.com/users/jeffphilp/repos","events_url":"https://api.github.com/users/jeffphilp/events{/privacy}","received_events_url":"https://api.github.com/users/jeffphilp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-06T13:22:07Z","updated_at":"2016-05-06T14:13:02Z","closed_at":null,"body":"Hi,\r\n\r\nWhen initially loading the following file:\r\n[shader.txt](https://github.com/FNA-XNA/FNA/files/252239/shader.txt)\r\n\r\nit fails to compile the generated glsl because of a missing variable ps_v1, I believe this is caused by the NORMAL0 parameter passed into pixel shader which I think can be fixed by adding the following code:\r\n     \r\n     else if (usage == MOJOSHADER_USAGE_NORMAL)\r\n     {\r\n         push_output(ctx, &ctx->globals);\r\n         output_line(ctx, \"vec4 %s;\", var);\r\n         pop_output(ctx);\r\n     } // else if        \r\n\r\nat https://github.com/flibitijibibo/MojoShader/blob/master/mojoshader.c#L2731\r\n\r\nThis change allowed the shader to compile, but when I actually make use of the effect I run into another issue which relates to an assertion failure in the MOJOSHADER_runPreshader\r\nhttps://github.com/flibitijibibo/MojoShader/blob/master/mojoshader_effects.c#L193\r\nwhere the final operand is actually of type MOJOSHADER_PRESHADEROPERAND_INPUT.  \r\nThe last commit to that line is putting in the assertion for OUTPUT only though the previous changeset had a commented out assert which tolerated INPUT or OUTPUT.  Should we be allowing INPUT types as the destination?\r\n    \r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FNA-XNA/FNA/issues/comments/217451087","html_url":"https://github.com/FNA-XNA/FNA/issues/24#issuecomment-217451087","issue_url":"https://api.github.com/repos/FNA-XNA/FNA/issues/24","id":217451087,"user":{"login":"flibitijibibo","id":1396814,"avatar_url":"https://avatars.githubusercontent.com/u/1396814?v=3","gravatar_id":"","url":"https://api.github.com/users/flibitijibibo","html_url":"https://github.com/flibitijibibo","followers_url":"https://api.github.com/users/flibitijibibo/followers","following_url":"https://api.github.com/users/flibitijibibo/following{/other_user}","gists_url":"https://api.github.com/users/flibitijibibo/gists{/gist_id}","starred_url":"https://api.github.com/users/flibitijibibo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flibitijibibo/subscriptions","organizations_url":"https://api.github.com/users/flibitijibibo/orgs","repos_url":"https://api.github.com/users/flibitijibibo/repos","events_url":"https://api.github.com/users/flibitijibibo/events{/privacy}","received_events_url":"https://api.github.com/users/flibitijibibo/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T14:13:02Z","updated_at":"2016-05-06T14:13:02Z","body":"The preshader VM is this guy:\r\n\r\nhttps://github.com/flibitijibibo/MojoShader/blob/master/mojoshader_effects.c#L17\r\n\r\nBasically the effects compiler will generate preshaders when you've got stuff that you should be doing on the CPU, but for some reason gave to the GPU instead. The compiler hoists it out and attempts to calculate it once when you hit CommitChanges (or Apply in XNA4), but the VM can be very slow, and in our case, very unstable.\r\n\r\nI parsed the preshader out with this:\r\n\r\nhttps://hg.icculus.org/icculus/mojoshader/file/6e760a19f456/utils/testparse.c"}}