shader: supply barycentrics read as data from SV_Barycentrics (#406) #409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/409"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T17:09:57Z.
Refs #406
Shape. "barycentrics read directly" was the largest pixel refusal left: 285 pixel shaders in my 26,849-shader corpus. These programs read their barycentric input VGPRs as data, not only through
v_interp_*. Most of them keep the high half ofv0/v1with av_fma_mixlo_f16before acomprexport, so the console exports the barycentric's bits and the host needs their value.Change. The barycentrics come from
SV_Barycentrics(SM 6.1).iandjweigh the second and third vertices: channels y and z.SFI00x20000are set;SV_Barycentricsgets the container system value 23.lower_graphics, like the existing console-lanes retry). Joins the first pass gave up on for that reason are retried. Programs that only interpolate keep their translation byte for byte and declare nothing new. A first version that declared the element eagerly changed the output of 12,718 pixel shaders, which is why it moved to a retry.By-output corpus sweep. 26,849 containers from my own runs (Series S, boot to the story load), native host options, main
b998bb6against this head:The gained shaders were refused as:
The last two groups also read a barycentric, which another pass met first. They translate only because the barycentric pass ran.
The 7 with another reason:
Conversion. I passed all 339 gained translations through Apple's Metal Shader Converter 4.0 beta 3: 339 converted, 0 failed. The converter maps the element to
[[barycentric_coord]].Gained (339)
pixel_016b97ce2e4a0060 pixel_033612b380447b21 pixel_03acf03762ba5f77 pixel_03d2c2ba8f605bed pixel_048a5f89f6a51806 pixel_05a4bb6b201ddf24 pixel_06ad51cddb2e09fd pixel_070bc8fc358f544e pixel_078b4c487eeed60e pixel_087a7d8068e7a4f4 pixel_0928bf547eb07ec9 pixel_093d728e99960970 pixel_09e86722762ae80e pixel_09fa0e9d4fcbc850 pixel_0ad82df6371abad4 pixel_0aeded8aec465ac9 pixel_0c1c6fa208bdf4d9 pixel_0dd288f60de85d06 pixel_0f13253211bdbca3 pixel_0f14656dda4ab811 pixel_0f2747f80931de5d pixel_0f469f7c5dac4223 pixel_0fb2d4eaa6d185f0 pixel_0fb367467b126f59 pixel_105ed2680a738f2e pixel_10bb12521b43145f pixel_1213b6ec0480268c pixel_126453e77cbb2d8d pixel_126c013f82354095 pixel_13ad038f1085e28b pixel_147a433429a8cf9a pixel_15c9aa5be7884715 pixel_16e78c7842639a48 pixel_174ff6e405a9f704 pixel_180fa070b13c6e0b pixel_18e41cc2f2f6e32e pixel_19a61aaa1d528bd6 pixel_1a5463d67155ad36 pixel_1b009fe6ed0ccdfd pixel_1caf3b1266fa74e8 pixel_1dcb0369a4aa1dcb pixel_1de813c62cda162d pixel_1e99d78ba6856e9f pixel_1ea37887f75ab04d pixel_1eb099e344c17f40 pixel_1eba9ede822f9ecb pixel_1f441b784a011d07 pixel_1f78903c128ce081 pixel_1f905c35eb965714 pixel_2004ea986fcf9582 pixel_216e426f24ba9f68 pixel_21c34fa173daf0bd pixel_2216db1464c20396 pixel_226b0dc5da3dc231 pixel_230f2d2a0bbbc0ce pixel_235b38cd98117ad4 pixel_2378d607fa597aeb pixel_23ba7b2bd4248073 pixel_252967db8a4d0c03 pixel_25ca8b6b0b21c9f5 pixel_25efda1a228a8443 pixel_289d13e98ae420ee pixel_28abe35497055ff4 pixel_28d59f0865d3a8e1 pixel_293f3848efa907a7 pixel_29b7cbec522416e9 pixel_2a5ab297798e087b pixel_2abf6f9457c28d63 pixel_2ccf311fd0ab16e1 pixel_2dee191dbbb8f7f3 pixel_2f08b354849cce40 pixel_2ff11bca68f18582 pixel_302ed8a8ec1cba28 pixel_30e38b199fdb99da pixel_3149a5b40e0e077b pixel_317148c4e23f2439 pixel_31f6a422638a77ec pixel_3273ea4a9c114127 pixel_3319f76ece583e85 pixel_3472143a6efffbb7 pixel_34aaaf724fbf9fd3 pixel_3567229d41a38e9d pixel_38335ee6c3f6de15 pixel_38b07a2b09c37a30 pixel_3a02d2495e2b352e pixel_3b2d56352b40e790 pixel_3d3fa239892e03e5 pixel_3db604df3e66291d pixel_3ee61316e7999484 pixel_3eea1dc06eb2e2ad pixel_40ae816e46b970ea pixel_42c83cb5d994e3af pixel_43dc4109571feb16 pixel_44c63ac7ffde3e2c pixel_459a26a028064ebe pixel_461f8681df3e9282 pixel_466be2fc6c550672 pixel_467b0427aeb1bda2 pixel_46f01c65ef727eb7 pixel_4765820b7d029163 pixel_48ad8512a5f00f7d pixel_48d026f4a0750b05 pixel_49654ad0cc311ac2 pixel_4aac5b8c7ac4846f pixel_4c1b776c63ae5ab2 pixel_4cdaf7f7b16ab006 pixel_4ce860ef2892c0e7 pixel_4cfb255404dde0cb pixel_4de6779fc1e6bf26 pixel_4e308c6710aca5e3 pixel_4f2fabeef45dab7d pixel_4fe880e27825e118 pixel_500459c6d3cb6b93 pixel_505f51a1a057b580 pixel_50d6fff7cbc2db17 pixel_51088a41c5e1c80b pixel_51430d23bc448a04 pixel_5191edf8f54aa82d pixel_521847a0da0d7d1b pixel_522e6964a50eb672 pixel_544ca05a0c7ef1e4 pixel_59312e41bc90ae32 pixel_5957b97db5785f1b pixel_59f9bf5af3953835 pixel_5ab2ce40c947a8b6 pixel_5b28d05d9846fb64 pixel_5d62513215e18801 pixel_5f977116c4e1ec2c pixel_6091121fbf1bba53 pixel_64661ee3d4ebb10a pixel_6537d1f50e190f61 pixel_654459b49b8a9f20 pixel_65c2d440110f42be pixel_66671a39a46a1cb0 pixel_66bbb5332a53c339 pixel_67cc0d7f41886ffa pixel_6934961d2c9bc4d7 pixel_69605705e4f588d7 pixel_69f573a76c6f64d5 pixel_6b3e7f4b41bfa668 pixel_6b4f7e1b10abeeee pixel_6bc20abfadb678b1 pixel_6c52ae655397afca pixel_6d30bbc807a50961 pixel_6daa8d54cf568d9f pixel_6dd11d01aa258f37 pixel_70655ad850d5cd72 pixel_720ed53c7a648dfe pixel_72ac9a0cbdc1d0bc pixel_734eb0e15d6410e0 pixel_7358a73ac2b9b22a pixel_73eafc77f986dfb2 pixel_75bb670bf4200632 pixel_775fbc024d8a6e58 pixel_77dea025b44228b1 pixel_77f2b575deb9e257 pixel_7893d164e49024e9 pixel_7ad95fe9748e98ea pixel_7cc59dc8949d034a pixel_7d2fca643737aa75 pixel_7d3452669064775d pixel_7dd609b3cd3d47ca pixel_7e71167cbdc0918e pixel_7e76b53433166ff5 pixel_7e9c00f3d69b1d1f pixel_7e9fd4ecf08a9987 pixel_7f6ade7cc485146c pixel_80038dfa96ccf9c4 pixel_8346ed425cd60c08 pixel_83547773f3903a3b pixel_845f80808ddca042 pixel_8461a4a5d889a2a5 pixel_85393c46331af52c pixel_855ceb9646f1fe25 pixel_85e75686bca4b3d1 pixel_89737a73a2ba2602 pixel_8a4657c349ec5411 pixel_8a554992123428f3 pixel_8a5563a82e4f37f6 pixel_8ae71c9d50152298 pixel_8b746e83a0387ca0 pixel_8bad84f961f1c483 pixel_8c08b51a0692f7fb pixel_8df843e46efb3b24 pixel_8ef83c6348e8e779 pixel_8f7caadf7346f3ad pixel_903eb02b1e2a8929 pixel_906cfc72665309a0 pixel_92993bd785831830 pixel_92b1a55082aaa140 pixel_92e82b8ce1f45b27 pixel_9319d0ae02ae5d87 pixel_9358532cccc2ed9d pixel_93887c7a13f4b6e3 pixel_93927c67b69ee8c4 pixel_9424b5dc2eee1dce pixel_95269dc2c42274e8 pixel_963a5e48bfc867e2 pixel_976ff6e5c2118002 pixel_977ebb08cafabd54 pixel_97c7e387598d08c5 pixel_97dabd9e42907c2e pixel_9806d46845446d02 pixel_98811b4f547754b4 pixel_98825bef8dd81fb4 pixel_98f2edbc7d876dd7 pixel_9a962198260cb878 pixel_9ac03205295b246f pixel_9b3bb4017b2890a0 pixel_9c0f18146a7f7093 pixel_9cf490770a1e4df1 pixel_9e6f91e948b5f3b8 pixel_9ebc64886d2773ab pixel_9ecb84cb94fdeea1 pixel_9ed56e438adfdc2f pixel_9f8d22efc0dad336 pixel_a00be81260c9c9fb pixel_a029ec45b949d68c pixel_a037a6ab0a7e3b22 pixel_a05870650def40eb pixel_a0ba2a21048b1290 pixel_a0cc7aa61196483c pixel_a0dad13c6fd02987 pixel_a13843c9e0388a46 pixel_a2062bb12583d32a pixel_a2e2b7dd2897a917 pixel_a546d8ea7b536eef pixel_a63b1de01236b59d pixel_a65c59ed3b7af65c pixel_a7c241eb2efd151c pixel_a8882a97469464ea pixel_a9120db8390cc14d pixel_ab7260a53be018e1 pixel_accb6f412587f600 pixel_ae4e5ed89203e13c pixel_ae84080b84b67e5f pixel_af003dd2e3a030e1 pixel_b0969c5224c19fda pixel_b0c04457c679f71a pixel_b0fc9ccd5dc60805 pixel_b1188dd0ad38f8bc pixel_b2115c45bdad7b04 pixel_b2611ce8a9951877 pixel_b32220c33f475b9c pixel_b4b9796db1fc8ac1 pixel_b533ec10f69b4ee7 pixel_b578e968c8693fe5 pixel_b581be84c4564f37 pixel_b5c471d2eba45faa pixel_b62d37f947c2aa87 pixel_b668214ceadbff0c pixel_b6911dd19305be30 pixel_b73e25b4caf8da14 pixel_b888e752ac70ad44 pixel_b9476846dbc10e19 pixel_b9b64333f03c8e18 pixel_bb152c337dbf2b2d pixel_bd05a31df6693a83 pixel_bd21c953f5caff21 pixel_bda2237161a0b8d9 pixel_c07251c682406442 pixel_c2206196771bab99 pixel_c256f8e411c0db80 pixel_c5b3f1b7358b92ec pixel_c5f6182afaad218c pixel_c612fd8a5efdb98c pixel_c870cee35bf8ff50 pixel_c9625a35f6553070 pixel_ca0e1c9643de1361 pixel_ca17dd888493ed64 pixel_cadf6ce8d481e20c pixel_cb6af5654502176c pixel_cb9b3284b3c8b171 pixel_cc16faaaff0f54d8 pixel_cce2cc2e0e94987f pixel_cd38895a307b5c54 pixel_cdcbd998352147d4 pixel_ce0d26705c408af7 pixel_cf0f5084272e0d85 pixel_cf902ab9b05fc9b2 pixel_cf9f2f93b0f47d32 pixel_d24b2ffe1ab8bef9 pixel_d2a0523490ed46a8 pixel_d408d346577515dd pixel_d42e8374f93a8420 pixel_d4914edccd3f4398 pixel_d49e179902e44822 pixel_d510ebb268a5ed87 pixel_d561eac566e99e77 pixel_d67e3ceec75b47e1 pixel_d8a50c4c24aa597c pixel_d95d4a95c7231ea9 pixel_d963df23b261179c pixel_d9f2e2117026b4a0 pixel_dae0d2dbadc97228 pixel_dae2eb92c9db824f pixel_dbbae7aa8df31654 pixel_dc167fa668bea179 pixel_ddb3769761824505 pixel_ddc01b82f7efcc48 pixel_dde5ea6d67e28746 pixel_e041eedf798c67d8 pixel_e06e203440fb3e27 pixel_e087a640940373b6 pixel_e0bec8a58c22ed4a pixel_e1b6236f0e3a25da pixel_e23df709d04efbe4 pixel_e2493c032f90abeb pixel_e668b3f420c19545 pixel_e6f81f2cb4dec288 pixel_e84666af882340cf pixel_eabd19deebe8001d pixel_ead47e29abda51e7 pixel_ebc1d3c8abccdf29 pixel_ebe0bd6e371ef20e pixel_ec25e95887bed1ae pixel_eed374ee230f2d30 pixel_eeff4ee7922986db pixel_ef655801c68e4fc2 pixel_f02ffef470d2544c pixel_f03cd75815023497 pixel_f0a7d7b47bfce6ae pixel_f1296dad8a12f66d pixel_f26962ccf4ea6ab5 pixel_f38be8cbfd3b2e9d pixel_f47f64cb1f3e7ffb pixel_f48047f10901928b pixel_f7c6bc66cc416b52 pixel_f84a531be2490468 pixel_f8fc8f34ee235bf9 pixel_f909889d3c1abd2e pixel_f9424453d9574a2c pixel_fab2ed41b7189ce3 pixel_fcf14387921ccd34 pixel_fd64f820722b258c pixel_fe85ee4eefd2b4b9 pixel_feccaf0c8c5578a7 pixel_ff1797b7f0f1aa31 pixel_ff7c6c1c8936537f
Tests.
mesh_tests::barycentrics_read_as_data_weigh_the_second_and_third_corners(victory-gpu, on Metal). The triangle program draws (−1, −1), (3, −1), (−1, 3). A guessed pixel program interpolates once, which makesv0/v1its perspective-centre pair, and exportsv0,v1. Every texel of the 8×8 target holds(x + 1) / 4and(y + 1) / 4at its centre (±1/255), so the weights are the RDNA2 ones in that vertex order. On main the program is refused.emit::tests::indexed_move_initializes_an_input_before_its_first_userelied on the refusal to show a raw read. It now checks that the initialized cases declare noSV_Barycentrics, and that the others are refused or declare it.Checks.
cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 1054 passed, 0 failed, 11 ignored.-D warnings: clean.cargo xtask policy: ok.docs/native-host.mdhas a section ("Barycentrics read as data"). I haven't checked this in a game run. @Olima34, for the board.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T02:00:41Z.
Thanks for this PR, now merged! For the record, an offline check on main
86cefd22(world corpus, 21,600 shaders):