{"action":"created","issue":{"url":"https://api.github.com/repos/RPCS3/rpcs3/issues/1165","labels_url":"https://api.github.com/repos/RPCS3/rpcs3/issues/1165/labels{/name}","comments_url":"https://api.github.com/repos/RPCS3/rpcs3/issues/1165/comments","events_url":"https://api.github.com/repos/RPCS3/rpcs3/issues/1165/events","html_url":"https://github.com/RPCS3/rpcs3/issues/1165","id":98295674,"number":1165,"title":"Broken BRI instruction in VertexProgramDecompiler","user":{"login":"dogboydog","id":9920963,"avatar_url":"https://avatars.githubusercontent.com/u/9920963?v=3","gravatar_id":"","url":"https://api.github.com/users/dogboydog","html_url":"https://github.com/dogboydog","followers_url":"https://api.github.com/users/dogboydog/followers","following_url":"https://api.github.com/users/dogboydog/following{/other_user}","gists_url":"https://api.github.com/users/dogboydog/gists{/gist_id}","starred_url":"https://api.github.com/users/dogboydog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogboydog/subscriptions","organizations_url":"https://api.github.com/users/dogboydog/orgs","repos_url":"https://api.github.com/users/dogboydog/repos","events_url":"https://api.github.com/users/dogboydog/events{/privacy}","received_events_url":"https://api.github.com/users/dogboydog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-31T01:08:32Z","updated_at":"2015-07-31T06:41:49Z","closed_at":null,"body":"Hi, this is my first time writing a GitHub issue so bear with me if this isn't the best attempt at one. \r\n\r\nRight now, shaders decompiled with VertexProgramDecompiler ignore BRI instructions. If you start homebrew games you will get a bunch of messages in the log like \"unknown vp sca_opcode 0x9\".  The reason the BRI instruction code is commented out is because it crashes your graphics driver when enabled. The error code you get is a timeout, which leads me to think that inflinite loops are being accidentally produced. \r\n\r\nhttp://pastebin.com/pViEyHfQ  \r\n\r\nThis is a vertex shader decompiled with the current version of rpcs3, where the BRI instruction is commented out/ignored. . As you can see, it's just a while loop with a break at the end that is always reached the first time, so it's basically just a continuous block of code. This removes a lot of functionality from the shaders since they basically cannot loop. \r\n\r\n http://pastebin.com/6L4vEPTe \r\n\r\nThis is what's produced if you uncomment it. I added a comment to the continue statement generated from each BRI instruction -- \"// FROM BROKEN BRI INSTRUCTION\".\r\n\r\n I think the control flow is incorrect when the instruction is enabled. If I'm understanding the flow properly, each jump_position within the while loop is basically simulating a loop in the original shader written for PS3. If you look at the second `continue;`, it didn't get its own jump_position section, so when the if block on 94 is entered, we start the whole while loop again. At this point I think either \r\n\r\na) the first loop executes again normally in its entirety, reaches the condition for the second loop again, and starts the first loop again, etc.\r\n\r\nor \r\n\r\nb) the first loop's ending condition can now never be met due to some changes in variable values that took place during the execution of the loop the first time through (or during the execution of the code between 72-93) so the loop continues forever without ever reaching line 72 again.\r\n\r\nI don't understand the project (or git) well enough yet to try the changes on my own, but my naive opinion is that it's possible that the issue stems from there not being a new jump_position generated after 72.\r\n"},"comment":{"url":"https://api.github.com/repos/RPCS3/rpcs3/issues/comments/126583446","html_url":"https://github.com/RPCS3/rpcs3/issues/1165#issuecomment-126583446","issue_url":"https://api.github.com/repos/RPCS3/rpcs3/issues/1165","id":126583446,"user":{"login":"tambry","id":1827708,"avatar_url":"https://avatars.githubusercontent.com/u/1827708?v=3","gravatar_id":"","url":"https://api.github.com/users/tambry","html_url":"https://github.com/tambry","followers_url":"https://api.github.com/users/tambry/followers","following_url":"https://api.github.com/users/tambry/following{/other_user}","gists_url":"https://api.github.com/users/tambry/gists{/gist_id}","starred_url":"https://api.github.com/users/tambry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tambry/subscriptions","organizations_url":"https://api.github.com/users/tambry/orgs","repos_url":"https://api.github.com/users/tambry/repos","events_url":"https://api.github.com/users/tambry/events{/privacy}","received_events_url":"https://api.github.com/users/tambry/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T06:41:48Z","updated_at":"2015-07-31T06:41:48Z","body":"@dogboydog Would you be able to give any specific games that do this?"}}