Compare commits
1324 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b70a1edbc7 | |||
| 14e5aa57c8 | |||
| cdc49d166e | |||
| 7b65f93953 | |||
| d878a286bc | |||
| ce35554a55 | |||
| 1f17109203 | |||
| 4739eb3601 | |||
| 40a84dd477 | |||
| 309f409554 | |||
| a6f8e4f6b3 | |||
| 596db2c29c | |||
| 1fd33f611c | |||
| 5e3bacbd9b | |||
| 7cdb5f3123 | |||
| a168aa2df3 | |||
| 87fe93ee9a | |||
| 039e295e53 | |||
| 0fd888a42e | |||
| 1e71285de8 | |||
| a2200bd01e | |||
| 9a9455a696 | |||
| 19a698682b | |||
| 3baf79f929 | |||
| 74d47943e9 | |||
| d9c78cf495 | |||
| 8e4a09d9e5 | |||
| 67ac8bf070 | |||
| ef5225b776 | |||
| 48b0583866 | |||
| f528aada24 | |||
| 1f45f05f8d | |||
| b8fcbb68b0 | |||
| 4ab9a2a3a8 | |||
| 85c0219aed | |||
| 10e218e224 | |||
| 69d044cd8d | |||
| 7062efeb3e | |||
| cee53fcecf | |||
| ef8e92cbe3 | |||
| 7c73c3b75c | |||
| 1e826f5ccf | |||
| 96561c16ad | |||
| bd85f23ed9 | |||
| 557e1c3694 | |||
| c785b14c18 | |||
| 3751d5d5c1 | |||
| 45bb51ded8 | |||
| c3b424eb11 | |||
| 01ef9ecca4 | |||
| 0eb6bf6a67 | |||
| 4aab8db420 | |||
| 9263999ad1 | |||
| 4d9b56c7f1 | |||
| d0afef47f8 | |||
| af53ce6f76 | |||
| c0589cab05 | |||
| f35babad98 | |||
| 8369cb2af6 | |||
| 07d49b1bd8 | |||
| 5c8aab7917 | |||
| 14093c86a9 | |||
| e153df4d5b | |||
| 3e0c356b0b | |||
| 5fce74a2a6 | |||
| 7c418f7ea5 | |||
| dac72ff371 | |||
| baf22527b0 | |||
| 4cba60b27f | |||
| 5e539f71e6 | |||
| 9000407a77 | |||
| 4b6f8d2f62 | |||
| 688097faa9 | |||
| f08579d201 | |||
| 47fdaf6902 | |||
| 22c0f0d635 | |||
| a886e28f87 | |||
| 65104b5909 | |||
| 5605b4ee70 | |||
| 3ecba8e57f | |||
| 0c8bda4f41 | |||
| 458dbbd15d | |||
| b1aa87b515 | |||
| b637bd3866 | |||
| b4557789f8 | |||
| 63169d7679 | |||
| 5d705c0e9c | |||
| 682924b51a | |||
| 598c90f376 | |||
| e4962054a4 | |||
| 436c245d13 | |||
| 8891d85f75 | |||
| 763550c472 | |||
| d2ddb9882f | |||
| 64ac6a59c4 | |||
| acd9d6ff24 | |||
| f4b95c0226 | |||
| 177084b1f4 | |||
| aff0484ea2 | |||
| ef1eff6d48 | |||
| b407d12ed1 | |||
| e8bfce4ebd | |||
| be5f780977 | |||
| 9e39c8cd64 | |||
| 3356a76c9b | |||
| e29747170f | |||
| d6159a35aa | |||
| 0019ea28c3 | |||
| e899de88ff | |||
| bb111d325f | |||
| 73906f9f29 | |||
| b20d7ff48c | |||
| 8262d56574 | |||
| 257b9a2015 | |||
| ff07595519 | |||
| 6023794081 | |||
| a1189fa37a | |||
| 5a2a2f49ed | |||
| 6c372d1781 | |||
| 1669d0fdbd | |||
| 47b4c649f1 | |||
| ead67d8e67 | |||
| 8c4ba3257c | |||
| 05c4aa5017 | |||
| f84b2f072f | |||
| 9b122e5449 | |||
| 246b9f3182 | |||
| bf6854d121 | |||
| eebd48e51d | |||
| 9767cc84b0 | |||
| 11b0b6958f | |||
| cb1f30e9d2 | |||
| ec943b38a2 | |||
| 68f0393cf3 | |||
| fe26db4d36 | |||
| e3e4decabf | |||
| 6537909fd2 | |||
| 26ced19e18 | |||
| 3d85a89cc9 | |||
| 16944b0c4c | |||
| c4cc3ad81e | |||
| 0674a58502 | |||
| a809f33418 | |||
| bf33a1827c | |||
| 57ef6dae91 | |||
| 758f1bcdee | |||
| fa6fd5980e | |||
| 3762f1e50d | |||
| 5aaee670d1 | |||
| 9916f0e5c5 | |||
| 9eba0ac58c | |||
| 13493ec051 | |||
| b7a7a5c582 | |||
| 213527ca71 | |||
| dc7ac22f84 | |||
| 16d1577722 | |||
| bd6a7dea7e | |||
| 6433eebe1e | |||
| 35b7cf4c98 | |||
| c733d03525 | |||
| aef5113d49 | |||
| b21fce4d6f | |||
| be8d8ded3f | |||
| a5a2d43d7c | |||
| da878c36bd | |||
| 11e2965b5c | |||
| 4203f53b67 | |||
| d4c3905355 | |||
| 307da1fe39 | |||
| 44b2df27ea | |||
| 5ee0cea672 | |||
| df6607e236 | |||
| e32c49c12c | |||
| 8693031b06 | |||
| b644d5b2ae | |||
| 5e8852af80 | |||
| b6f8eface7 | |||
| fe23e0cc6e | |||
| bdca52a95d | |||
| 33d2618e5b | |||
| 2bc8723824 | |||
| 4ecf05aa13 | |||
| 1705638e25 | |||
| 5db0f47710 | |||
| ee173dc3a2 | |||
| 591a6c8671 | |||
| 6c189511af | |||
| a06223b844 | |||
| 9232ddf0ab | |||
| 1c14d872a8 | |||
| 98fc131d47 | |||
| 8ad31d2559 | |||
| 46dde3f8f7 | |||
| 8318eed068 | |||
| 778199ceb1 | |||
| 6b48a72d42 | |||
| 07a366b608 | |||
| d07ea31400 | |||
| aa357b9ae8 | |||
| 78ecb115f3 | |||
| 6cf006b02b | |||
| 7a356d3294 | |||
| fb56c14853 | |||
| fbf8231642 | |||
| f881282a8b | |||
| 435ef04c34 | |||
| f2ba41af46 | |||
| b4c77afdc4 | |||
| 2d9e02b0a7 | |||
| 9e84804eb0 | |||
| fb5df32990 | |||
| a1e725ffeb | |||
| 9cbecbd8cb | |||
| 1a4b5413bd | |||
| 124f5d0097 | |||
| 684089ba81 | |||
| b6bd02daf0 | |||
| 973bf5abdf | |||
| 80a9abcfc8 | |||
| 2c803dbe66 | |||
| 8454949eea | |||
| 7a9841bb2a | |||
| 22b1400018 | |||
| 44b8556dc6 | |||
| a342107021 | |||
| 1c9718389f | |||
| 5430e1d310 | |||
| 9abb908226 | |||
| 38562155d4 | |||
| 4f74cbe510 | |||
| 528b2d6c7b | |||
| 7884356e90 | |||
| 38f35df7b6 | |||
| fcb853792d | |||
| b72f6da853 | |||
| 623ddd966c | |||
| 9ff52cf063 | |||
| 8f5e94c155 | |||
| 6b7ce37374 | |||
| 66e57ae19b | |||
| 0d207a6c0d | |||
| 0b080aeefc | |||
| 867e9210d7 | |||
| 77f8ce503d | |||
| 530ea688e4 | |||
| 11a442272d | |||
| f87e396958 | |||
| 8d54bcbc0d | |||
| 03c86ae43b | |||
| ce21db2ce3 | |||
| 153a2d2b40 | |||
| e73fce2d60 | |||
| d43edb19d2 | |||
| 14205d3d1c | |||
| 30b804e0bc | |||
| 153f1cc50a | |||
| fc3179b698 | |||
| d4a55f4b06 | |||
| 03a5b5be1a | |||
| ad39615141 | |||
| 691d87978b | |||
| ebf54d6acd | |||
| 5f15c661c6 | |||
| c0ab0dee6b | |||
| 73e50b970d | |||
| 11858dce1a | |||
| a64053fd68 | |||
| 1ede5cbc4c | |||
| bb66b97251 | |||
| 6e07e07cd0 | |||
| a270ac7f02 | |||
| 7f3cb4d3c9 | |||
| 42b518cf7e | |||
| c24fba89e8 | |||
| 5b225ad59f | |||
| 8ebe9d7dc2 | |||
| 9beb2d8ae0 | |||
| 12099b3144 | |||
| 2aa2c1811f | |||
| af1ff4439d | |||
| 51bdf1e3ed | |||
| d7a899f984 | |||
| 707523c679 | |||
| e04de77f82 | |||
| be9cebbc8f | |||
| e3bc2273d3 | |||
| c20756136a | |||
| 066e3006bf | |||
| bbb0effe23 | |||
| ad174eb12c | |||
| 1c33c012ad | |||
| 3c82e1a58d | |||
| dbcb5df172 | |||
| dafb6b5c92 | |||
| 84d0d396ed | |||
| 56b9b38c9c | |||
| 05fb57baff | |||
| cc46f2d7e6 | |||
| 1f3433464c | |||
| b0f5796c90 | |||
| 0f87c4485d | |||
| 5e0489dcc0 | |||
| 949200cd3e | |||
| 2d512121f1 | |||
| 7a2802a5e0 | |||
| f0459e3891 | |||
| 1fd8c50d95 | |||
| 65fe9b0927 | |||
| 619d605a9e | |||
| b8721b6475 | |||
| a94b9d38b0 | |||
| c382ce5260 | |||
| fc56e70172 | |||
| 8c8242345e | |||
| 130f7905ba | |||
| 912072e60c | |||
| bdeccd889f | |||
| 009ac37a7d | |||
| 44ae306e6b | |||
| a7e808b35b | |||
| 46735d6b3d | |||
| 71441819e5 | |||
| 1a7ea2d235 | |||
| 4438163da1 | |||
| b7eda71673 | |||
| 0fcbd43db9 | |||
| 4de513eb01 | |||
| 9245308ff2 | |||
| 7be259217a | |||
| c9a789bf76 | |||
| 3cd2f735a7 | |||
| b61ac15c47 | |||
| fb47945930 | |||
| 247c776a1b | |||
| eb1d4811de | |||
| d646fbb94f | |||
| 98f09e4f27 | |||
| 7a6f5b6ee5 | |||
| 8ff155a2c9 | |||
| f7dcaa4a68 | |||
| dcd2bbaa3d | |||
| 5a36c57c57 | |||
| 662fce38bd | |||
| 4dd67cdd54 | |||
| 47a9c8d731 | |||
| 9a081369c8 | |||
| 208f4c3e27 | |||
| c618e02695 | |||
| 61c6f82f74 | |||
| e6bd91ada0 | |||
| e585939ac2 | |||
| 3576e13e9a | |||
| 470ed777c2 | |||
| 7195b2e907 | |||
| 32a03344b3 | |||
| 9e7902455d | |||
| 68cf570b58 | |||
| 1c69eb2b73 | |||
| 6a9f3040e1 | |||
| 190fc4301e | |||
| 22a89a272e | |||
| 4c46bde315 | |||
| 0578430fd0 | |||
| 33e13aa7e7 | |||
| b9f4c15ec0 | |||
| 15500d4ee9 | |||
| 2528fc4555 | |||
| f8719c1230 | |||
| 33c59fa51b | |||
| 2b6f8a075e | |||
| ac771f951d | |||
| e297984e59 | |||
| 8b12379eb3 | |||
| 2064f1cb80 | |||
| e377199e41 | |||
| a8f977ed9e | |||
| 44bee7d0ba | |||
| c100328a6f | |||
| 1672c93a2d | |||
| 2a3029a62c | |||
| 53b2e19d96 | |||
| 132093c80e | |||
| 5c9f83c3a8 | |||
| 712c04b2ad | |||
| 39dadad534 | |||
| a026d35c97 | |||
| 7ccdea7822 | |||
| 09ae45c566 | |||
| deeb4acbe5 | |||
| 5eb98b745f | |||
| 74fec275c7 | |||
| a0c0df6e9d | |||
| 0ae8cc4467 | |||
| f36f478281 | |||
| 0227c03366 | |||
| 8157e7cac8 | |||
| ae634bb87e | |||
| 2af86e363c | |||
| e9bee80f4b | |||
| cc30e1aa47 | |||
| 854bc1db60 | |||
| d3837de571 | |||
| e1ff3f4674 | |||
| ceb4cb59ac | |||
| fc9fdca3f6 | |||
| 6296453ef3 | |||
| 04926374f7 | |||
| a186af32ec | |||
| 7ac9d3b679 | |||
| 2e5b01faca | |||
| 2337bf204c | |||
| b2a7dac11b | |||
| c6ed5a8e6b | |||
| d97cdb9fbf | |||
| 692d9dd4ae | |||
| 260865de6d | |||
| 438e057dc8 | |||
| 59433bfcd5 | |||
| 96728a83f6 | |||
| f5e65e4ad9 | |||
| c95f6c8c56 | |||
| 73c2115968 | |||
| 5d6aecc599 | |||
| 2085d318bb | |||
| c77dec6d6a | |||
| dc34d5b350 | |||
| ca835ba68a | |||
| ce56351554 | |||
| d60b292ef1 | |||
| eb377f425c | |||
| 4c4e4fc772 | |||
| 6401eefb26 | |||
| ea6f3ff5ed | |||
| 97581d8635 | |||
| 6bac4a535b | |||
| 0a5b518aea | |||
| 94da0dbd4d | |||
| 87e38118a5 | |||
| ba8fd825ec | |||
| 2c981cf940 | |||
| 11f7b167ae | |||
| 06c6c8212d | |||
| b89961f01d | |||
| 59df7e7104 | |||
| bbf7e6332c | |||
| 8c3b3f7ab4 | |||
| 47987efb75 | |||
| ed8ebda804 | |||
| d4da0e052d | |||
| 6705a6ecc9 | |||
| dfa968863a | |||
| 70885ada67 | |||
| 71b21fe793 | |||
| 1f4ebf1501 | |||
| dcb3169f56 | |||
| 772706ca4c | |||
| 77594dc66c | |||
| 0dc00b8104 | |||
| 758897a929 | |||
| 5c4af45bf5 | |||
| effd379c25 | |||
| a6b7c9c309 | |||
| 85c4392b34 | |||
| c3bac7c92b | |||
| 45d41267f5 | |||
| 869e10027d | |||
| 246b593783 | |||
| d22017bfca | |||
| c7965405d3 | |||
| d7358848e1 | |||
| 989f954432 | |||
| 4d88296485 | |||
| 086e1c34dd | |||
| e6c6a7fb8b | |||
| 32830d45ff | |||
| 223979c088 | |||
| 0ea0c21fed | |||
| 7a921cbdf9 | |||
| 9db7de29fb | |||
| 63e690ca11 | |||
| a19b721c26 | |||
| 73ea020525 | |||
| 2c10348408 | |||
| 028277bd2d | |||
| 67a341fded | |||
| 44879dd9f3 | |||
| 6ae54ae27b | |||
| bf8a20c4b9 | |||
| 55bc9eda9a | |||
| e296f81a37 | |||
| d69a4173fa | |||
| 4a08e8cd0b | |||
| 7779742ac1 | |||
| 091b6711ae | |||
| d0442e140b | |||
| 714e07b1dc | |||
| 001ab05f1a | |||
| f30d71da6c | |||
| d22ac91ee1 | |||
| cbf880fb71 | |||
| 8fd3064905 | |||
| e83c387ebe | |||
| 3b5cd4845e | |||
| c0487a634e | |||
| c299a65aab | |||
| 62a9c38754 | |||
| 67fe5e1107 | |||
| 1778113b71 | |||
| 8637754d6a | |||
| 083c4fc855 | |||
| 251fb86ab0 | |||
| 5853332db7 | |||
| 860926d731 | |||
| eb889920e6 | |||
| c96057296a | |||
| 863d963e97 | |||
| 0cf4b378f9 | |||
| a8bebcba55 | |||
| 6fa5e2cc7c | |||
| ff0bb52689 | |||
| 298c9fea22 | |||
| 244f3dfb89 | |||
| 28366d35d2 | |||
| c4733a6eab | |||
| f6b5f02501 | |||
| 338fb6cc7e | |||
| 833c100850 | |||
| 9d01396737 | |||
| 1e39c691dc | |||
| bc63eaea48 | |||
| 795170635f | |||
| b52e885cde | |||
| 079411eee8 | |||
| d66bd5f70f | |||
| 9f1ee5bd28 | |||
| a66147705f | |||
| 3a63b62486 | |||
| 28a5d4d4f0 | |||
| 6761d4a30c | |||
| ed94626411 | |||
| 40a598b0ab | |||
| ea528a1ced | |||
| caf5894152 | |||
| 3956b21cb7 | |||
| 35ab3b0cd8 | |||
| db27ea923d | |||
| 4260f68f85 | |||
| c4102f3b18 | |||
| 9710044134 | |||
| 39767b8d46 | |||
| e5a792515e | |||
| 8f67c910ab | |||
| 136295f70e | |||
| 6b3c47a42a | |||
| 60a7f9b3f2 | |||
| d22672b156 | |||
| dc970c513a | |||
| 2bcc755fca | |||
| ed93c77433 | |||
| 92446de9d9 | |||
| 2e5d20c315 | |||
| 31ec26a7a1 | |||
| 8d2b6f6054 | |||
| b073ead988 | |||
| 97083ebba4 | |||
| 713ae91e27 | |||
| ee645d054d | |||
| df6ee9c29d | |||
| fc1408e643 | |||
| 214d3d0f1a | |||
| edc92843a7 | |||
| cdefb969ec | |||
| 266db1336d | |||
| e2d82394f6 | |||
| 38c444cfa1 | |||
| 5c52521a0a | |||
| 5aae9b5536 | |||
| 42423588c8 | |||
| ce3fdeda5e | |||
| 805c778f91 | |||
| aafcf44581 | |||
| da7472fe81 | |||
| 75fe95eeb1 | |||
| efc8779275 | |||
| 81780d1932 | |||
| 85d0fff233 | |||
| fe1e7a1bdb | |||
| f63ec52479 | |||
| 6312bf5323 | |||
| f8f067ca7c | |||
| c7738b8b37 | |||
| 643c15c4e9 | |||
| 0c7f763889 | |||
| b85fc50854 | |||
| edd0965c1a | |||
| 766f1b2b01 | |||
| 984aa44220 | |||
| b85a68e8a1 | |||
| 4cf41305e0 | |||
| c4e99dbdb2 | |||
| 42e1d4d752 | |||
| 5637c22363 | |||
| 7e30a0f464 | |||
| 2553e45d76 | |||
| 250ce63527 | |||
| 5fc6f59821 | |||
| 7c1ab47262 | |||
| 6b5ee57718 | |||
| d846eac0f1 | |||
| fefeba03b8 | |||
| 56ac7f2572 | |||
| 3a3d264cb5 | |||
| 2ae5a7ff39 | |||
| 2e17ea1490 | |||
| cbe119b457 | |||
| 960f4ceefc | |||
| 5ad060f150 | |||
| 1ff4f77eaf | |||
| a8e15ce18a | |||
| 3ee56627eb | |||
| cedc023922 | |||
| 8189577e8f | |||
| b57daef75a | |||
| 62258a1f1a | |||
| dab1dda903 | |||
| 1a61ef0440 | |||
| 4eb1267c5c | |||
| e9766f1b76 | |||
| b21e226b1c | |||
| 99717b7902 | |||
| bad2d7f121 | |||
| 8413cd7b0a | |||
| d59486295d | |||
| f81a02ed5e | |||
| 69d08b6691 | |||
| c95c4c32e6 | |||
| b46fc2fc49 | |||
| 5a3cf5d9ac | |||
| 7542d38681 | |||
| ce072f25e2 | |||
| d5bb951237 | |||
| 4c0b5bbc62 | |||
| 51a6862bf4 | |||
| b6c827b17a | |||
| 17c4b2387e | |||
| f712b8aca4 | |||
| 91d0229bc5 | |||
| b7c539ad7a | |||
| 0c231e6578 | |||
| 77674be1c1 | |||
| 70903d46e6 | |||
| f86c079acf | |||
| 38d57eb02c | |||
| d5e44f6224 | |||
| 3fbc3a3f00 | |||
| 427270884c | |||
| 73233fd347 | |||
| d971c4e0f6 | |||
| 7f25720bd3 | |||
| f2c82d3cf4 | |||
| d53a1d10ab | |||
| 5b181ed28c | |||
| c1e2b75a49 | |||
| 08b47616b6 | |||
| 13d58ac355 | |||
| 96329a6e29 | |||
| 9f257ee9f8 | |||
| 8cd0aab129 | |||
| ccb2d89744 | |||
| aa3c97f918 | |||
| 7a988c73a6 | |||
| 9b18bd4cd7 | |||
| b81cf01456 | |||
| daabbba5fc | |||
| bbf7a070e7 | |||
| 27a8c074fa | |||
| 855d6935d9 | |||
| 35570a5ebf | |||
| 21e7206f7a | |||
| 1b33abf287 | |||
| 0838e3209e | |||
| 9485fe2693 | |||
| cf402c8954 | |||
| 0327e76320 | |||
| a120414d32 | |||
| d995bfbdfb | |||
| 36aace57ca | |||
| c6bd5d09f8 | |||
| 23a0116975 | |||
| f72f6fe9c5 | |||
| b00acff9dd | |||
| 284d2c43f9 | |||
| 0a08f9595e | |||
| 29c29d0074 | |||
| efd52a0547 | |||
| 4f2bda26fc | |||
| a14dd8ea51 | |||
| 6f9f5f7918 | |||
| 1f500aad53 | |||
| 34eb85683c | |||
| 6fab5a885f | |||
| 38f93461d1 | |||
| 6182f5346d | |||
| afefecf1f0 | |||
| ed03e41f88 | |||
| f14a06938c | |||
| e91042af97 | |||
| 617a488a0a | |||
| 854919b5e2 | |||
| 8f788cb522 | |||
| 6078f25aa7 | |||
| 4484e8c3f0 | |||
| b6bcdade81 | |||
| 6adf086ed1 | |||
| e7fc5228d5 | |||
| 23f03a19e8 | |||
| 2060f02636 | |||
| e34b5f1f55 | |||
| e083c1471c | |||
| d9eba43360 | |||
| 3506d03dc5 | |||
| 24eb544046 | |||
| 6a1f0aed36 | |||
| a0c433a065 | |||
| 6229733fbb | |||
| 7e971eb032 | |||
| 01ce1c31d1 | |||
| 212fd4b340 | |||
| 659f3d856a | |||
| 8cded28c45 | |||
| 454fbce4c6 | |||
| 26738762ea | |||
| cd5edc38ff | |||
| 5250911a40 | |||
| 45e48c2499 | |||
| 15901589a5 | |||
| bdecd3c180 | |||
| 61de5e8835 | |||
| 3b3fffa962 | |||
| 63ad2cce72 | |||
| da2caa0881 | |||
| 93b06f2a39 | |||
| f2d5542e66 | |||
| 7584f29ec7 | |||
| 9fd244cf9c | |||
| bb722d5824 | |||
| 5de70628d7 | |||
| e33c684b49 | |||
| d9dbb1565a | |||
| 34992d8a8f | |||
| 9d7c186a4f | |||
| 702193a6c7 | |||
| bbe00f6505 | |||
| 70a80b84d7 | |||
| c8cc681591 | |||
| 8604f5a02f | |||
| 26ff4fd6b7 | |||
| 4bfd019c0d | |||
| 82bc41f4ad | |||
| 01abb255b2 | |||
| cc713a0091 | |||
| 93032be4ab | |||
| 26964efa7e | |||
| f0ded46753 | |||
| 47d251a818 | |||
| b018c91135 | |||
| d910d2c572 | |||
| f384d87044 | |||
| bd52bcf8d4 | |||
| d58bd1c916 | |||
| 22d49ae96a | |||
| 3b6e3fb3b4 | |||
| d287ba44ce | |||
| 4c133ab5bf | |||
| ee0eb70de4 | |||
| 4b0b65c0c5 | |||
| d0ea8d5262 | |||
| 9b505984f2 | |||
| 9adb534c7f | |||
| c3fb1419fd | |||
| dd233c9f38 | |||
| 9e01f2817f | |||
| 8831bd0918 | |||
| b2b9f535dc | |||
| a880ce89d1 | |||
| 06cbe4a0bc | |||
| a6a4081894 | |||
| bcf4a6209e | |||
| 4d71df70db | |||
| 05f2aaf2b9 | |||
| 1dcc6858b4 | |||
| 52e2800fb5 | |||
| d74e031d4e | |||
| 2ae687cf00 | |||
| a196ee1957 | |||
| 81fcadac38 | |||
| 4966d50e52 | |||
| e860f7fb14 | |||
| 5911b3c1f1 | |||
| 77371e973f | |||
| b0a2f9f65a | |||
| e80bdf120b | |||
| 8d3235cd7c | |||
| 51462226a7 | |||
| 094c4057be | |||
| 2f89d15079 | |||
| c4dab6e644 | |||
| 72375d9e3d | |||
| 674373dd6c | |||
| 7eb5da73fe | |||
| 12d8b795f7 | |||
| 0ed770633b | |||
| 19257b3121 | |||
| 32434dd848 | |||
| 9cdb74efc7 | |||
| 0e5c54709d | |||
| 35db227af4 | |||
| a6ba47265f | |||
| 62246f75c8 | |||
| a6d8d1144c | |||
| 5ef7f8bf3e | |||
| 09fc492257 | |||
| a78ba8a271 | |||
| 263e5beb26 | |||
| 7ae680d9d1 | |||
| c07b0dc373 | |||
| c5b3359c4b | |||
| a7fbd6c9a9 | |||
| 5cbcd07ff1 | |||
| 047d59df0c | |||
| 41687af077 | |||
| 6353575208 | |||
| 974ea68cf9 | |||
| 0f0de47c83 | |||
| 8a3d15d4fe | |||
| 422f5c0008 | |||
| 5a14644cd4 | |||
| 4e4325a2bf | |||
| 79dc835378 | |||
| 9404cd5cd8 | |||
| 9ef24509cb | |||
| 4b54d7ece1 | |||
| a9180ce187 | |||
| c0423d513d | |||
| b6323861a5 | |||
| a451bb574e | |||
| fe551148d8 | |||
| 1675a82efd | |||
| 71a975c685 | |||
| 3813c09be6 | |||
| 3b7d0bc3fc | |||
| 2230975e55 | |||
| 787619cdba | |||
| 7d70be42af | |||
| 9671a654b7 | |||
| 6963157e63 | |||
| 9452c6b08c | |||
| 035875825e | |||
| 837e06e85b | |||
| 9e3132c3fc | |||
| 843d0ed298 | |||
| f7f4c049fc | |||
| 1072540e3e | |||
| 0c8c13b8b7 | |||
| 303a109286 | |||
| f0dc38cadd | |||
| 4efa2266e6 | |||
| 1f7a1e4078 | |||
| 2ead9b1f21 | |||
| ddf5b52360 | |||
| f66468ffcd | |||
| d3405da5c4 | |||
| 020d282868 | |||
| 137821c866 | |||
| e6d2e05b6e | |||
| 7b889a10cc | |||
| 1e1c2007a3 | |||
| 660f491310 | |||
| 670660c244 | |||
| 3d960064ef | |||
| f6d2409b20 | |||
| 39bc897b93 | |||
| 5f35f2ac7d | |||
| e1eb075604 | |||
| d19d9ccd0b | |||
| b4b4ae7a78 | |||
| 149fa9d750 | |||
| 791070c158 | |||
| 3bd2114815 | |||
| 46de48593c | |||
| acd384ae2d | |||
| b77666cbba | |||
| 128ee67bba | |||
| 7417033d7f | |||
| e8a940172c | |||
| 290bdc4566 | |||
| 220aab1fd0 | |||
| 8e9f456029 | |||
| aa450b56f1 | |||
| 6d70f3c237 | |||
| 6384541345 | |||
| ffb014ca3d | |||
| 3c3f92f29b | |||
| 24255f7883 | |||
| 40fa836b81 | |||
| b71caa94ac | |||
| 39658c0c52 | |||
| 9b8522e734 | |||
| 9875bf9c7b | |||
| 4ce4cf5242 | |||
| 52110e0647 | |||
| 19ce0cdc09 | |||
| 2e58f312d5 | |||
| 7523d01e0f | |||
| 7972cb5bdc | |||
| 685d5d3ea3 | |||
| 9f7caf90e3 | |||
| f453194e32 | |||
| 440c637b1f | |||
| d95809a069 | |||
| 6aac972bda | |||
| df3fddc026 | |||
| 1ce49b60d9 | |||
| 8b5b23e6c0 | |||
| 26f329d186 | |||
| 5ace4438e2 | |||
| b8e10225f9 | |||
| 224facf3ba | |||
| 9c12d8ff22 | |||
| 3b4339c8e0 | |||
| 8e12c4cb00 | |||
| efe1678088 | |||
| 2f5be3559e | |||
| 960668ecf1 | |||
| 83084467c6 | |||
| 8464ab6a23 | |||
| 74ec128e62 | |||
| 194c6b8bee | |||
| 69272edba6 | |||
| 38531459df | |||
| b3e3c68f15 | |||
| 5029dff73a | |||
| 689dee9944 | |||
| 68f9898171 | |||
| 08622a41b4 | |||
| 669a3277ff | |||
| e6bd681227 | |||
| 0c5cfdddba | |||
| d08ce79d04 | |||
| bab52c132d | |||
| cc1efd2a46 | |||
| 8297d963bf | |||
| a17c41b4e1 | |||
| b055747d4f | |||
| 4ef76866a5 | |||
| 675ccd4510 | |||
| 31a925b4f0 | |||
| d153575e59 | |||
| 3afc62e525 | |||
| f8446b227b | |||
| 8f937bda0f | |||
| 9d1208bf95 | |||
| e7591439f4 | |||
| fef0b1dd46 | |||
| 3281a1982e | |||
| b8486a489d | |||
| f97d791fe8 | |||
| 657a6c9511 | |||
| 38514c291d | |||
| f138be2e6c | |||
| ecda02c099 | |||
| e9560da4e2 | |||
| 6406cece57 | |||
| f7e787958e | |||
| 8912b9880e | |||
| 3ac9e0933f | |||
| c1be0cf3bf | |||
| 48919330d7 | |||
| ba12c489ec | |||
| dbccf5fbad | |||
| 509bbddac1 | |||
| 11ccc498fd | |||
| 836d14c8af | |||
| 5a4babb0fd | |||
| 4e08d35661 | |||
| 7186b72a56 | |||
| 2b40ebdbc0 | |||
| cae2d929ab | |||
| 34336ebfce | |||
| f38d0e92e7 | |||
| 854365e6ce | |||
| 3529554c88 | |||
| 2a1f19b776 | |||
| 324b2da3ec | |||
| 07f6896622 | |||
| 8417e21e8d | |||
| 404b15b3c3 | |||
| 02473324f4 | |||
| ed68e864c2 | |||
| bc3065939f | |||
| d1e91433ad | |||
| 4e7e895822 | |||
| 2bccf3f2af | |||
| 3586c7613a | |||
| b1c8c0a448 | |||
| 5a18c3f8ea | |||
| 3055de0444 | |||
| 6811195345 | |||
| 5f12a4f7b5 | |||
| e748fc294b | |||
| 082815f93e | |||
| 2da52d0309 | |||
| 702423158c | |||
| 969e2d8c57 | |||
| 5a60a5bebd | |||
| 44840dbbcf | |||
| d6b2230b92 | |||
| 0e0345824e | |||
| d917cfa43f | |||
| 813e753e3d | |||
| c4b3b967d9 | |||
| b41fcf3734 | |||
| ecad586739 | |||
| 64036e0478 | |||
| 9c6539ea2d | |||
| a97dc349b7 | |||
| 243bc0d06e | |||
| e7df81ade0 | |||
| 743f5f07cb | |||
| 3ed603074c | |||
| e8310e6c50 | |||
| 3ca634138d | |||
| d8bef46c2a | |||
| ae83ab5436 | |||
| a00111a863 | |||
| 7416fe91fc | |||
| e4631f93bd | |||
| f2df9b469a | |||
| 4b7f9c38a6 | |||
| a666318b95 | |||
| aa811b6eef | |||
| 321e6d3a86 | |||
| 56ba5a765b | |||
| aa4fb80465 | |||
| d68c748976 | |||
| 8a21e0fcb8 | |||
| 408581b7bc | |||
| 416d66a438 | |||
| 5672ba887b | |||
| 14123d67e1 | |||
| 69b3828086 | |||
| a44c54b428 | |||
| dc5a439ec9 | |||
| 81f05daff2 | |||
| 456f83671a | |||
| d7b4b2fd49 | |||
| 27807f3a61 | |||
| fcf7751008 | |||
| 1cda2977bb | |||
| 6221fecf3b | |||
| 80dc122742 | |||
| 929f518ef3 | |||
| 6fae5863cf | |||
| 56704888b5 | |||
| 266504a0ac | |||
| 08d05e245d | |||
| 6f584049a2 | |||
| 52129a3d71 | |||
| 27ad98ee98 | |||
| d90850e697 | |||
| 717d99795c | |||
| 8e4ad3dfcb | |||
| be1c9100cc | |||
| 65750aea12 | |||
| 0e27b68ba7 | |||
| 6c01658d37 | |||
| 8e451126ac | |||
| 7ae1b51753 | |||
| 0d6297fef0 | |||
| d01235ce2d | |||
| 38709058a3 | |||
| efe430733b | |||
| 3465106456 | |||
| 24128ba450 | |||
| 298eb46a31 | |||
| f245799479 | |||
| 82cb8fe5bd | |||
| b18e337781 | |||
| f3311bb5e5 | |||
| 8a1ce6ba64 | |||
| ca6783ba9a | |||
| 78bfd54ad4 | |||
| 52be47ca89 | |||
| 19cf749944 | |||
| 178bcfc8df | |||
| 83cb137721 | |||
| 8edf35a9e3 | |||
| 6930cbc064 | |||
| 450c8245ed | |||
| 88d7feda5c | |||
| c9c436e6fc | |||
| f4091b1027 | |||
| 174fb97172 | |||
| ed3ac91263 | |||
| 377bdae6a9 | |||
| 3d2386f903 | |||
| a21c9f9861 | |||
| cdcef4c8ee | |||
| 1e9d1c1dd9 | |||
| 399478c2cd | |||
| c86cfef58e | |||
| 7a996648bb | |||
| f438554fc1 | |||
| 8d5d545f3f | |||
| d511fd6529 | |||
| a19a9b5585 | |||
| f3dd9596cf | |||
| 115255c162 | |||
| 984f5c6914 | |||
| fa845fa5c0 | |||
| 579096c6a8 | |||
| 7e938b2363 | |||
| 0d2c4c24b4 | |||
| d0338cddf7 | |||
| d15300a549 | |||
| b9d8d9383a | |||
| 85cf918aeb | |||
| b5add0f027 | |||
| b238107a99 | |||
| 68608ef894 | |||
| 5447521ce5 | |||
| 247af0ebbf | |||
| 3e5f0e5c37 | |||
| 9fdc458d69 | |||
| 4a669fd86e | |||
| 8edef32c76 | |||
| 307015382d | |||
| 471e807ea2 | |||
| bb4b12f253 | |||
| 432bca26ae | |||
| 5f6caf33f0 | |||
| 60dc4abc2b | |||
| e2d0a63b98 | |||
| 0fc55de769 | |||
| 570ca1c87f | |||
| 6e666b63fa | |||
| 2ac47548b0 | |||
| a79ffdb485 | |||
| daf2d3a02e | |||
| e9d9bad643 | |||
| f34bd724e3 | |||
| fd13a495de | |||
| 7dfe9415c4 | |||
| 080e503954 | |||
| a4db58f5f2 | |||
| 009aa3dcb9 | |||
| b46c66b4c7 | |||
| 039e729881 | |||
| c152c20d70 | |||
| 917f08c534 | |||
| ae5d95d462 | |||
| 925d6889a6 | |||
| 231f322b60 | |||
| 2a5f5c0dc2 | |||
| 5d5a4f804b | |||
| 9c2f48cd1d | |||
| fac9d74344 | |||
| 5dfc22a604 | |||
| 660bc34157 | |||
| 70b9271cd8 | |||
| 8da7361794 | |||
| 896562238c | |||
| 0cc4b555d1 | |||
| e76abf875f | |||
| adcb9864df | |||
| 2a9895b7f0 | |||
| 2ad7051746 | |||
| 02ce78482c | |||
| 61755ed017 | |||
| ae38ae9aff | |||
| b5cf7fba2e | |||
| 449c41aca2 | |||
| 2043181501 | |||
| a2f7f371dc | |||
| 29cde1a618 | |||
| c570d60f45 | |||
| 893175f511 | |||
| c197b54774 | |||
| 124d0de325 | |||
| fdae12c52e | |||
| 59c549ac86 | |||
| 1ec18bdf64 | |||
| 42467ba40f | |||
| 9f51bce2aa | |||
| 8f84fca0f2 | |||
| 0e3ab35e32 | |||
| 119126c60c | |||
| 5c42a3cbc4 | |||
| 6133590903 | |||
| eec64ef1c0 | |||
| 8afa6e59b2 | |||
| 9f49232cac | |||
| bc7e30517b | |||
| fe902cbb13 | |||
| 42f3296791 | |||
| 08b03db5fa | |||
| f842c206f3 | |||
| c0255208cc | |||
| 77c2ca6862 | |||
| e8ebb005fd | |||
| c64bbcf87a | |||
| 89f14ec5ac | |||
| 1673ba217c | |||
| a273768c4d | |||
| bc8b71cbc1 | |||
| 9d6df238d5 | |||
| fd628d8345 | |||
| d4e0da3f80 | |||
| 8cfabf0ead | |||
| b3b07c8248 | |||
| 6f8544281a | |||
| d1b5dcfdad | |||
| a462b4518c | |||
| 77bf86eaa5 | |||
| b3db9255e4 | |||
| f5bd044096 | |||
| a2997a1109 | |||
| b0f8611f49 | |||
| de97d3a7aa | |||
| 0e98da2306 | |||
| 5a064be490 | |||
| ec0005195d | |||
| a974ee009e | |||
| cc02a147d3 | |||
| 9ee9efeb76 | |||
| decd2b4f5a | |||
| 9f3b42bd71 | |||
| 4dcb63436c | |||
| a443682aaf | |||
| 4a55ba3067 | |||
| 3f6b826ab0 | |||
| 37a3800597 | |||
| 6d99516489 | |||
| 74daf9145a | |||
| 92e90101e2 | |||
| d8d09b5472 | |||
| 5de1ea3fd4 | |||
| 9136cbfcf2 | |||
| 07b3897499 | |||
| 737080274a | |||
| e4f6eb04e8 | |||
| bbfca3fc0d | |||
| ff01e26c5c | |||
| 2b60de32f9 | |||
| 3449bd3842 | |||
| fc40b0ed6b | |||
| 426c69710c | |||
| a63fdf6c45 | |||
| 4154a1026f | |||
| b5127e68de | |||
| dd000caad7 | |||
| 86fff9800f | |||
| 2679e4f526 | |||
| 1e431edf09 | |||
| 67f1f0fea3 | |||
| beabc88f79 | |||
| e086b7a522 | |||
| dd1afe85ae | |||
| 60bccf0f10 | |||
| 73535e0c04 | |||
| 16311b36b0 | |||
| 537187687d | |||
| 403f585a19 | |||
| 8dd19d1446 | |||
| 71552f7ffe | |||
| b2a7f0fd11 | |||
| 529efd6ac8 | |||
| ed61023dd3 | |||
| 28cdfa9feb | |||
| bf474f0cdb | |||
| d27f6c8fa7 | |||
| 6f71d04aa4 | |||
| 3de47c201c | |||
| e3e5b46cbf | |||
| 4cd9e5754e | |||
| ceab44b9ab | |||
| 0138a95567 | |||
| d86469c2f5 | |||
| 97a67746f1 | |||
| fd6295c2f5 | |||
| f483c3b9ca | |||
| 98943fc9e8 | |||
| 2bd6265a17 | |||
| 5feba39ff7 | |||
| e11e67df28 | |||
| c15027b95e | |||
| 6cb036d35f | |||
| cc0c3fc98d | |||
| 86720f90cd | |||
| 3721941ffb | |||
| 4fdeeace66 | |||
| 1c890f85c5 | |||
| 6cd62a9fd0 | |||
| 1e7ded2163 | |||
| a7262d34f0 | |||
| ebf28f8da0 | |||
| d511153836 | |||
| 2f211e4e5a | |||
| a5ecbd0b2b | |||
| 8d986e77d1 | |||
| 3d643fbc0b | |||
| cd71125277 | |||
| 55ca625371 | |||
| 81546d357c | |||
| 3acc900363 | |||
| 6b0d29a72d | |||
| 442abcc6f1 | |||
| c7b7d1f71f | |||
| 62d7bf2159 | |||
| 07e13b8613 | |||
| f1f31e22f9 | |||
| 9a0232bc87 | |||
| 8e83ad7b65 | |||
| 703b1636c8 |
@@ -0,0 +1,33 @@
|
||||
Standard: Cpp11
|
||||
UseTab: ForIndentation
|
||||
TabWidth: 1
|
||||
IndentWidth: 1
|
||||
AccessModifierOffset: -1
|
||||
PointerAlignment: Left
|
||||
NamespaceIndentation: All
|
||||
ColumnLimit: 200
|
||||
BreakBeforeBraces: Allman
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakBeforeBinaryOperators: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
Cpp11BracedListStyle: true
|
||||
IndentCaseLabels: false
|
||||
SortIncludes: false
|
||||
ReflowComments: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignTrailingComments: true
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
AlwaysBreakAfterReturnType: None
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
IndentWrappedFunctionNames: false
|
||||
|
||||
#SpaceAfterTemplateKeyword: false
|
||||
@@ -0,0 +1,7 @@
|
||||
root = true
|
||||
|
||||
[*.{h,cpp,hpp}]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
+15
-6
@@ -32,11 +32,14 @@
|
||||
|
||||
/build
|
||||
/bin
|
||||
/libs
|
||||
/lib
|
||||
/tmp
|
||||
/ipch
|
||||
/rpcs3/Debug
|
||||
/rpcs3/Release
|
||||
/llvm_build
|
||||
/Vulkan/Vulkan-build
|
||||
/Vulkan/glslang-build
|
||||
|
||||
/wxWidgets/lib
|
||||
/bin/rpcs3.ini
|
||||
@@ -51,9 +54,10 @@
|
||||
/bin/*.exp
|
||||
rpcs3/git-version.h
|
||||
|
||||
# Visual Studio Profiler Files
|
||||
# Visual Studio Files
|
||||
*.vspx
|
||||
*.psess
|
||||
*.VC.*
|
||||
|
||||
# Copyrighted files
|
||||
/bin/data/
|
||||
@@ -70,9 +74,14 @@ rpcs3/git-version.h
|
||||
bin/dev_hdd0/*.txt
|
||||
x64/*
|
||||
rpcs3/x64/*
|
||||
rpcs3-tests/x64/*
|
||||
|
||||
.DS_Store
|
||||
rpcs3/Emu/SysCalls/Modules/prx_*.h
|
||||
|
||||
/CMakeFiles/
|
||||
# cmake
|
||||
Makefile
|
||||
*CMakeFiles*
|
||||
CMakeCache.txt
|
||||
*cmake_install.cmake*
|
||||
|
||||
# cotire
|
||||
rpcs3/cotire/*
|
||||
rpcs3/rpcs3_*_cotire.cmake
|
||||
|
||||
+31
-5
@@ -3,15 +3,41 @@
|
||||
url = https://github.com/wxWidgets/wxWidgets
|
||||
ignore = dirty
|
||||
[submodule "rpcs3-ffmpeg"]
|
||||
path = ffmpeg
|
||||
path = 3rdparty/ffmpeg
|
||||
url = https://github.com/hrydgard/ppsspp-ffmpeg
|
||||
[submodule "asmjit"]
|
||||
path = asmjit
|
||||
url = https://github.com/kobalicek/asmjit
|
||||
ignore = dirty
|
||||
[submodule "llvm"]
|
||||
path = llvm
|
||||
url = https://github.com/llvm-mirror/llvm
|
||||
branch = release_36
|
||||
[submodule "minidx9"]
|
||||
path = minidx9
|
||||
url = https://github.com/hrydgard/minidx9.git
|
||||
branch = release_38
|
||||
[submodule "rsx_program_decompiler"]
|
||||
path = rsx_program_decompiler
|
||||
url = https://github.com/RPCS3/rsx_program_decompiler
|
||||
[submodule "GSL"]
|
||||
path = 3rdparty/GSL
|
||||
url = https://github.com/Microsoft/GSL.git
|
||||
[submodule "libpng"]
|
||||
path = 3rdparty/libpng
|
||||
url = https://github.com/RPCS3/libpng
|
||||
ignore = dirty
|
||||
[submodule "Vulkan/glslang"]
|
||||
path = Vulkan/glslang
|
||||
url = https://github.com/KhronosGroup/glslang.git
|
||||
[submodule "Vulkan/Vulkan-LoaderAndValidationLayers"]
|
||||
path = Vulkan/Vulkan-LoaderAndValidationLayers
|
||||
url = https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers
|
||||
[submodule "Utilities/yaml-cpp"]
|
||||
path = Utilities/yaml-cpp
|
||||
url = https://github.com/RPCS3/yaml-cpp
|
||||
[submodule "3rdparty/pugixml"]
|
||||
path = 3rdparty/pugixml
|
||||
url = https://github.com/RPCS3/pugixml
|
||||
[submodule "3rdparty/cereal"]
|
||||
path = 3rdparty/cereal
|
||||
url = https://github.com/USCiLab/cereal.git
|
||||
[submodule "rsx-debugger"]
|
||||
path = rsx-debugger
|
||||
url = https://github.com/RPCS3/rsx-debugger.git
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"userBlacklist": ["AlexAltea", "tambry", "DHrpcs3"]
|
||||
}
|
||||
+61
-72
@@ -1,107 +1,96 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- linux
|
||||
#- osx
|
||||
|
||||
osx_image: xcode6.4
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/hombebrew_cache
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "jA29KvTCTR7q4BMzPPUBGazjJwrIWa7k4fo5ZSMlyxh2NbztZTKQYwodgDcXBoptCd1KJ9H3FXwBnNdMNVnTkvoPL9uWnN4K/3D1D20FCag1kmlBwnaVqVei5cRiZ9TOMuaxhjkdg8pcrQLTlXEEdMZf6A2OW0VgoBGDVSX9nYc="
|
||||
# Which Travis environment to run Coverity on
|
||||
- coverity_scan_run_condition='"$CC" = gcc -a "$TRAVIS_OS_NAME" != osx'
|
||||
# Test mode is for testing if it's working with Coverity. Change to true if testing, to avoid reaching the quota.
|
||||
- coverity_scan_script_test_mode=false
|
||||
|
||||
branches:
|
||||
except:
|
||||
- ppu_recompiler
|
||||
- secure: "Vf+FY48nip9JppMnq11105NealdErSWsoUhHo63/V3V+LKfA9guenxCp93/qoSIdSGC/sJwb0yIIMGvkTT/rxDJNh6Z+BWUTb2E0WEIIQbvTJNOSUzoq7dfF1LT61XjVjByFzcbC2xjtaBowmcAYEs1jGUUuEjYVCMmD5lY8hUg="
|
||||
# Which Travis environment to run Coverity on
|
||||
- coverity_scan_run_condition='"$TRAVIS_OS_NAME" = linux -a "$CC" = gcc'
|
||||
# Test mode is for testing if it's working with Coverity. Change to true if testing, to avoid reaching the quota.
|
||||
- coverity_scan_script_test_mode=false
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
before_install:
|
||||
# shutdown services on Travis, which may have a memory impact
|
||||
# show memory usage before and after shutdown of services
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
sudo service --status-all;
|
||||
sudo free -m -t;
|
||||
sudo /etc/init.d/mysql stop;
|
||||
sudo /etc/init.d/postgresql stop;
|
||||
sudo /etc/init.d/couchdb stop;
|
||||
sudo /etc/init.d/redis-server stop;
|
||||
sudo free -m -t;
|
||||
|
||||
echo "yes" | sudo apt-key adv --fetch-keys 'http://repos.codelite.org/CodeLite.asc';
|
||||
echo "yes" | sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0/ubuntu/ precise universe';
|
||||
echo "yes" | sudo add-apt-repository 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main';
|
||||
echo "yes" | sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main';
|
||||
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -;
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;
|
||||
sudo apt-get update;
|
||||
sudo apt-get install libwxgtk3.0-dev libopenal-dev freeglut3-dev libglew-dev libc6-dev llvm-3.6 llvm-3.6-dev libedit-dev;
|
||||
sudo apt-get install aria2 -qq;
|
||||
download_extract() { aria2c -x 16 $1 -o $2 && tar -xf $2; };
|
||||
fi;
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" = "g++" ]; then
|
||||
sudo apt-get install -qq g++-4.9;
|
||||
export CXX="g++-4.9" CC="gcc-4.9" CXXFLAGS="-Wno-format-security";
|
||||
export CXX="g++-5" CC="gcc-5" CXXFLAGS="-Wno-format-security";
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01';
|
||||
elif [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
sudo apt-get install -qq --allow-unauthenticated clang-3.6 libstdc++-4.8-dev;
|
||||
export CXX="clang++-3.6" CC="clang-3.6";
|
||||
fi;
|
||||
# Travis uses CMake 2.8.7. We require 2.8.8. Grab latest
|
||||
# Add coverall for C++ so coverall.io could be triggered. Even it should be --coverage and gcov.
|
||||
# Add coverall for C++ so coverall.io could be triggered. Even it should be --coverage and gcov.
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
sudo apt-get install lib32stdc++6 -qq &&
|
||||
aria2c -x 16 http://www.cmake.org/files/v3.0/cmake-3.0.0-Linux-i386.sh &&
|
||||
chmod a+x cmake-3.0.0-Linux-i386.sh &&
|
||||
sudo ./cmake-3.0.0-Linux-i386.sh --skip-license --prefix=/usr;
|
||||
sudo pip install cpp-coveralls;
|
||||
pip install --user cpp-coveralls requests[security];
|
||||
else
|
||||
brew update; brew update;
|
||||
brew install glew wxwidgets llvm36;
|
||||
brew install ccache glew wxwidgets llvm38;
|
||||
fi;
|
||||
|
||||
before_script:
|
||||
- git submodule update --init asmjit ffmpeg
|
||||
- mkdir build
|
||||
- cd build
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ..; else cmake .. -DLLVM_DIR=/usr/local/opt/llvm36/lib/llvm-3.6/share/llvm/cmake; fi
|
||||
- git submodule update --init rsx_program_decompiler asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng Utilities/yaml-cpp 3rdparty/cereal
|
||||
- mkdir build
|
||||
- cd build
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
cmake ..;
|
||||
else
|
||||
cmake .. -DLLVM_DIR=/usr/local/opt/llvm38/lib/llvm-3.8/share/llvm/cmake;
|
||||
fi;
|
||||
|
||||
script:
|
||||
# Add a command to show all the variables. May be useful for debugging Travis.
|
||||
# - echo "--Shell Export Lists START--" ; export -p; echo "--Shell Export Lists STOP--";
|
||||
# And to ensure the versions of toolchain
|
||||
- echo "--CXX version?"; "$CXX" --version; echo "--CXX version confirmed";
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make -j 4; fi
|
||||
# Add a command to show all the variables. May be useful for debugging Travis.
|
||||
#- echo "--Shell Export Lists START--" ; export -p; echo "--Shell Export Lists STOP--";
|
||||
# And to ensure the versions of toolchain
|
||||
- echo "--CXX version?"; "$CXX" --version; echo "--CXX version confirmed";
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make -j 3; fi
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
#- llvm-toolchain-trusty-3.8 temporarily disabled
|
||||
packages:
|
||||
- cmake
|
||||
- libopenal-dev
|
||||
- freeglut3-dev
|
||||
- libglew-dev
|
||||
- libc6-dev
|
||||
#- llvm-3.8
|
||||
#- llvm-3.8-dev
|
||||
- libedit-dev
|
||||
- g++-5
|
||||
- gcc-5
|
||||
#- clang-3.6
|
||||
- libstdc++-5-dev
|
||||
- lib32stdc++6
|
||||
- zlib1g-dev
|
||||
- libwxgtk3.0-dev
|
||||
coverity_scan:
|
||||
project:
|
||||
name: $TRAVIS_REPO_SLUG
|
||||
notification_email: raul.tambre@gmail.com
|
||||
build_command_prepend: ""
|
||||
build_command: "make -j 4"
|
||||
branch_pattern: master
|
||||
description: "PS3 emulator/debugger"
|
||||
notification_email: nekotekina@gmail.com
|
||||
build_command: "make -j 3"
|
||||
branch_pattern: coverity_scan
|
||||
|
||||
after_success:
|
||||
- coveralls --extension .c --extension .cpp --extension .h;
|
||||
|
||||
after_failure:
|
||||
# show memory usage again and show actions of the OOM killer
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
sudo free -m -t;
|
||||
sudo dmesg;
|
||||
fi;
|
||||
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "$TRAVIS_OS_NAME" = linux ]; then coveralls --extension .c --extension .cpp --extension .h; fi
|
||||
|
||||
+1
Submodule 3rdparty/GSL added at fc5fce4f4f
Vendored
+1295
File diff suppressed because it is too large
Load Diff
Vendored
+263
@@ -0,0 +1,263 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* File: audiodefs.h
|
||||
* Content: Basic constants and data types for audio work.
|
||||
*
|
||||
* Remarks: This header file defines all of the audio format constants and
|
||||
* structures required for XAudio2 and XACT work. Providing these
|
||||
* in a single location avoids certain dependency problems in the
|
||||
* legacy audio headers (mmreg.h, mmsystem.h, ksmedia.h).
|
||||
*
|
||||
* NOTE: Including the legacy headers after this one may cause a
|
||||
* compilation error, because they define some of the same types
|
||||
* defined here without preprocessor guards to avoid multiple
|
||||
* definitions. If a source file needs one of the old headers,
|
||||
* it must include it before including audiodefs.h.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __AUDIODEFS_INCLUDED__
|
||||
#define __AUDIODEFS_INCLUDED__
|
||||
|
||||
#include <windef.h> // For WORD, DWORD, etc.
|
||||
|
||||
#pragma pack(push, 1) // Pack structures to 1-byte boundaries
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* WAVEFORMATEX: Base structure for many audio formats. Format-specific
|
||||
* extensions can be defined for particular formats by using a non-zero
|
||||
* cbSize value and adding extra fields to the end of this structure.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _WAVEFORMATEX_
|
||||
|
||||
#define _WAVEFORMATEX_
|
||||
typedef struct tWAVEFORMATEX
|
||||
{
|
||||
WORD wFormatTag; // Integer identifier of the format
|
||||
WORD nChannels; // Number of audio channels
|
||||
DWORD nSamplesPerSec; // Audio sample rate
|
||||
DWORD nAvgBytesPerSec; // Bytes per second (possibly approximate)
|
||||
WORD nBlockAlign; // Size in bytes of a sample block (all channels)
|
||||
WORD wBitsPerSample; // Size in bits of a single per-channel sample
|
||||
WORD cbSize; // Bytes of extra data appended to this struct
|
||||
} WAVEFORMATEX;
|
||||
|
||||
#endif
|
||||
|
||||
// Defining pointer types outside of the #if block to make sure they are
|
||||
// defined even if mmreg.h or mmsystem.h is #included before this file
|
||||
|
||||
typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
|
||||
typedef const WAVEFORMATEX *PCWAVEFORMATEX, *LPCWAVEFORMATEX;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* WAVEFORMATEXTENSIBLE: Extended version of WAVEFORMATEX that should be
|
||||
* used as a basis for all new audio formats. The format tag is replaced
|
||||
* with a GUID, allowing new formats to be defined without registering a
|
||||
* format tag with Microsoft. There are also new fields that can be used
|
||||
* to specify the spatial positions for each channel and the bit packing
|
||||
* used for wide samples (e.g. 24-bit PCM samples in 32-bit containers).
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _WAVEFORMATEXTENSIBLE_
|
||||
|
||||
#define _WAVEFORMATEXTENSIBLE_
|
||||
typedef struct
|
||||
{
|
||||
WAVEFORMATEX Format; // Base WAVEFORMATEX data
|
||||
union
|
||||
{
|
||||
WORD wValidBitsPerSample; // Valid bits in each sample container
|
||||
WORD wSamplesPerBlock; // Samples per block of audio data; valid
|
||||
// if wBitsPerSample=0 (but rarely used).
|
||||
WORD wReserved; // Zero if neither case above applies.
|
||||
} Samples;
|
||||
DWORD dwChannelMask; // Positions of the audio channels
|
||||
GUID SubFormat; // Format identifier GUID
|
||||
} WAVEFORMATEXTENSIBLE;
|
||||
|
||||
#endif
|
||||
|
||||
typedef WAVEFORMATEXTENSIBLE *PWAVEFORMATEXTENSIBLE, *LPWAVEFORMATEXTENSIBLE;
|
||||
typedef const WAVEFORMATEXTENSIBLE *PCWAVEFORMATEXTENSIBLE, *LPCWAVEFORMATEXTENSIBLE;
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Define the most common wave format tags used in WAVEFORMATEX formats.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef WAVE_FORMAT_PCM // Pulse Code Modulation
|
||||
|
||||
// If WAVE_FORMAT_PCM is not defined, we need to define some legacy types
|
||||
// for compatibility with the Windows mmreg.h / mmsystem.h header files.
|
||||
|
||||
// Old general format structure (information common to all formats)
|
||||
typedef struct waveformat_tag
|
||||
{
|
||||
WORD wFormatTag;
|
||||
WORD nChannels;
|
||||
DWORD nSamplesPerSec;
|
||||
DWORD nAvgBytesPerSec;
|
||||
WORD nBlockAlign;
|
||||
} WAVEFORMAT, *PWAVEFORMAT, NEAR *NPWAVEFORMAT, FAR *LPWAVEFORMAT;
|
||||
|
||||
// Specific format structure for PCM data
|
||||
typedef struct pcmwaveformat_tag
|
||||
{
|
||||
WAVEFORMAT wf;
|
||||
WORD wBitsPerSample;
|
||||
} PCMWAVEFORMAT, *PPCMWAVEFORMAT, NEAR *NPPCMWAVEFORMAT, FAR *LPPCMWAVEFORMAT;
|
||||
|
||||
#define WAVE_FORMAT_PCM 0x0001
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_ADPCM // Microsoft Adaptive Differental PCM
|
||||
|
||||
// Replicate the Microsoft ADPCM type definitions from mmreg.h.
|
||||
|
||||
typedef struct adpcmcoef_tag
|
||||
{
|
||||
short iCoef1;
|
||||
short iCoef2;
|
||||
} ADPCMCOEFSET;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4200) // Disable zero-sized array warnings
|
||||
|
||||
typedef struct adpcmwaveformat_tag {
|
||||
WAVEFORMATEX wfx;
|
||||
WORD wSamplesPerBlock;
|
||||
WORD wNumCoef;
|
||||
ADPCMCOEFSET aCoef[]; // Always 7 coefficient pairs for MS ADPCM
|
||||
} ADPCMWAVEFORMAT;
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#define WAVE_FORMAT_ADPCM 0x0002
|
||||
|
||||
#endif
|
||||
|
||||
// Other frequently used format tags
|
||||
|
||||
#ifndef WAVE_FORMAT_UNKNOWN
|
||||
#define WAVE_FORMAT_UNKNOWN 0x0000 // Unknown or invalid format tag
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_IEEE_FLOAT
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_MPEGLAYER3
|
||||
#define WAVE_FORMAT_MPEGLAYER3 0x0055 // ISO/MPEG Layer3
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
|
||||
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 // Dolby Audio Codec 3 over S/PDIF
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMAUDIO2
|
||||
#define WAVE_FORMAT_WMAUDIO2 0x0161 // Windows Media Audio
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMAUDIO3
|
||||
#define WAVE_FORMAT_WMAUDIO3 0x0162 // Windows Media Audio Pro
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_WMASPDIF
|
||||
#define WAVE_FORMAT_WMASPDIF 0x0164 // Windows Media Audio over S/PDIF
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_EXTENSIBLE
|
||||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE // All WAVEFORMATEXTENSIBLE formats
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Define the most common wave format GUIDs used in WAVEFORMATEXTENSIBLE
|
||||
* formats. Note that including the Windows ksmedia.h header after this
|
||||
* one will cause build problems; this cannot be avoided, since ksmedia.h
|
||||
* defines these macros without preprocessor guards.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus // uuid() and __uuidof() are only available in C++
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_PCM
|
||||
struct __declspec(uuid("00000001-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_PCM_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_PCM __uuidof(KSDATAFORMAT_SUBTYPE_PCM_STRUCT)
|
||||
#endif
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_ADPCM
|
||||
struct __declspec(uuid("00000002-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_ADPCM __uuidof(KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT)
|
||||
#endif
|
||||
|
||||
#ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
|
||||
struct __declspec(uuid("00000003-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT;
|
||||
#define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT __uuidof(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Speaker positions used in the WAVEFORMATEXTENSIBLE dwChannelMask field.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SPEAKER_FRONT_LEFT
|
||||
#define SPEAKER_FRONT_LEFT 0x00000001
|
||||
#define SPEAKER_FRONT_RIGHT 0x00000002
|
||||
#define SPEAKER_FRONT_CENTER 0x00000004
|
||||
#define SPEAKER_LOW_FREQUENCY 0x00000008
|
||||
#define SPEAKER_BACK_LEFT 0x00000010
|
||||
#define SPEAKER_BACK_RIGHT 0x00000020
|
||||
#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
|
||||
#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
|
||||
#define SPEAKER_BACK_CENTER 0x00000100
|
||||
#define SPEAKER_SIDE_LEFT 0x00000200
|
||||
#define SPEAKER_SIDE_RIGHT 0x00000400
|
||||
#define SPEAKER_TOP_CENTER 0x00000800
|
||||
#define SPEAKER_TOP_FRONT_LEFT 0x00001000
|
||||
#define SPEAKER_TOP_FRONT_CENTER 0x00002000
|
||||
#define SPEAKER_TOP_FRONT_RIGHT 0x00004000
|
||||
#define SPEAKER_TOP_BACK_LEFT 0x00008000
|
||||
#define SPEAKER_TOP_BACK_CENTER 0x00010000
|
||||
#define SPEAKER_TOP_BACK_RIGHT 0x00020000
|
||||
#define SPEAKER_RESERVED 0x7FFC0000
|
||||
#define SPEAKER_ALL 0x80000000
|
||||
#define _SPEAKER_POSITIONS_
|
||||
#endif
|
||||
|
||||
#ifndef SPEAKER_STEREO
|
||||
#define SPEAKER_MONO (SPEAKER_FRONT_CENTER)
|
||||
#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
|
||||
#define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
|
||||
#define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
|
||||
#define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||
#define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||
#define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||
#endif
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif // #ifndef __AUDIODEFS_INCLUDED__
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// comdecl.h: Macros to facilitate COM interface and GUID declarations.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
#ifndef _COMDECL_H_
|
||||
#define _COMDECL_H_
|
||||
|
||||
#ifndef _XBOX
|
||||
#include <basetyps.h> // For standard COM interface macros
|
||||
#else
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4061)
|
||||
#include <xtl.h> // Required by xobjbase.h
|
||||
#include <xobjbase.h> // Special definitions for Xbox build
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to
|
||||
// be declared and defined in such a way that clients can obtain the GUIDs using
|
||||
// either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names.
|
||||
// If using the latter approach, the client can also choose whether to get the
|
||||
// GUID definitions by defining the INITGUID preprocessor constant or by linking
|
||||
// to a GUID library. This works in either C or C++.
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
||||
#define DEFINE_UUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) __CRT_UUID_DECL(name, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) class className; DEFINE_UUID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) struct interfaceName; DEFINE_UUID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
|
||||
|
||||
#elif __cplusplus
|
||||
|
||||
#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
|
||||
#ifdef INITGUID
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
|
||||
EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className)
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
|
||||
EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName)
|
||||
|
||||
#else // INITGUID
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
|
||||
EXTERN_C const GUID CLSID_##className
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
|
||||
EXTERN_C const GUID IID_##interfaceName
|
||||
|
||||
#endif // INITGUID
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // #ifndef _COMDECL_H_
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
/*==========================================================================;
|
||||
*
|
||||
*
|
||||
* File: dxsdkver.h
|
||||
* Content: DirectX SDK Version Include File
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _DXSDKVER_H_
|
||||
#define _DXSDKVER_H_
|
||||
|
||||
#define _DXSDK_PRODUCT_MAJOR 9
|
||||
#define _DXSDK_PRODUCT_MINOR 29
|
||||
#define _DXSDK_BUILD_MAJOR 1962
|
||||
#define _DXSDK_BUILD_MINOR 0
|
||||
|
||||
#endif // _DXSDKVER_H_
|
||||
|
||||
Vendored
+718
@@ -0,0 +1,718 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* File: xma2defs.h
|
||||
* Content: Constants, data types and functions for XMA2 compressed audio.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __XMA2DEFS_INCLUDED__
|
||||
#define __XMA2DEFS_INCLUDED__
|
||||
|
||||
#include <sal.h> // Markers for documenting API semantics
|
||||
#include <winerror.h> // For S_OK, E_FAIL
|
||||
#include <audiodefs.h> // Basic data types and constants for audio work
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Overview
|
||||
***************************************************************************/
|
||||
|
||||
// A typical XMA2 file contains these RIFF chunks:
|
||||
//
|
||||
// 'fmt' or 'XMA2' chunk (or both): A description of the XMA data's structure
|
||||
// and characteristics (length, channels, sample rate, loops, block size, etc).
|
||||
//
|
||||
// 'seek' chunk: A seek table to help navigate the XMA data.
|
||||
//
|
||||
// 'data' chunk: The encoded XMA2 data.
|
||||
//
|
||||
// The encoded XMA2 data is structured as a set of BLOCKS, which contain PACKETS,
|
||||
// which contain FRAMES, which contain SUBFRAMES (roughly speaking). The frames
|
||||
// in a file may also be divided into several subsets, called STREAMS.
|
||||
//
|
||||
// FRAME: A variable-sized segment of XMA data that decodes to exactly 512 mono
|
||||
// or stereo PCM samples. This is the smallest unit of XMA data that can
|
||||
// be decoded in isolation. Frames are an arbitrary number of bits in
|
||||
// length, and need not be byte-aligned. See "XMA frame structure" below.
|
||||
//
|
||||
// SUBFRAME: A region of bits in an XMA frame that decodes to 128 mono or stereo
|
||||
// samples. The XMA decoder cannot decode a subframe in isolation; it needs
|
||||
// a whole frame to work with. However, it can begin emitting the frame's
|
||||
// decoded samples at any one of the four subframe boundaries. Subframes
|
||||
// can be addressed for seeking and looping purposes.
|
||||
//
|
||||
// PACKET: A 2Kb region containing a 32-bit header and some XMA frames. Frames
|
||||
// can (and usually do) span packets. A packet's header includes the offset
|
||||
// in bits of the first frame that begins within that packet. All of the
|
||||
// frames that begin in a given packet belong to the same "stream" (see the
|
||||
// Multichannel Audio section below).
|
||||
//
|
||||
// STREAM: A set of packets within an XMA file that all contain data for the
|
||||
// same mono or stereo component of a PCM file with more than two channels.
|
||||
// The packets comprising a given stream may be interleaved with each other
|
||||
// more or less arbitrarily; see Multichannel Audio.
|
||||
//
|
||||
// BLOCK: An array of XMA packets; or, to break it down differently, a series of
|
||||
// consecutive XMA frames, padded at the end with reserved data. A block
|
||||
// must contain at least one 2Kb packet per stream, and it can hold up to
|
||||
// 4095 packets (8190Kb), but its size is typically in the 32Kb-128Kb range.
|
||||
// (The size chosen involves a trade-off between memory use and efficiency
|
||||
// of reading from permanent storage.)
|
||||
//
|
||||
// XMA frames do not span blocks, so a block is guaranteed to begin with a
|
||||
// set of complete frames, one per stream. Also, a block in a multi-stream
|
||||
// XMA2 file always contains the same number of samples for each stream;
|
||||
// see Multichannel Audio.
|
||||
//
|
||||
// The 'data' chunk in an XMA2 file is an array of XMA2WAVEFORMAT.BlockCount XMA
|
||||
// blocks, all the same size (as specified in XMA2WAVEFORMAT.BlockSizeInBytes)
|
||||
// except for the last one, which may be shorter.
|
||||
|
||||
|
||||
// MULTICHANNEL AUDIO: the XMA decoder can only decode raw XMA data into either
|
||||
// mono or stereo PCM data. In order to encode a 6-channel file (say), the file
|
||||
// must be deinterleaved into 3 stereo streams that are encoded independently,
|
||||
// producing 3 encoded XMA data streams. Then the packets in these 3 streams
|
||||
// are interleaved to produce a single XMA2 file, and some information is added
|
||||
// to the file so that the original 6-channel audio can be reconstructed at
|
||||
// decode time. This works using the concept of an XMA stream (see above).
|
||||
//
|
||||
// The frames for all the streams in an XMA file are interleaved in an arbitrary
|
||||
// order. To locate a frame that belongs to a given stream in a given XMA block,
|
||||
// you must examine the first few packets in the block. Here (and only here) the
|
||||
// packets are guaranteed to be presented in stream order, so that all frames
|
||||
// beginning in packet 0 belong to stream 0 (the first stereo pair), etc.
|
||||
//
|
||||
// (This means that when decoding multi-stream XMA files, only entire XMA blocks
|
||||
// should be submitted to the decoder; otherwise it cannot know which frames
|
||||
// belong to which stream.)
|
||||
//
|
||||
// Once you have one frame that belongs to a given stream, you can find the next
|
||||
// one by looking at the frame's 'NextFrameOffsetBits' value (which is stored in
|
||||
// its first 15 bits; see XMAFRAME below). The GetXmaFrameBitPosition function
|
||||
// uses this technique.
|
||||
|
||||
|
||||
// SEEKING IN XMA2 FILES: Here is some pseudocode to find the byte position and
|
||||
// subframe in an XMA2 file which will contain sample S when decoded.
|
||||
//
|
||||
// 1. Traverse the seek table to find the XMA2 block containing sample S. The
|
||||
// seek table is an array of big-endian DWORDs, one per block in the file.
|
||||
// The Nth DWORD is the total number of PCM samples that would be obtained
|
||||
// by decoding the entire XMA file up to the end of block N. Hence, the
|
||||
// block we want is the first one whose seek table entry is greater than S.
|
||||
// (See the GetXmaBlockContainingSample helper function.)
|
||||
//
|
||||
// 2. Calculate which frame F within the block found above contains sample S.
|
||||
// Since each frame decodes to 512 samples, this is straightforward. The
|
||||
// first frame in the block produces samples X to X + 512, where X is the
|
||||
// seek table entry for the prior block. So F is (S - X) / 512.
|
||||
//
|
||||
// 3. Find the bit offset within the block where frame F starts. Since frames
|
||||
// are variable-sized, this can only be done by traversing all the frames in
|
||||
// the block until we reach frame F. (See GetXmaFrameBitPosition.)
|
||||
//
|
||||
// 4. Frame F has four 128-sample subframes. To find the subframe containing S,
|
||||
// we can use the formula (S % 512) / 128.
|
||||
//
|
||||
// In the case of multi-stream XMA files, sample S is a multichannel sample with
|
||||
// parts coming from several frames, one per stream. To find all these frames,
|
||||
// steps 2-4 need to be repeated for each stream N, using the knowledge that the
|
||||
// first packets in a block are presented in stream order. The frame traversal
|
||||
// in step 3 must be started at the first frame in the Nth packet of the block,
|
||||
// which will be the first frame for stream N. (And the packet header will tell
|
||||
// you the first frame's start position within the packet.)
|
||||
//
|
||||
// Step 1 can be performed using the GetXmaBlockContainingSample function below,
|
||||
// and steps 2-4 by calling GetXmaDecodePositionForSample once for each stream.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* XMA constants
|
||||
***************************************************************************/
|
||||
|
||||
// Size of the PCM samples produced by the XMA decoder
|
||||
#define XMA_OUTPUT_SAMPLE_BYTES 2u
|
||||
#define XMA_OUTPUT_SAMPLE_BITS (XMA_OUTPUT_SAMPLE_BYTES * 8u)
|
||||
|
||||
// Size of an XMA packet
|
||||
#define XMA_BYTES_PER_PACKET 2048u
|
||||
#define XMA_BITS_PER_PACKET (XMA_BYTES_PER_PACKET * 8u)
|
||||
|
||||
// Size of an XMA packet header
|
||||
#define XMA_PACKET_HEADER_BYTES 4u
|
||||
#define XMA_PACKET_HEADER_BITS (XMA_PACKET_HEADER_BYTES * 8u)
|
||||
|
||||
// Sample blocks in a decoded XMA frame
|
||||
#define XMA_SAMPLES_PER_FRAME 512u
|
||||
|
||||
// Sample blocks in a decoded XMA subframe
|
||||
#define XMA_SAMPLES_PER_SUBFRAME 128u
|
||||
|
||||
// Maximum encoded data that can be submitted to the XMA decoder at a time
|
||||
#define XMA_READBUFFER_MAX_PACKETS 4095u
|
||||
#define XMA_READBUFFER_MAX_BYTES (XMA_READBUFFER_MAX_PACKETS * XMA_BYTES_PER_PACKET)
|
||||
|
||||
// Maximum size allowed for the XMA decoder's output buffers
|
||||
#define XMA_WRITEBUFFER_MAX_BYTES (31u * 256u)
|
||||
|
||||
// Required byte alignment of the XMA decoder's output buffers
|
||||
#define XMA_WRITEBUFFER_BYTE_ALIGNMENT 256u
|
||||
|
||||
// Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field
|
||||
#define XMA_MIN_SUBFRAMES_TO_DECODE 1u
|
||||
#define XMA_MAX_SUBFRAMES_TO_DECODE 8u
|
||||
#define XMA_OPTIMAL_SUBFRAMES_TO_DECODE 4u
|
||||
|
||||
// LoopCount<255 means finite repetitions; LoopCount=255 means infinite looping
|
||||
#define XMA_MAX_LOOPCOUNT 254u
|
||||
#define XMA_INFINITE_LOOP 255u
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* XMA format structures
|
||||
***************************************************************************/
|
||||
|
||||
// The currently recommended way to express format information for XMA2 files
|
||||
// is the XMA2WAVEFORMATEX structure. This structure is fully compliant with
|
||||
// the WAVEFORMATEX standard and contains all the information needed to parse
|
||||
// and manage XMA2 files in a compact way.
|
||||
|
||||
#define WAVE_FORMAT_XMA2 0x166
|
||||
|
||||
typedef struct XMA2WAVEFORMATEX
|
||||
{
|
||||
WAVEFORMATEX wfx;
|
||||
// Meaning of the WAVEFORMATEX fields here:
|
||||
// wFormatTag; // Audio format type; always WAVE_FORMAT_XMA2
|
||||
// nChannels; // Channel count of the decoded audio
|
||||
// nSamplesPerSec; // Sample rate of the decoded audio
|
||||
// nAvgBytesPerSec; // Used internally by the XMA encoder
|
||||
// nBlockAlign; // Decoded sample size; channels * wBitsPerSample / 8
|
||||
// wBitsPerSample; // Bits per decoded mono sample; always 16 for XMA
|
||||
// cbSize; // Size in bytes of the rest of this structure (34)
|
||||
|
||||
WORD NumStreams; // Number of audio streams (1 or 2 channels each)
|
||||
DWORD ChannelMask; // Spatial positions of the channels in this file,
|
||||
// stored as SPEAKER_xxx values (see audiodefs.h)
|
||||
DWORD SamplesEncoded; // Total number of PCM samples the file decodes to
|
||||
DWORD BytesPerBlock; // XMA block size (but the last one may be shorter)
|
||||
DWORD PlayBegin; // First valid sample in the decoded audio
|
||||
DWORD PlayLength; // Length of the valid part of the decoded audio
|
||||
DWORD LoopBegin; // Beginning of the loop region in decoded sample terms
|
||||
DWORD LoopLength; // Length of the loop region in decoded sample terms
|
||||
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
|
||||
BYTE EncoderVersion; // Version of XMA encoder that generated the file
|
||||
WORD BlockCount; // XMA blocks in file (and entries in its seek table)
|
||||
} XMA2WAVEFORMATEX, *PXMA2WAVEFORMATEX;
|
||||
|
||||
|
||||
// The legacy XMA format structures are described here for reference, but they
|
||||
// should not be used in new content. XMAWAVEFORMAT was the structure used in
|
||||
// XMA version 1 files. XMA2WAVEFORMAT was used in early XMA2 files; it is not
|
||||
// placed in the usual 'fmt' RIFF chunk but in its own 'XMA2' chunk.
|
||||
|
||||
#ifndef WAVE_FORMAT_XMA
|
||||
#define WAVE_FORMAT_XMA 0x0165
|
||||
|
||||
// Values used in the ChannelMask fields below. Similar to the SPEAKER_xxx
|
||||
// values defined in audiodefs.h, but modified to fit in a single byte.
|
||||
#ifndef XMA_SPEAKER_LEFT
|
||||
#define XMA_SPEAKER_LEFT 0x01
|
||||
#define XMA_SPEAKER_RIGHT 0x02
|
||||
#define XMA_SPEAKER_CENTER 0x04
|
||||
#define XMA_SPEAKER_LFE 0x08
|
||||
#define XMA_SPEAKER_LEFT_SURROUND 0x10
|
||||
#define XMA_SPEAKER_RIGHT_SURROUND 0x20
|
||||
#define XMA_SPEAKER_LEFT_BACK 0x40
|
||||
#define XMA_SPEAKER_RIGHT_BACK 0x80
|
||||
#endif
|
||||
|
||||
|
||||
// Used in XMAWAVEFORMAT for per-stream data
|
||||
typedef struct XMASTREAMFORMAT
|
||||
{
|
||||
DWORD PsuedoBytesPerSec; // Used by the XMA encoder (typo preserved for legacy reasons)
|
||||
DWORD SampleRate; // The stream's decoded sample rate (in XMA2 files,
|
||||
// this is the same for all streams in the file).
|
||||
DWORD LoopStart; // Bit offset of the frame containing the loop start
|
||||
// point, relative to the beginning of the stream.
|
||||
DWORD LoopEnd; // Bit offset of the frame containing the loop end.
|
||||
BYTE SubframeData; // Two 4-bit numbers specifying the exact location of
|
||||
// the loop points within the frames that contain them.
|
||||
// SubframeEnd: Subframe of the loop end frame where
|
||||
// the loop ends. Ranges from 0 to 3.
|
||||
// SubframeSkip: Subframes to skip in the start frame to
|
||||
// reach the loop. Ranges from 0 to 4.
|
||||
BYTE Channels; // Number of channels in the stream (1 or 2)
|
||||
WORD ChannelMask; // Spatial positions of the channels in the stream
|
||||
} XMASTREAMFORMAT;
|
||||
|
||||
// Legacy XMA1 format structure
|
||||
typedef struct XMAWAVEFORMAT
|
||||
{
|
||||
WORD FormatTag; // Audio format type (always WAVE_FORMAT_XMA)
|
||||
WORD BitsPerSample; // Bit depth (currently required to be 16)
|
||||
WORD EncodeOptions; // Options for XMA encoder/decoder
|
||||
WORD LargestSkip; // Largest skip used in interleaving streams
|
||||
WORD NumStreams; // Number of interleaved audio streams
|
||||
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
|
||||
BYTE Version; // XMA encoder version that generated the file.
|
||||
// Always 3 or higher for XMA2 files.
|
||||
XMASTREAMFORMAT XmaStreams[1]; // Per-stream format information; the actual
|
||||
// array length is in the NumStreams field.
|
||||
} XMAWAVEFORMAT;
|
||||
|
||||
|
||||
// Used in XMA2WAVEFORMAT for per-stream data
|
||||
typedef struct XMA2STREAMFORMAT
|
||||
{
|
||||
BYTE Channels; // Number of channels in the stream (1 or 2)
|
||||
BYTE RESERVED; // Reserved for future use
|
||||
WORD ChannelMask; // Spatial positions of the channels in the stream
|
||||
} XMA2STREAMFORMAT;
|
||||
|
||||
// Legacy XMA2 format structure (big-endian byte ordering)
|
||||
typedef struct XMA2WAVEFORMAT
|
||||
{
|
||||
BYTE Version; // XMA encoder version that generated the file.
|
||||
// Always 3 or higher for XMA2 files.
|
||||
BYTE NumStreams; // Number of interleaved audio streams
|
||||
BYTE RESERVED; // Reserved for future use
|
||||
BYTE LoopCount; // Number of loop repetitions; 255 = infinite
|
||||
DWORD LoopBegin; // Loop begin point, in samples
|
||||
DWORD LoopEnd; // Loop end point, in samples
|
||||
DWORD SampleRate; // The file's decoded sample rate
|
||||
DWORD EncodeOptions; // Options for the XMA encoder/decoder
|
||||
DWORD PsuedoBytesPerSec; // Used internally by the XMA encoder
|
||||
DWORD BlockSizeInBytes; // Size in bytes of this file's XMA blocks (except
|
||||
// possibly the last one). Always a multiple of
|
||||
// 2Kb, since XMA blocks are arrays of 2Kb packets.
|
||||
DWORD SamplesEncoded; // Total number of PCM samples encoded in this file
|
||||
DWORD SamplesInSource; // Actual number of PCM samples in the source
|
||||
// material used to generate this file
|
||||
DWORD BlockCount; // Number of XMA blocks in this file (and hence
|
||||
// also the number of entries in its seek table)
|
||||
XMA2STREAMFORMAT Streams[1]; // Per-stream format information; the actual
|
||||
// array length is in the NumStreams field.
|
||||
} XMA2WAVEFORMAT;
|
||||
|
||||
#endif // #ifndef WAVE_FORMAT_XMA
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* XMA packet structure (in big-endian form)
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct XMA2PACKET
|
||||
{
|
||||
int FrameCount : 6; // Number of XMA frames that begin in this packet
|
||||
int FrameOffsetInBits : 15; // Bit of XmaData where the first complete frame begins
|
||||
int PacketMetaData : 3; // Metadata stored in the packet (always 1 for XMA2)
|
||||
int PacketSkipCount : 8; // How many packets belonging to other streams must be
|
||||
// skipped to find the next packet belonging to this one
|
||||
BYTE XmaData[XMA_BYTES_PER_PACKET - sizeof(DWORD)]; // XMA encoded data
|
||||
} XMA2PACKET;
|
||||
|
||||
// E.g. if the first DWORD of a packet is 0x30107902:
|
||||
//
|
||||
// 001100 000001000001111 001 00000010
|
||||
// | | | |____ Skip 2 packets to find the next one for this stream
|
||||
// | | |___________ XMA2 signature (always 001)
|
||||
// | |_____________________ First frame starts 527 bits into packet
|
||||
// |________________________________ Packet contains 12 frames
|
||||
|
||||
|
||||
// Helper functions to extract the fields above from an XMA packet. (Note that
|
||||
// the bitfields cannot be read directly on little-endian architectures such as
|
||||
// the Intel x86, as they are laid out in big-endian form.)
|
||||
|
||||
__inline DWORD GetXmaPacketFrameCount(__in_bcount(1) const BYTE* pPacket)
|
||||
{
|
||||
return (DWORD)(pPacket[0] >> 2);
|
||||
}
|
||||
|
||||
__inline DWORD GetXmaPacketFirstFrameOffsetInBits(__in_bcount(3) const BYTE* pPacket)
|
||||
{
|
||||
return ((DWORD)(pPacket[0] & 0x3) << 13) |
|
||||
((DWORD)(pPacket[1]) << 5) |
|
||||
((DWORD)(pPacket[2]) >> 3);
|
||||
}
|
||||
|
||||
__inline DWORD GetXmaPacketMetadata(__in_bcount(3) const BYTE* pPacket)
|
||||
{
|
||||
return (DWORD)(pPacket[2] & 0x7);
|
||||
}
|
||||
|
||||
__inline DWORD GetXmaPacketSkipCount(__in_bcount(4) const BYTE* pPacket)
|
||||
{
|
||||
return (DWORD)(pPacket[3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* XMA frame structure
|
||||
***************************************************************************/
|
||||
|
||||
// There is no way to represent the XMA frame as a C struct, since it is a
|
||||
// variable-sized string of bits that need not be stored at a byte-aligned
|
||||
// position in memory. This is the layout:
|
||||
//
|
||||
// XMAFRAME
|
||||
// {
|
||||
// LengthInBits: A 15-bit number representing the length of this frame.
|
||||
// XmaData: Encoded XMA data; its size in bits is (LengthInBits - 15).
|
||||
// }
|
||||
|
||||
// Size in bits of the frame's initial LengthInBits field
|
||||
#define XMA_BITS_IN_FRAME_LENGTH_FIELD 15
|
||||
|
||||
// Special LengthInBits value that marks an invalid final frame
|
||||
#define XMA_FINAL_FRAME_MARKER 0x7FFF
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* XMA helper functions
|
||||
***************************************************************************/
|
||||
|
||||
// We define a local ASSERT macro to equal the global one if it exists.
|
||||
// You can define XMA2DEFS_ASSERT in advance to override this default.
|
||||
#ifndef XMA2DEFS_ASSERT
|
||||
#ifdef ASSERT
|
||||
#define XMA2DEFS_ASSERT ASSERT
|
||||
#else
|
||||
#define XMA2DEFS_ASSERT(a) /* No-op by default */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// GetXmaBlockContainingSample: Use a given seek table to find the XMA block
|
||||
// containing a given decoded sample. Note that the seek table entries in an
|
||||
// XMA file are stored in big-endian form and may need to be converted prior
|
||||
// to calling this function.
|
||||
|
||||
__inline HRESULT GetXmaBlockContainingSample
|
||||
(
|
||||
DWORD nBlockCount, // Blocks in the file (= seek table entries)
|
||||
__in_ecount(nBlockCount) const DWORD* pSeekTable, // Pointer to the seek table data
|
||||
DWORD nDesiredSample, // Decoded sample to locate
|
||||
__out DWORD* pnBlockContainingSample, // Index of the block containing the sample
|
||||
__out DWORD* pnSampleOffsetWithinBlock // Position of the sample in this block
|
||||
)
|
||||
{
|
||||
DWORD nPreviousTotalSamples = 0;
|
||||
DWORD nBlock;
|
||||
DWORD nTotalSamplesSoFar;
|
||||
|
||||
XMA2DEFS_ASSERT(pSeekTable);
|
||||
XMA2DEFS_ASSERT(pnBlockContainingSample);
|
||||
XMA2DEFS_ASSERT(pnSampleOffsetWithinBlock);
|
||||
|
||||
for (nBlock = 0; nBlock < nBlockCount; ++nBlock)
|
||||
{
|
||||
nTotalSamplesSoFar = pSeekTable[nBlock];
|
||||
if (nTotalSamplesSoFar > nDesiredSample)
|
||||
{
|
||||
*pnBlockContainingSample = nBlock;
|
||||
*pnSampleOffsetWithinBlock = nDesiredSample - nPreviousTotalSamples;
|
||||
return S_OK;
|
||||
}
|
||||
nPreviousTotalSamples = nTotalSamplesSoFar;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
// GetXmaFrameLengthInBits: Reads a given frame's LengthInBits field.
|
||||
|
||||
__inline DWORD GetXmaFrameLengthInBits
|
||||
(
|
||||
__in_bcount(nBitPosition / 8 + 3)
|
||||
__in const BYTE* pPacket, // Pointer to XMA packet[s] containing the frame
|
||||
DWORD nBitPosition // Bit offset of the frame within this packet
|
||||
)
|
||||
{
|
||||
DWORD nRegion;
|
||||
DWORD nBytePosition = nBitPosition / 8;
|
||||
DWORD nBitOffset = nBitPosition % 8;
|
||||
|
||||
if (nBitOffset < 2) // Only need to read 2 bytes (and might not be safe to read more)
|
||||
{
|
||||
nRegion = (DWORD)(pPacket[nBytePosition+0]) << 8 |
|
||||
(DWORD)(pPacket[nBytePosition+1]);
|
||||
return (nRegion >> (1 - nBitOffset)) & 0x7FFF; // Last 15 bits
|
||||
}
|
||||
else // Need to read 3 bytes
|
||||
{
|
||||
nRegion = (DWORD)(pPacket[nBytePosition+0]) << 16 |
|
||||
(DWORD)(pPacket[nBytePosition+1]) << 8 |
|
||||
(DWORD)(pPacket[nBytePosition+2]);
|
||||
return (nRegion >> (9 - nBitOffset)) & 0x7FFF; // Last 15 bits
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetXmaFrameBitPosition: Calculates the bit offset of a given frame within
|
||||
// an XMA block or set of blocks. Returns 0 on failure.
|
||||
|
||||
__inline DWORD GetXmaFrameBitPosition
|
||||
(
|
||||
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
|
||||
DWORD nXmaDataBytes, // Size of pXmaData in bytes
|
||||
DWORD nStreamIndex, // Stream within which to seek
|
||||
DWORD nDesiredFrame // Frame sought
|
||||
)
|
||||
{
|
||||
const BYTE* pCurrentPacket;
|
||||
DWORD nPacketsExamined = 0;
|
||||
DWORD nFrameCountSoFar = 0;
|
||||
DWORD nFramesToSkip;
|
||||
DWORD nFrameBitOffset;
|
||||
|
||||
XMA2DEFS_ASSERT(pXmaData);
|
||||
XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0);
|
||||
|
||||
// Get the first XMA packet belonging to the desired stream, relying on the
|
||||
// fact that the first packets for each stream are in consecutive order at
|
||||
// the beginning of an XMA block.
|
||||
|
||||
pCurrentPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET;
|
||||
for (;;)
|
||||
{
|
||||
// If we have exceeded the size of the XMA data, return failure
|
||||
if (pCurrentPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If the current packet contains the frame we are looking for...
|
||||
if (nFrameCountSoFar + GetXmaPacketFrameCount(pCurrentPacket) > nDesiredFrame)
|
||||
{
|
||||
// See how many frames in this packet we need to skip to get to it
|
||||
XMA2DEFS_ASSERT(nDesiredFrame >= nFrameCountSoFar);
|
||||
nFramesToSkip = nDesiredFrame - nFrameCountSoFar;
|
||||
|
||||
// Get the bit offset of the first frame in this packet
|
||||
nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pCurrentPacket);
|
||||
|
||||
// Advance nFrameBitOffset to the frame of interest
|
||||
while (nFramesToSkip--)
|
||||
{
|
||||
nFrameBitOffset += GetXmaFrameLengthInBits(pCurrentPacket, nFrameBitOffset);
|
||||
}
|
||||
|
||||
// The bit offset to return is the number of bits from pXmaData to
|
||||
// pCurrentPacket plus the bit offset of the frame of interest
|
||||
return (DWORD)(pCurrentPacket - pXmaData) * 8 + nFrameBitOffset;
|
||||
}
|
||||
|
||||
// If we haven't found the right packet yet, advance our counters
|
||||
++nPacketsExamined;
|
||||
nFrameCountSoFar += GetXmaPacketFrameCount(pCurrentPacket);
|
||||
|
||||
// And skip to the next packet belonging to the same stream
|
||||
pCurrentPacket += XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pCurrentPacket) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetLastXmaFrameBitPosition: Calculates the bit offset of the last complete
|
||||
// frame in an XMA block or set of blocks.
|
||||
|
||||
__inline DWORD GetLastXmaFrameBitPosition
|
||||
(
|
||||
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
|
||||
DWORD nXmaDataBytes, // Size of pXmaData in bytes
|
||||
DWORD nStreamIndex // Stream within which to seek
|
||||
)
|
||||
{
|
||||
const BYTE* pLastPacket;
|
||||
DWORD nBytesToNextPacket;
|
||||
DWORD nFrameBitOffset;
|
||||
DWORD nFramesInLastPacket;
|
||||
|
||||
XMA2DEFS_ASSERT(pXmaData);
|
||||
XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0);
|
||||
XMA2DEFS_ASSERT(nXmaDataBytes >= XMA_BYTES_PER_PACKET * (nStreamIndex + 1));
|
||||
|
||||
// Get the first XMA packet belonging to the desired stream, relying on the
|
||||
// fact that the first packets for each stream are in consecutive order at
|
||||
// the beginning of an XMA block.
|
||||
pLastPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET;
|
||||
|
||||
// Search for the last packet belonging to the desired stream
|
||||
for (;;)
|
||||
{
|
||||
nBytesToNextPacket = XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pLastPacket) + 1);
|
||||
XMA2DEFS_ASSERT(nBytesToNextPacket);
|
||||
if (pLastPacket + nBytesToNextPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes)
|
||||
{
|
||||
break; // The next packet would extend beyond the end of pXmaData
|
||||
}
|
||||
pLastPacket += nBytesToNextPacket;
|
||||
}
|
||||
|
||||
// The last packet can sometimes have no seekable frames, in which case we
|
||||
// have to use the previous one
|
||||
if (GetXmaPacketFrameCount(pLastPacket) == 0)
|
||||
{
|
||||
pLastPacket -= nBytesToNextPacket;
|
||||
}
|
||||
|
||||
// Found the last packet. Get the bit offset of its first frame.
|
||||
nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pLastPacket);
|
||||
|
||||
// Traverse frames until we reach the last one
|
||||
nFramesInLastPacket = GetXmaPacketFrameCount(pLastPacket);
|
||||
while (--nFramesInLastPacket)
|
||||
{
|
||||
nFrameBitOffset += GetXmaFrameLengthInBits(pLastPacket, nFrameBitOffset);
|
||||
}
|
||||
|
||||
// The bit offset to return is the number of bits from pXmaData to
|
||||
// pLastPacket plus the offset of the last frame in this packet.
|
||||
return (DWORD)(pLastPacket - pXmaData) * 8 + nFrameBitOffset;
|
||||
}
|
||||
|
||||
|
||||
// GetXmaDecodePositionForSample: Obtains the information needed to make the
|
||||
// decoder generate audio starting at a given sample position relative to the
|
||||
// beginning of the given XMA block: the bit offset of the appropriate frame,
|
||||
// and the right subframe within that frame. This data can be passed directly
|
||||
// to the XMAPlaybackSetDecodePosition function.
|
||||
|
||||
__inline HRESULT GetXmaDecodePositionForSample
|
||||
(
|
||||
__in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s]
|
||||
DWORD nXmaDataBytes, // Size of pXmaData in bytes
|
||||
DWORD nStreamIndex, // Stream within which to seek
|
||||
DWORD nDesiredSample, // Sample sought
|
||||
__out DWORD* pnBitOffset, // Returns the bit offset within pXmaData of
|
||||
// the frame containing the sample sought
|
||||
__out DWORD* pnSubFrame // Returns the subframe containing the sample
|
||||
)
|
||||
{
|
||||
DWORD nDesiredFrame = nDesiredSample / XMA_SAMPLES_PER_FRAME;
|
||||
DWORD nSubFrame = (nDesiredSample % XMA_SAMPLES_PER_FRAME) / XMA_SAMPLES_PER_SUBFRAME;
|
||||
DWORD nBitOffset = GetXmaFrameBitPosition(pXmaData, nXmaDataBytes, nStreamIndex, nDesiredFrame);
|
||||
|
||||
XMA2DEFS_ASSERT(pnBitOffset);
|
||||
XMA2DEFS_ASSERT(pnSubFrame);
|
||||
|
||||
if (nBitOffset)
|
||||
{
|
||||
*pnBitOffset = nBitOffset;
|
||||
*pnSubFrame = nSubFrame;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetXmaSampleRate: Obtains the legal XMA sample rate (24, 32, 44.1 or 48Khz)
|
||||
// corresponding to a generic sample rate.
|
||||
|
||||
__inline DWORD GetXmaSampleRate(DWORD dwGeneralRate)
|
||||
{
|
||||
DWORD dwXmaRate = 48000; // Default XMA rate for all rates above 44100Hz
|
||||
|
||||
if (dwGeneralRate <= 24000) dwXmaRate = 24000;
|
||||
else if (dwGeneralRate <= 32000) dwXmaRate = 32000;
|
||||
else if (dwGeneralRate <= 44100) dwXmaRate = 44100;
|
||||
|
||||
return dwXmaRate;
|
||||
}
|
||||
|
||||
|
||||
// Functions to convert between WAVEFORMATEXTENSIBLE channel masks (combinations
|
||||
// of the SPEAKER_xxx flags defined in audiodefs.h) and XMA channel masks (which
|
||||
// are limited to eight possible speaker positions: left, right, center, low
|
||||
// frequency, side left, side right, back left and back right).
|
||||
|
||||
__inline DWORD GetStandardChannelMaskFromXmaMask(BYTE bXmaMask)
|
||||
{
|
||||
DWORD dwStandardMask = 0;
|
||||
|
||||
if (bXmaMask & XMA_SPEAKER_LEFT) dwStandardMask |= SPEAKER_FRONT_LEFT;
|
||||
if (bXmaMask & XMA_SPEAKER_RIGHT) dwStandardMask |= SPEAKER_FRONT_RIGHT;
|
||||
if (bXmaMask & XMA_SPEAKER_CENTER) dwStandardMask |= SPEAKER_FRONT_CENTER;
|
||||
if (bXmaMask & XMA_SPEAKER_LFE) dwStandardMask |= SPEAKER_LOW_FREQUENCY;
|
||||
if (bXmaMask & XMA_SPEAKER_LEFT_SURROUND) dwStandardMask |= SPEAKER_SIDE_LEFT;
|
||||
if (bXmaMask & XMA_SPEAKER_RIGHT_SURROUND) dwStandardMask |= SPEAKER_SIDE_RIGHT;
|
||||
if (bXmaMask & XMA_SPEAKER_LEFT_BACK) dwStandardMask |= SPEAKER_BACK_LEFT;
|
||||
if (bXmaMask & XMA_SPEAKER_RIGHT_BACK) dwStandardMask |= SPEAKER_BACK_RIGHT;
|
||||
|
||||
return dwStandardMask;
|
||||
}
|
||||
|
||||
__inline BYTE GetXmaChannelMaskFromStandardMask(DWORD dwStandardMask)
|
||||
{
|
||||
BYTE bXmaMask = 0;
|
||||
|
||||
if (dwStandardMask & SPEAKER_FRONT_LEFT) bXmaMask |= XMA_SPEAKER_LEFT;
|
||||
if (dwStandardMask & SPEAKER_FRONT_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT;
|
||||
if (dwStandardMask & SPEAKER_FRONT_CENTER) bXmaMask |= XMA_SPEAKER_CENTER;
|
||||
if (dwStandardMask & SPEAKER_LOW_FREQUENCY) bXmaMask |= XMA_SPEAKER_LFE;
|
||||
if (dwStandardMask & SPEAKER_SIDE_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_SURROUND;
|
||||
if (dwStandardMask & SPEAKER_SIDE_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_SURROUND;
|
||||
if (dwStandardMask & SPEAKER_BACK_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_BACK;
|
||||
if (dwStandardMask & SPEAKER_BACK_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_BACK;
|
||||
|
||||
return bXmaMask;
|
||||
}
|
||||
|
||||
|
||||
// LocalizeXma2Format: Modifies a XMA2WAVEFORMATEX structure in place to comply
|
||||
// with the current platform's byte-ordering rules (little- or big-endian).
|
||||
|
||||
__inline HRESULT LocalizeXma2Format(__inout XMA2WAVEFORMATEX* pXma2Format)
|
||||
{
|
||||
#define XMASWAP2BYTES(n) ((WORD)(((n) >> 8) | (((n) & 0xff) << 8)))
|
||||
#define XMASWAP4BYTES(n) ((DWORD)((n) >> 24 | (n) << 24 | ((n) & 0xff00) << 8 | ((n) & 0xff0000) >> 8))
|
||||
|
||||
if (pXma2Format->wfx.wFormatTag == WAVE_FORMAT_XMA2)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
else if (XMASWAP2BYTES(pXma2Format->wfx.wFormatTag) == WAVE_FORMAT_XMA2)
|
||||
{
|
||||
pXma2Format->wfx.wFormatTag = XMASWAP2BYTES(pXma2Format->wfx.wFormatTag);
|
||||
pXma2Format->wfx.nChannels = XMASWAP2BYTES(pXma2Format->wfx.nChannels);
|
||||
pXma2Format->wfx.nSamplesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nSamplesPerSec);
|
||||
pXma2Format->wfx.nAvgBytesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nAvgBytesPerSec);
|
||||
pXma2Format->wfx.nBlockAlign = XMASWAP2BYTES(pXma2Format->wfx.nBlockAlign);
|
||||
pXma2Format->wfx.wBitsPerSample = XMASWAP2BYTES(pXma2Format->wfx.wBitsPerSample);
|
||||
pXma2Format->wfx.cbSize = XMASWAP2BYTES(pXma2Format->wfx.cbSize);
|
||||
pXma2Format->NumStreams = XMASWAP2BYTES(pXma2Format->NumStreams);
|
||||
pXma2Format->ChannelMask = XMASWAP4BYTES(pXma2Format->ChannelMask);
|
||||
pXma2Format->SamplesEncoded = XMASWAP4BYTES(pXma2Format->SamplesEncoded);
|
||||
pXma2Format->BytesPerBlock = XMASWAP4BYTES(pXma2Format->BytesPerBlock);
|
||||
pXma2Format->PlayBegin = XMASWAP4BYTES(pXma2Format->PlayBegin);
|
||||
pXma2Format->PlayLength = XMASWAP4BYTES(pXma2Format->PlayLength);
|
||||
pXma2Format->LoopBegin = XMASWAP4BYTES(pXma2Format->LoopBegin);
|
||||
pXma2Format->LoopLength = XMASWAP4BYTES(pXma2Format->LoopLength);
|
||||
pXma2Format->BlockCount = XMASWAP2BYTES(pXma2Format->BlockCount);
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_FAIL; // Not a recognizable XMA2 format
|
||||
}
|
||||
|
||||
#undef XMASWAP2BYTES
|
||||
#undef XMASWAP4BYTES
|
||||
}
|
||||
|
||||
|
||||
#endif // #ifndef __XMA2DEFS_INCLUDED__
|
||||
+1
Submodule 3rdparty/cereal added at 42a45b6e15
Vendored
+1
Submodule 3rdparty/libpng added at ea77a6fd49
Vendored
+7183
File diff suppressed because it is too large
Load Diff
Vendored
+4890
File diff suppressed because it is too large
Load Diff
+924
@@ -0,0 +1,924 @@
|
||||
|
||||
/*=========================================================================*\
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
File: D2D1_1Helper.h
|
||||
|
||||
Module Name: D2D
|
||||
|
||||
Description: Helper files over the D2D interfaces and APIs.
|
||||
|
||||
\*=========================================================================*/
|
||||
#pragma once
|
||||
|
||||
#ifndef _D2D1_1HELPER_H_
|
||||
#define _D2D1_1HELPER_H_
|
||||
|
||||
#ifndef _D2D1_1_H_
|
||||
#include <d2d1_1.h>
|
||||
#endif // #ifndef _D2D1_H_
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
namespace D2D1
|
||||
{
|
||||
template<>
|
||||
struct TypeTraits<INT32>
|
||||
{
|
||||
typedef D2D1_POINT_2L Point;
|
||||
typedef D2D1_RECT_L Rect;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct TypeTraits<LONG>
|
||||
{
|
||||
typedef D2D1_POINT_2L Point;
|
||||
typedef D2D1_RECT_L Rect;
|
||||
};
|
||||
|
||||
class Matrix4x3F : public D2D1_MATRIX_4X3_F
|
||||
{
|
||||
public:
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x3F(
|
||||
FLOAT m11, FLOAT m12, FLOAT m13,
|
||||
FLOAT m21, FLOAT m22, FLOAT m23,
|
||||
FLOAT m31, FLOAT m32, FLOAT m33,
|
||||
FLOAT m41, FLOAT m42, FLOAT m43
|
||||
)
|
||||
{
|
||||
_11 = m11;
|
||||
_12 = m12;
|
||||
_13 = m13;
|
||||
|
||||
_21 = m21;
|
||||
_22 = m22;
|
||||
_23 = m23;
|
||||
|
||||
_31 = m31;
|
||||
_32 = m32;
|
||||
_33 = m33;
|
||||
|
||||
_41 = m41;
|
||||
_42 = m42;
|
||||
_43 = m43;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x3F()
|
||||
{
|
||||
_11 = 1;
|
||||
_12 = 0;
|
||||
_13 = 0;
|
||||
|
||||
_21 = 0;
|
||||
_22 = 1;
|
||||
_23 = 0;
|
||||
|
||||
_31 = 0;
|
||||
_32 = 0;
|
||||
_33 = 1;
|
||||
|
||||
_41 = 0;
|
||||
_42 = 0;
|
||||
_43 = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class Matrix4x4F : public D2D1_MATRIX_4X4_F
|
||||
{
|
||||
public:
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F(
|
||||
FLOAT m11, FLOAT m12, FLOAT m13, FLOAT m14,
|
||||
FLOAT m21, FLOAT m22, FLOAT m23, FLOAT m24,
|
||||
FLOAT m31, FLOAT m32, FLOAT m33, FLOAT m34,
|
||||
FLOAT m41, FLOAT m42, FLOAT m43, FLOAT m44
|
||||
)
|
||||
{
|
||||
_11 = m11;
|
||||
_12 = m12;
|
||||
_13 = m13;
|
||||
_14 = m14;
|
||||
|
||||
_21 = m21;
|
||||
_22 = m22;
|
||||
_23 = m23;
|
||||
_24 = m24;
|
||||
|
||||
_31 = m31;
|
||||
_32 = m32;
|
||||
_33 = m33;
|
||||
_34 = m34;
|
||||
|
||||
_41 = m41;
|
||||
_42 = m42;
|
||||
_43 = m43;
|
||||
_44 = m44;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F()
|
||||
{
|
||||
_11 = 1;
|
||||
_12 = 0;
|
||||
_13 = 0;
|
||||
_14 = 0;
|
||||
|
||||
_21 = 0;
|
||||
_22 = 1;
|
||||
_23 = 0;
|
||||
_24 = 0;
|
||||
|
||||
_31 = 0;
|
||||
_32 = 0;
|
||||
_33 = 1;
|
||||
_34 = 0;
|
||||
|
||||
_41 = 0;
|
||||
_42 = 0;
|
||||
_43 = 0;
|
||||
_44 = 1;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
bool
|
||||
operator==(
|
||||
const Matrix4x4F& r
|
||||
) const
|
||||
{
|
||||
return _11 == r._11 && _12 == r._12 && _13 == r._13 && _14 == r._14 &&
|
||||
_21 == r._21 && _22 == r._22 && _23 == r._23 && _24 == r._24 &&
|
||||
_31 == r._31 && _32 == r._32 && _33 == r._33 && _34 == r._34 &&
|
||||
_41 == r._41 && _42 == r._42 && _43 == r._43 && _44 == r._44;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
bool
|
||||
operator!=(
|
||||
const Matrix4x4F& r
|
||||
) const
|
||||
{
|
||||
return !(*this == r);
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
Translation(FLOAT x, FLOAT y, FLOAT z)
|
||||
{
|
||||
Matrix4x4F translation;
|
||||
|
||||
translation._11 = 1.0; translation._12 = 0.0; translation._13 = 0.0; translation._14 = 0.0;
|
||||
translation._21 = 0.0; translation._22 = 1.0; translation._23 = 0.0; translation._24 = 0.0;
|
||||
translation._31 = 0.0; translation._32 = 0.0; translation._33 = 1.0; translation._34 = 0.0;
|
||||
translation._41 = x; translation._42 = y; translation._43 = z; translation._44 = 1.0;
|
||||
|
||||
return translation;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
Scale(FLOAT x, FLOAT y, FLOAT z)
|
||||
{
|
||||
Matrix4x4F scale;
|
||||
|
||||
scale._11 = x; scale._12 = 0.0; scale._13 = 0.0; scale._14 = 0.0;
|
||||
scale._21 = 0.0; scale._22 = y; scale._23 = 0.0; scale._24 = 0.0;
|
||||
scale._31 = 0.0; scale._32 = 0.0; scale._33 = z; scale._34 = 0.0;
|
||||
scale._41 = 0.0; scale._42 = 0.0; scale._43 = 0.0; scale._44 = 1.0;
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
RotationX(FLOAT degreeX)
|
||||
{
|
||||
FLOAT angleInRadian = degreeX * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT sinAngle = 0.0;
|
||||
FLOAT cosAngle = 0.0;
|
||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
||||
|
||||
Matrix4x4F rotationX(
|
||||
1, 0, 0, 0,
|
||||
0, cosAngle, sinAngle, 0,
|
||||
0, -sinAngle, cosAngle, 0,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return rotationX;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
RotationY(FLOAT degreeY)
|
||||
{
|
||||
FLOAT angleInRadian = degreeY * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT sinAngle = 0.0;
|
||||
FLOAT cosAngle = 0.0;
|
||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
||||
|
||||
Matrix4x4F rotationY(
|
||||
cosAngle, 0, -sinAngle, 0,
|
||||
0, 1, 0, 0,
|
||||
sinAngle, 0, cosAngle, 0,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return rotationY;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
RotationZ(FLOAT degreeZ)
|
||||
{
|
||||
FLOAT angleInRadian = degreeZ * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT sinAngle = 0.0;
|
||||
FLOAT cosAngle = 0.0;
|
||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
||||
|
||||
Matrix4x4F rotationZ(
|
||||
cosAngle, sinAngle, 0, 0,
|
||||
-sinAngle, cosAngle, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return rotationZ;
|
||||
}
|
||||
|
||||
//
|
||||
// 3D Rotation matrix for an arbitrary axis specified by x, y and z
|
||||
//
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
RotationArbitraryAxis(FLOAT x, FLOAT y, FLOAT z, FLOAT degree)
|
||||
{
|
||||
// Normalize the vector represented by x, y, and z
|
||||
FLOAT magnitude = D2D1Vec3Length(x, y, z);
|
||||
x /= magnitude;
|
||||
y /= magnitude;
|
||||
z /= magnitude;
|
||||
|
||||
FLOAT angleInRadian = degree * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT sinAngle = 0.0;
|
||||
FLOAT cosAngle = 0.0;
|
||||
D2D1SinCos(angleInRadian, &sinAngle, &cosAngle);
|
||||
|
||||
FLOAT oneMinusCosAngle = 1 - cosAngle;
|
||||
|
||||
Matrix4x4F rotationArb(
|
||||
1 + oneMinusCosAngle * (x * x - 1),
|
||||
z * sinAngle + oneMinusCosAngle * x * y,
|
||||
-y * sinAngle + oneMinusCosAngle * x * z,
|
||||
0,
|
||||
|
||||
-z * sinAngle + oneMinusCosAngle * y * x,
|
||||
1 + oneMinusCosAngle * (y * y - 1),
|
||||
x * sinAngle + oneMinusCosAngle * y * z,
|
||||
0,
|
||||
|
||||
y * sinAngle + oneMinusCosAngle * z * x,
|
||||
-x * sinAngle + oneMinusCosAngle * z * y,
|
||||
1 + oneMinusCosAngle * (z * z - 1) ,
|
||||
0,
|
||||
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return rotationArb;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
SkewX(FLOAT degreeX)
|
||||
{
|
||||
FLOAT angleInRadian = degreeX * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT tanAngle = D2D1Tan(angleInRadian);
|
||||
|
||||
Matrix4x4F skewX(
|
||||
1, 0, 0, 0,
|
||||
tanAngle, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return skewX;
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
SkewY(FLOAT degreeY)
|
||||
{
|
||||
FLOAT angleInRadian = degreeY * (3.141592654f / 180.0f);
|
||||
|
||||
FLOAT tanAngle = D2D1Tan(angleInRadian);
|
||||
|
||||
Matrix4x4F skewY(
|
||||
1, tanAngle, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return skewY;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
PerspectiveProjection(FLOAT depth)
|
||||
{
|
||||
float proj = 0;
|
||||
|
||||
if (depth > 0)
|
||||
{
|
||||
proj = -1/depth;
|
||||
}
|
||||
|
||||
Matrix4x4F projection(
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, proj,
|
||||
0, 0, 0, 1
|
||||
);
|
||||
|
||||
return projection;
|
||||
}
|
||||
|
||||
//
|
||||
// Functions for convertion from the base D2D1_MATRIX_4X4_f to
|
||||
// this type without making a copy
|
||||
//
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
const Matrix4x4F*
|
||||
ReinterpretBaseType(const D2D1_MATRIX_4X4_F *pMatrix)
|
||||
{
|
||||
return static_cast<const Matrix4x4F *>(pMatrix);
|
||||
}
|
||||
|
||||
static
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F*
|
||||
ReinterpretBaseType(D2D1_MATRIX_4X4_F *pMatrix)
|
||||
{
|
||||
return static_cast<Matrix4x4F *>(pMatrix);
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
FLOAT
|
||||
Determinant() const
|
||||
{
|
||||
FLOAT minor1 = _41 * (_12 * (_23 * _34 - _33 * _24) - _13 * (_22 * _34 - _24 * _32) + _14 * (_22 * _33 - _23 * _32));
|
||||
FLOAT minor2 = _42 * (_11 * (_21 * _34 - _31 * _24) - _13 * (_21 * _34 - _24 * _31) + _14 * (_21 * _33 - _23 * _31));
|
||||
FLOAT minor3 = _43 * (_11 * (_22 * _34 - _32 * _24) - _12 * (_21 * _34 - _24 * _31) + _14 * (_21 * _32 - _22 * _31));
|
||||
FLOAT minor4 = _44 * (_11 * (_22 * _33 - _32 * _23) - _12 * (_21 * _33 - _23 * _31) + _13 * (_21 * _32 - _22 * _31));
|
||||
|
||||
return minor1 - minor2 + minor3 - minor4;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
bool
|
||||
IsIdentity() const
|
||||
{
|
||||
return _11 == 1.f && _12 == 0.f && _13 == 0.f && _14 == 0.f
|
||||
&& _21 == 0.f && _22 == 1.f && _23 == 0.f && _24 == 0.f
|
||||
&& _31 == 0.f && _32 == 0.f && _33 == 1.f && _34 == 0.f
|
||||
&& _41 == 0.f && _42 == 0.f && _43 == 0.f && _44 == 1.f;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
void
|
||||
SetProduct(const Matrix4x4F &a, const Matrix4x4F &b)
|
||||
{
|
||||
_11 = a._11 * b._11 + a._12 * b._21 + a._13 * b._31 + a._14 * b._41;
|
||||
_12 = a._11 * b._12 + a._12 * b._22 + a._13 * b._32 + a._14 * b._42;
|
||||
_13 = a._11 * b._13 + a._12 * b._23 + a._13 * b._33 + a._14 * b._43;
|
||||
_14 = a._11 * b._14 + a._12 * b._24 + a._13 * b._34 + a._14 * b._44;
|
||||
|
||||
_21 = a._21 * b._11 + a._22 * b._21 + a._23 * b._31 + a._24 * b._41;
|
||||
_22 = a._21 * b._12 + a._22 * b._22 + a._23 * b._32 + a._24 * b._42;
|
||||
_23 = a._21 * b._13 + a._22 * b._23 + a._23 * b._33 + a._24 * b._43;
|
||||
_24 = a._21 * b._14 + a._22 * b._24 + a._23 * b._34 + a._24 * b._44;
|
||||
|
||||
_31 = a._31 * b._11 + a._32 * b._21 + a._33 * b._31 + a._34 * b._41;
|
||||
_32 = a._31 * b._12 + a._32 * b._22 + a._33 * b._32 + a._34 * b._42;
|
||||
_33 = a._31 * b._13 + a._32 * b._23 + a._33 * b._33 + a._34 * b._43;
|
||||
_34 = a._31 * b._14 + a._32 * b._24 + a._33 * b._34 + a._34 * b._44;
|
||||
|
||||
_41 = a._41 * b._11 + a._42 * b._21 + a._43 * b._31 + a._44 * b._41;
|
||||
_42 = a._41 * b._12 + a._42 * b._22 + a._43 * b._32 + a._44 * b._42;
|
||||
_43 = a._41 * b._13 + a._42 * b._23 + a._43 * b._33 + a._44 * b._43;
|
||||
_44 = a._41 * b._14 + a._42 * b._24 + a._43 * b._34 + a._44 * b._44;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix4x4F
|
||||
operator*(const Matrix4x4F &matrix) const
|
||||
{
|
||||
Matrix4x4F result;
|
||||
|
||||
result.SetProduct(*this, matrix);
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Matrix5x4F : public D2D1_MATRIX_5X4_F
|
||||
{
|
||||
public:
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix5x4F(
|
||||
FLOAT m11, FLOAT m12, FLOAT m13, FLOAT m14,
|
||||
FLOAT m21, FLOAT m22, FLOAT m23, FLOAT m24,
|
||||
FLOAT m31, FLOAT m32, FLOAT m33, FLOAT m34,
|
||||
FLOAT m41, FLOAT m42, FLOAT m43, FLOAT m44,
|
||||
FLOAT m51, FLOAT m52, FLOAT m53, FLOAT m54
|
||||
)
|
||||
{
|
||||
_11 = m11;
|
||||
_12 = m12;
|
||||
_13 = m13;
|
||||
_14 = m14;
|
||||
|
||||
_21 = m21;
|
||||
_22 = m22;
|
||||
_23 = m23;
|
||||
_24 = m24;
|
||||
|
||||
_31 = m31;
|
||||
_32 = m32;
|
||||
_33 = m33;
|
||||
_34 = m34;
|
||||
|
||||
_41 = m41;
|
||||
_42 = m42;
|
||||
_43 = m43;
|
||||
_44 = m44;
|
||||
|
||||
_51 = m51;
|
||||
_52 = m52;
|
||||
_53 = m53;
|
||||
_54 = m54;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
Matrix5x4F()
|
||||
{
|
||||
_11 = 1;
|
||||
_12 = 0;
|
||||
_13 = 0;
|
||||
_14 = 0;
|
||||
|
||||
_21 = 0;
|
||||
_22 = 1;
|
||||
_23 = 0;
|
||||
_24 = 0;
|
||||
|
||||
_31 = 0;
|
||||
_32 = 0;
|
||||
_33 = 1;
|
||||
_34 = 0;
|
||||
|
||||
_41 = 0;
|
||||
_42 = 0;
|
||||
_43 = 0;
|
||||
_44 = 1;
|
||||
|
||||
_51 = 0;
|
||||
_52 = 0;
|
||||
_53 = 0;
|
||||
_54 = 0;
|
||||
}
|
||||
};
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
inline
|
||||
D2D1_COLOR_F
|
||||
ConvertColorSpace(
|
||||
D2D1_COLOR_SPACE sourceColorSpace,
|
||||
D2D1_COLOR_SPACE destinationColorSpace,
|
||||
const D2D1_COLOR_F& color
|
||||
)
|
||||
{
|
||||
return D2D1ConvertColorSpace(
|
||||
sourceColorSpace,
|
||||
destinationColorSpace,
|
||||
&color
|
||||
);
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_DRAWING_STATE_DESCRIPTION1
|
||||
DrawingStateDescription1(
|
||||
D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT,
|
||||
D2D1_TAG tag1 = 0,
|
||||
D2D1_TAG tag2 = 0,
|
||||
_In_ const D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix(),
|
||||
D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER,
|
||||
D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS
|
||||
)
|
||||
{
|
||||
D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1;
|
||||
|
||||
drawingStateDescription1.antialiasMode = antialiasMode;
|
||||
drawingStateDescription1.textAntialiasMode = textAntialiasMode;
|
||||
drawingStateDescription1.tag1 = tag1;
|
||||
drawingStateDescription1.tag2 = tag2;
|
||||
drawingStateDescription1.transform = transform;
|
||||
drawingStateDescription1.primitiveBlend = primitiveBlend;
|
||||
drawingStateDescription1.unitMode = unitMode;
|
||||
|
||||
return drawingStateDescription1;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_DRAWING_STATE_DESCRIPTION1
|
||||
DrawingStateDescription1(
|
||||
_In_ const D2D1_DRAWING_STATE_DESCRIPTION &desc,
|
||||
D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER,
|
||||
D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS
|
||||
)
|
||||
{
|
||||
D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1;
|
||||
|
||||
drawingStateDescription1.antialiasMode = desc.antialiasMode;
|
||||
drawingStateDescription1.textAntialiasMode = desc.textAntialiasMode;
|
||||
drawingStateDescription1.tag1 = desc.tag1;
|
||||
drawingStateDescription1.tag2 = desc.tag2;
|
||||
drawingStateDescription1.transform = desc.transform;
|
||||
drawingStateDescription1.primitiveBlend = primitiveBlend;
|
||||
drawingStateDescription1.unitMode = unitMode;
|
||||
|
||||
return drawingStateDescription1;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BITMAP_PROPERTIES1
|
||||
BitmapProperties1(
|
||||
D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS_NONE,
|
||||
_In_ CONST D2D1_PIXEL_FORMAT pixelFormat = D2D1::PixelFormat(),
|
||||
FLOAT dpiX = 96.0f,
|
||||
FLOAT dpiY = 96.0f,
|
||||
_In_opt_ ID2D1ColorContext *colorContext = NULL
|
||||
)
|
||||
{
|
||||
D2D1_BITMAP_PROPERTIES1 bitmapProperties =
|
||||
{
|
||||
pixelFormat,
|
||||
dpiX, dpiY,
|
||||
bitmapOptions,
|
||||
colorContext
|
||||
};
|
||||
|
||||
return bitmapProperties;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_LAYER_PARAMETERS1
|
||||
LayerParameters1(
|
||||
_In_ CONST D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(),
|
||||
_In_opt_ ID2D1Geometry *geometricMask = NULL,
|
||||
D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
|
||||
D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(),
|
||||
FLOAT opacity = 1.0,
|
||||
_In_opt_ ID2D1Brush *opacityBrush = NULL,
|
||||
D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE
|
||||
)
|
||||
{
|
||||
D2D1_LAYER_PARAMETERS1 layerParameters = { 0 };
|
||||
|
||||
layerParameters.contentBounds = contentBounds;
|
||||
layerParameters.geometricMask = geometricMask;
|
||||
layerParameters.maskAntialiasMode = maskAntialiasMode;
|
||||
layerParameters.maskTransform = maskTransform;
|
||||
layerParameters.opacity = opacity;
|
||||
layerParameters.opacityBrush = opacityBrush;
|
||||
layerParameters.layerOptions = layerOptions;
|
||||
|
||||
return layerParameters;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_STROKE_STYLE_PROPERTIES1
|
||||
StrokeStyleProperties1(
|
||||
D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT,
|
||||
D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER,
|
||||
FLOAT miterLimit = 10.0f,
|
||||
D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID,
|
||||
FLOAT dashOffset = 0.0f,
|
||||
D2D1_STROKE_TRANSFORM_TYPE transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL
|
||||
)
|
||||
{
|
||||
D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties;
|
||||
|
||||
strokeStyleProperties.startCap = startCap;
|
||||
strokeStyleProperties.endCap = endCap;
|
||||
strokeStyleProperties.dashCap = dashCap;
|
||||
strokeStyleProperties.lineJoin = lineJoin;
|
||||
strokeStyleProperties.miterLimit = miterLimit;
|
||||
strokeStyleProperties.dashStyle = dashStyle;
|
||||
strokeStyleProperties.dashOffset = dashOffset;
|
||||
strokeStyleProperties.transformType = transformType;
|
||||
|
||||
return strokeStyleProperties;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_IMAGE_BRUSH_PROPERTIES
|
||||
ImageBrushProperties(
|
||||
D2D1_RECT_F sourceRectangle,
|
||||
D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR
|
||||
)
|
||||
{
|
||||
D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties;
|
||||
|
||||
imageBrushProperties.extendModeX = extendModeX;
|
||||
imageBrushProperties.extendModeY = extendModeY;
|
||||
imageBrushProperties.interpolationMode = interpolationMode;
|
||||
imageBrushProperties.sourceRectangle = sourceRectangle;
|
||||
|
||||
return imageBrushProperties;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_BITMAP_BRUSH_PROPERTIES1
|
||||
BitmapBrushProperties1(
|
||||
D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP,
|
||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR
|
||||
)
|
||||
{
|
||||
D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrush1Properties;
|
||||
|
||||
bitmapBrush1Properties.extendModeX = extendModeX;
|
||||
bitmapBrush1Properties.extendModeY = extendModeY;
|
||||
bitmapBrush1Properties.interpolationMode = interpolationMode;
|
||||
|
||||
return bitmapBrush1Properties;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_PRINT_CONTROL_PROPERTIES
|
||||
PrintControlProperties(
|
||||
D2D1_PRINT_FONT_SUBSET_MODE fontSubsetMode = D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT,
|
||||
FLOAT rasterDpi = 150.0f,
|
||||
D2D1_COLOR_SPACE colorSpace = D2D1_COLOR_SPACE_SRGB
|
||||
)
|
||||
{
|
||||
D2D1_PRINT_CONTROL_PROPERTIES printControlProps;
|
||||
|
||||
printControlProps.fontSubset = fontSubsetMode;
|
||||
printControlProps.rasterDPI = rasterDpi;
|
||||
printControlProps.colorSpace = colorSpace;
|
||||
|
||||
return printControlProps;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RENDERING_CONTROLS
|
||||
RenderingControls(
|
||||
D2D1_BUFFER_PRECISION bufferPrecision,
|
||||
D2D1_SIZE_U tileSize
|
||||
)
|
||||
{
|
||||
D2D1_RENDERING_CONTROLS renderingControls;
|
||||
|
||||
renderingControls.bufferPrecision = bufferPrecision;
|
||||
renderingControls.tileSize = tileSize;
|
||||
|
||||
return renderingControls;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_EFFECT_INPUT_DESCRIPTION
|
||||
EffectInputDescription(
|
||||
ID2D1Effect *effect,
|
||||
UINT32 inputIndex,
|
||||
D2D1_RECT_F inputRectangle
|
||||
)
|
||||
{
|
||||
D2D1_EFFECT_INPUT_DESCRIPTION description;
|
||||
|
||||
description.effect = effect;
|
||||
description.inputIndex = inputIndex;
|
||||
description.inputRectangle = inputRectangle;
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_CREATION_PROPERTIES
|
||||
CreationProperties(
|
||||
D2D1_THREADING_MODE threadingMode,
|
||||
D2D1_DEBUG_LEVEL debugLevel,
|
||||
D2D1_DEVICE_CONTEXT_OPTIONS options
|
||||
)
|
||||
{
|
||||
D2D1_CREATION_PROPERTIES creationProperties;
|
||||
|
||||
creationProperties.threadingMode = threadingMode;
|
||||
creationProperties.debugLevel = debugLevel;
|
||||
creationProperties.options = options;
|
||||
|
||||
return creationProperties;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_VECTOR_2F
|
||||
Vector2F(
|
||||
FLOAT x = 0.0f,
|
||||
FLOAT y = 0.0f
|
||||
)
|
||||
{
|
||||
D2D1_VECTOR_2F vec2 = {x, y};
|
||||
return vec2;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_VECTOR_3F
|
||||
Vector3F(
|
||||
FLOAT x = 0.0f,
|
||||
FLOAT y = 0.0f,
|
||||
FLOAT z = 0.0f
|
||||
)
|
||||
{
|
||||
D2D1_VECTOR_3F vec3 = {x, y, z};
|
||||
return vec3;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_VECTOR_4F
|
||||
Vector4F(
|
||||
FLOAT x = 0.0f,
|
||||
FLOAT y = 0.0f,
|
||||
FLOAT z = 0.0f,
|
||||
FLOAT w = 0.0f
|
||||
)
|
||||
{
|
||||
D2D1_VECTOR_4F vec4 = {x, y, z, w};
|
||||
return vec4;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_POINT_2L
|
||||
Point2L(
|
||||
INT32 x = 0,
|
||||
INT32 y = 0
|
||||
)
|
||||
{
|
||||
return Point2<INT32>(x, y);
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_RECT_L
|
||||
RectL(
|
||||
INT32 left = 0.f,
|
||||
INT32 top = 0.f,
|
||||
INT32 right = 0.f,
|
||||
INT32 bottom = 0.f
|
||||
)
|
||||
{
|
||||
return Rect<INT32>(left, top, right, bottom);
|
||||
}
|
||||
|
||||
//
|
||||
// Sets a bitmap as an effect input, while inserting a DPI compensation effect
|
||||
// to preserve visual appearance as the device context's DPI changes.
|
||||
//
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
HRESULT
|
||||
SetDpiCompensatedEffectInput(
|
||||
_In_ ID2D1DeviceContext *deviceContext,
|
||||
_In_ ID2D1Effect *effect,
|
||||
UINT32 inputIndex,
|
||||
_In_opt_ ID2D1Bitmap *inputBitmap,
|
||||
D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR,
|
||||
D2D1_BORDER_MODE borderMode = D2D1_BORDER_MODE_HARD
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
ID2D1Effect *dpiCompensationEffect = NULL;
|
||||
|
||||
if (!inputBitmap)
|
||||
{
|
||||
effect->SetInput(inputIndex, NULL);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = deviceContext->CreateEffect(CLSID_D2D1DpiCompensation, &dpiCompensationEffect);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
dpiCompensationEffect->SetInput(0, inputBitmap);
|
||||
|
||||
D2D1_POINT_2F bitmapDpi;
|
||||
inputBitmap->GetDpi(&bitmapDpi.x, &bitmapDpi.y);
|
||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INPUT_DPI, bitmapDpi);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE, interpolationMode);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_BORDER_MODE, borderMode);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
effect->SetInputEffect(inputIndex, dpiCompensationEffect);
|
||||
}
|
||||
|
||||
if (dpiCompensationEffect)
|
||||
{
|
||||
dpiCompensationEffect->Release();
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
} // namespace D2D1
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#endif // #ifndef _D2D1_HELPER_H_
|
||||
|
||||
Vendored
+809
@@ -0,0 +1,809 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This file is automatically generated. Please do not edit it directly.
|
||||
//
|
||||
// File name: D2D1_2.h
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // #ifdef _MSC_VER
|
||||
|
||||
#ifndef _D2D1_2_H_
|
||||
#define _D2D1_2_H_
|
||||
|
||||
#ifndef _D2D1_1_H_
|
||||
#include <d2d1_1.h>
|
||||
#endif // #ifndef _D2D1_1_H_
|
||||
#ifndef _D2D1_EFFECTS_1_
|
||||
#include <d2d1effects_1.h>
|
||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
interface ID2D1Device1;
|
||||
#else
|
||||
|
||||
typedef interface ID2D1Device1 ID2D1Device1;
|
||||
|
||||
#endif
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_RENDERING_PRIORITY
|
||||
//
|
||||
// Synopsis:
|
||||
// Specifies the extent to which D2D will throttle work sent to the GPU.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_RENDERING_PRIORITY
|
||||
{
|
||||
D2D1_RENDERING_PRIORITY_NORMAL = 0,
|
||||
D2D1_RENDERING_PRIORITY_LOW = 1,
|
||||
D2D1_RENDERING_PRIORITY_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_RENDERING_PRIORITY;
|
||||
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Interface:
|
||||
// ID2D1GeometryRealization
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
interface DX_DECLARE_INTERFACE("a16907d7-bc02-4801-99e8-8cf7f485f774") ID2D1GeometryRealization : public ID2D1Resource
|
||||
{
|
||||
}; // interface ID2D1GeometryRealization
|
||||
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Interface:
|
||||
// ID2D1DeviceContext1
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
interface DX_DECLARE_INTERFACE("d37f57e4-6908-459f-a199-e72f24f79987") ID2D1DeviceContext1 : public ID2D1DeviceContext
|
||||
{
|
||||
|
||||
STDMETHOD(CreateFilledGeometryRealization)(
|
||||
_In_ ID2D1Geometry *geometry,
|
||||
FLOAT flatteningTolerance,
|
||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
||||
) PURE;
|
||||
|
||||
STDMETHOD(CreateStrokedGeometryRealization)(
|
||||
_In_ ID2D1Geometry *geometry,
|
||||
FLOAT flatteningTolerance,
|
||||
FLOAT strokeWidth,
|
||||
_In_opt_ ID2D1StrokeStyle *strokeStyle,
|
||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
||||
) PURE;
|
||||
|
||||
STDMETHOD_(void, DrawGeometryRealization)(
|
||||
_In_ ID2D1GeometryRealization *geometryRealization,
|
||||
_In_ ID2D1Brush *brush
|
||||
) PURE;
|
||||
}; // interface ID2D1DeviceContext1
|
||||
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Interface:
|
||||
// ID2D1Device1
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
interface DX_DECLARE_INTERFACE("d21768e1-23a4-4823-a14b-7c3eba85d658") ID2D1Device1 : public ID2D1Device
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// Retrieves the rendering priority currently set on the device.
|
||||
//
|
||||
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
|
||||
) PURE;
|
||||
|
||||
|
||||
//
|
||||
// Sets the rendering priority of the device.
|
||||
//
|
||||
STDMETHOD_(void, SetRenderingPriority)(
|
||||
D2D1_RENDERING_PRIORITY renderingPriority
|
||||
) PURE;
|
||||
|
||||
|
||||
//
|
||||
// Creates a new device context with no initially assigned target.
|
||||
//
|
||||
STDMETHOD(CreateDeviceContext)(
|
||||
D2D1_DEVICE_CONTEXT_OPTIONS options,
|
||||
_Outptr_ ID2D1DeviceContext1 **deviceContext1
|
||||
) PURE;
|
||||
|
||||
using ID2D1Device::CreateDeviceContext;
|
||||
}; // interface ID2D1Device1
|
||||
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Interface:
|
||||
// ID2D1Factory2
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
interface DX_DECLARE_INTERFACE("94f81a73-9212-4376-9c58-b16a3a0d3992") ID2D1Factory2 : public ID2D1Factory1
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// This creates a new Direct2D device from the given IDXGIDevice.
|
||||
//
|
||||
STDMETHOD(CreateDevice)(
|
||||
_In_ IDXGIDevice *dxgiDevice,
|
||||
_Outptr_ ID2D1Device1 **d2dDevice1
|
||||
) PURE;
|
||||
|
||||
using ID2D1Factory1::CreateDevice;
|
||||
}; // interface ID2D1Factory2
|
||||
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Interface:
|
||||
// ID2D1CommandSink1
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
interface DX_DECLARE_INTERFACE("9eb767fd-4269-4467-b8c2-eb30cb305743") ID2D1CommandSink1 : public ID2D1CommandSink
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// This method is called if primitiveBlend value was added after Windows 8.
|
||||
// SetPrimitiveBlend method is used for Win8 values (_SOURCE_OVER and _COPY).
|
||||
//
|
||||
STDMETHOD(SetPrimitiveBlend1)(
|
||||
D2D1_PRIMITIVE_BLEND primitiveBlend
|
||||
) PURE;
|
||||
}; // interface ID2D1CommandSink1
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
EXTERN_C CONST IID IID_ID2D1GeometryRealization;
|
||||
EXTERN_C CONST IID IID_ID2D1DeviceContext1;
|
||||
EXTERN_C CONST IID IID_ID2D1Device1;
|
||||
EXTERN_C CONST IID IID_ID2D1Factory2;
|
||||
EXTERN_C CONST IID IID_ID2D1CommandSink1;
|
||||
|
||||
|
||||
#ifdef D2D_USE_C_DEFINITIONS
|
||||
|
||||
|
||||
typedef interface ID2D1GeometryRealization ID2D1GeometryRealization;
|
||||
|
||||
typedef struct ID2D1GeometryRealizationVtbl
|
||||
{
|
||||
|
||||
ID2D1ResourceVtbl Base;
|
||||
|
||||
} ID2D1GeometryRealizationVtbl;
|
||||
|
||||
interface ID2D1GeometryRealization
|
||||
{
|
||||
CONST struct ID2D1GeometryRealizationVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
#define ID2D1GeometryRealization_QueryInterface(This, riid, ppv) \
|
||||
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
||||
|
||||
#define ID2D1GeometryRealization_AddRef(This) \
|
||||
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
|
||||
|
||||
#define ID2D1GeometryRealization_Release(This) \
|
||||
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
|
||||
|
||||
#define ID2D1GeometryRealization_GetFactory(This, factory) \
|
||||
((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory))
|
||||
|
||||
typedef interface ID2D1DeviceContext1 ID2D1DeviceContext1;
|
||||
|
||||
typedef struct ID2D1DeviceContext1Vtbl
|
||||
{
|
||||
|
||||
ID2D1DeviceContextVtbl Base;
|
||||
|
||||
|
||||
STDMETHOD(CreateFilledGeometryRealization)(
|
||||
ID2D1DeviceContext1 *This,
|
||||
_In_ ID2D1Geometry *geometry,
|
||||
FLOAT flatteningTolerance,
|
||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
||||
) PURE;
|
||||
|
||||
STDMETHOD(CreateStrokedGeometryRealization)(
|
||||
ID2D1DeviceContext1 *This,
|
||||
_In_ ID2D1Geometry *geometry,
|
||||
FLOAT flatteningTolerance,
|
||||
FLOAT strokeWidth,
|
||||
_In_opt_ ID2D1StrokeStyle *strokeStyle,
|
||||
_Outptr_ ID2D1GeometryRealization **geometryRealization
|
||||
) PURE;
|
||||
|
||||
STDMETHOD_(void, DrawGeometryRealization)(
|
||||
ID2D1DeviceContext1 *This,
|
||||
_In_ ID2D1GeometryRealization *geometryRealization,
|
||||
_In_ ID2D1Brush *brush
|
||||
) PURE;
|
||||
} ID2D1DeviceContext1Vtbl;
|
||||
|
||||
interface ID2D1DeviceContext1
|
||||
{
|
||||
CONST struct ID2D1DeviceContext1Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
#define ID2D1DeviceContext1_QueryInterface(This, riid, ppv) \
|
||||
((This)->lpVtbl->Base.Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
||||
|
||||
#define ID2D1DeviceContext1_AddRef(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.Base.AddRef((IUnknown *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_Release(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.Base.Release((IUnknown *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_GetFactory(This, factory) \
|
||||
((This)->lpVtbl->Base.Base.Base.GetFactory((ID2D1Resource *)This, factory))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \
|
||||
((This)->lpVtbl->Base.Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \
|
||||
((This)->lpVtbl->Base.Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \
|
||||
((This)->lpVtbl->Base.Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \
|
||||
((This)->lpVtbl->Base.Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \
|
||||
((This)->lpVtbl->Base.Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateLayer(This, size, layer) \
|
||||
((This)->lpVtbl->Base.Base.CreateLayer((ID2D1RenderTarget *)This, size, layer))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateMesh(This, mesh) \
|
||||
((This)->lpVtbl->Base.Base.CreateMesh((ID2D1RenderTarget *)This, mesh))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1DeviceContext1_FillRectangle(This, rect, brush) \
|
||||
((This)->lpVtbl->Base.Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1DeviceContext1_FillRoundedRectangle(This, roundedRect, brush) \
|
||||
((This)->lpVtbl->Base.Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1DeviceContext1_FillEllipse(This, ellipse, brush) \
|
||||
((This)->lpVtbl->Base.Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1DeviceContext1_FillGeometry(This, geometry, brush, opacityBrush) \
|
||||
((This)->lpVtbl->Base.Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_FillMesh(This, mesh, brush) \
|
||||
((This)->lpVtbl->Base.Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \
|
||||
((This)->lpVtbl->Base.Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \
|
||||
((This)->lpVtbl->Base.Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options))
|
||||
|
||||
#define ID2D1DeviceContext1_SetTransform(This, transform) \
|
||||
((This)->lpVtbl->Base.Base.SetTransform((ID2D1RenderTarget *)This, transform))
|
||||
|
||||
#define ID2D1DeviceContext1_GetTransform(This, transform) \
|
||||
((This)->lpVtbl->Base.Base.GetTransform((ID2D1RenderTarget *)This, transform))
|
||||
|
||||
#define ID2D1DeviceContext1_SetAntialiasMode(This, antialiasMode) \
|
||||
((This)->lpVtbl->Base.Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode))
|
||||
|
||||
#define ID2D1DeviceContext1_GetAntialiasMode(This) \
|
||||
((This)->lpVtbl->Base.Base.GetAntialiasMode((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_SetTextAntialiasMode(This, textAntialiasMode) \
|
||||
((This)->lpVtbl->Base.Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode))
|
||||
|
||||
#define ID2D1DeviceContext1_GetTextAntialiasMode(This) \
|
||||
((This)->lpVtbl->Base.Base.GetTextAntialiasMode((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_SetTextRenderingParams(This, textRenderingParams) \
|
||||
((This)->lpVtbl->Base.Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
|
||||
|
||||
#define ID2D1DeviceContext1_GetTextRenderingParams(This, textRenderingParams) \
|
||||
((This)->lpVtbl->Base.Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams))
|
||||
|
||||
#define ID2D1DeviceContext1_SetTags(This, tag1, tag2) \
|
||||
((This)->lpVtbl->Base.Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2))
|
||||
|
||||
#define ID2D1DeviceContext1_GetTags(This, tag1, tag2) \
|
||||
((This)->lpVtbl->Base.Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2))
|
||||
|
||||
#define ID2D1DeviceContext1_PopLayer(This) \
|
||||
((This)->lpVtbl->Base.Base.PopLayer((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_Flush(This, tag1, tag2) \
|
||||
((This)->lpVtbl->Base.Base.Flush((ID2D1RenderTarget *)This, tag1, tag2))
|
||||
|
||||
#define ID2D1DeviceContext1_SaveDrawingState(This, drawingStateBlock) \
|
||||
((This)->lpVtbl->Base.Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
|
||||
|
||||
#define ID2D1DeviceContext1_RestoreDrawingState(This, drawingStateBlock) \
|
||||
((This)->lpVtbl->Base.Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock))
|
||||
|
||||
#define ID2D1DeviceContext1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
|
||||
((This)->lpVtbl->Base.Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode))
|
||||
|
||||
#define ID2D1DeviceContext1_PopAxisAlignedClip(This) \
|
||||
((This)->lpVtbl->Base.Base.PopAxisAlignedClip((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_Clear(This, clearColor) \
|
||||
((This)->lpVtbl->Base.Base.Clear((ID2D1RenderTarget *)This, clearColor))
|
||||
|
||||
#define ID2D1DeviceContext1_BeginDraw(This) \
|
||||
((This)->lpVtbl->Base.Base.BeginDraw((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_EndDraw(This, tag1, tag2) \
|
||||
((This)->lpVtbl->Base.Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2))
|
||||
|
||||
#define ID2D1DeviceContext1_GetPixelFormat(This) \
|
||||
((This)->lpVtbl->Base.Base.GetPixelFormat((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_SetDpi(This, dpiX, dpiY) \
|
||||
((This)->lpVtbl->Base.Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
|
||||
|
||||
#define ID2D1DeviceContext1_GetDpi(This, dpiX, dpiY) \
|
||||
((This)->lpVtbl->Base.Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY))
|
||||
|
||||
#define ID2D1DeviceContext1_GetSize(This) \
|
||||
((This)->lpVtbl->Base.Base.GetSize((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_GetPixelSize(This) \
|
||||
((This)->lpVtbl->Base.Base.GetPixelSize((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_GetMaximumBitmapSize(This) \
|
||||
((This)->lpVtbl->Base.Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_IsSupported(This, renderTargetProperties) \
|
||||
((This)->lpVtbl->Base.Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateBitmap(This, size, sourceData, pitch, bitmapProperties, bitmap) \
|
||||
((This)->lpVtbl->Base.CreateBitmap((ID2D1DeviceContext *)This, size, sourceData, pitch, bitmapProperties, bitmap))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \
|
||||
((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1DeviceContext *)This, wicBitmapSource, bitmapProperties, bitmap))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateColorContext(This, space, profile, profileSize, colorContext) \
|
||||
((This)->lpVtbl->Base.CreateColorContext((ID2D1DeviceContext *)This, space, profile, profileSize, colorContext))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateColorContextFromFilename(This, filename, colorContext) \
|
||||
((This)->lpVtbl->Base.CreateColorContextFromFilename((ID2D1DeviceContext *)This, filename, colorContext))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateColorContextFromWicColorContext(This, wicColorContext, colorContext) \
|
||||
((This)->lpVtbl->Base.CreateColorContextFromWicColorContext((ID2D1DeviceContext *)This, wicColorContext, colorContext))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateBitmapFromDxgiSurface(This, surface, bitmapProperties, bitmap) \
|
||||
((This)->lpVtbl->Base.CreateBitmapFromDxgiSurface((ID2D1DeviceContext *)This, surface, bitmapProperties, bitmap))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateEffect(This, effectId, effect) \
|
||||
((This)->lpVtbl->Base.CreateEffect((ID2D1DeviceContext *)This, effectId, effect))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateGradientStopCollection(This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1) \
|
||||
((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1DeviceContext *)This, straightAlphaGradientStops, straightAlphaGradientStopsCount, preInterpolationSpace, postInterpolationSpace, bufferPrecision, extendMode, colorInterpolationMode, gradientStopCollection1))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateImageBrush(This, image, imageBrushProperties, brushProperties, imageBrush) \
|
||||
((This)->lpVtbl->Base.CreateImageBrush((ID2D1DeviceContext *)This, image, imageBrushProperties, brushProperties, imageBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \
|
||||
((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1DeviceContext *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateCommandList(This, commandList) \
|
||||
((This)->lpVtbl->Base.CreateCommandList((ID2D1DeviceContext *)This, commandList))
|
||||
|
||||
#define ID2D1DeviceContext1_IsDxgiFormatSupported(This, format) \
|
||||
((This)->lpVtbl->Base.IsDxgiFormatSupported((ID2D1DeviceContext *)This, format))
|
||||
|
||||
#define ID2D1DeviceContext1_IsBufferPrecisionSupported(This, bufferPrecision) \
|
||||
((This)->lpVtbl->Base.IsBufferPrecisionSupported((ID2D1DeviceContext *)This, bufferPrecision))
|
||||
|
||||
#define ID2D1DeviceContext1_GetImageLocalBounds(This, image, localBounds) \
|
||||
((This)->lpVtbl->Base.GetImageLocalBounds((ID2D1DeviceContext *)This, image, localBounds))
|
||||
|
||||
#define ID2D1DeviceContext1_GetImageWorldBounds(This, image, worldBounds) \
|
||||
((This)->lpVtbl->Base.GetImageWorldBounds((ID2D1DeviceContext *)This, image, worldBounds))
|
||||
|
||||
#define ID2D1DeviceContext1_GetGlyphRunWorldBounds(This, baselineOrigin, glyphRun, measuringMode, bounds) \
|
||||
((This)->lpVtbl->Base.GetGlyphRunWorldBounds((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, measuringMode, bounds))
|
||||
|
||||
#define ID2D1DeviceContext1_GetDevice(This, device) \
|
||||
((This)->lpVtbl->Base.GetDevice((ID2D1DeviceContext *)This, device))
|
||||
|
||||
#define ID2D1DeviceContext1_SetTarget(This, image) \
|
||||
((This)->lpVtbl->Base.SetTarget((ID2D1DeviceContext *)This, image))
|
||||
|
||||
#define ID2D1DeviceContext1_GetTarget(This, image) \
|
||||
((This)->lpVtbl->Base.GetTarget((ID2D1DeviceContext *)This, image))
|
||||
|
||||
#define ID2D1DeviceContext1_SetRenderingControls(This, renderingControls) \
|
||||
((This)->lpVtbl->Base.SetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
|
||||
|
||||
#define ID2D1DeviceContext1_GetRenderingControls(This, renderingControls) \
|
||||
((This)->lpVtbl->Base.GetRenderingControls((ID2D1DeviceContext *)This, renderingControls))
|
||||
|
||||
#define ID2D1DeviceContext1_SetPrimitiveBlend(This, primitiveBlend) \
|
||||
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1DeviceContext *)This, primitiveBlend))
|
||||
|
||||
#define ID2D1DeviceContext1_GetPrimitiveBlend(This) \
|
||||
((This)->lpVtbl->Base.GetPrimitiveBlend((ID2D1DeviceContext *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_SetUnitMode(This, unitMode) \
|
||||
((This)->lpVtbl->Base.SetUnitMode((ID2D1DeviceContext *)This, unitMode))
|
||||
|
||||
#define ID2D1DeviceContext1_GetUnitMode(This) \
|
||||
((This)->lpVtbl->Base.GetUnitMode((ID2D1DeviceContext *)This))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
|
||||
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1DeviceContext *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
|
||||
((This)->lpVtbl->Base.DrawImage((ID2D1DeviceContext *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
|
||||
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1DeviceContext *)This, gdiMetafile, targetOffset))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
|
||||
((This)->lpVtbl->Base.DrawBitmap((ID2D1DeviceContext *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
|
||||
|
||||
#define ID2D1DeviceContext1_PushLayer(This, layerParameters, layer) \
|
||||
((This)->lpVtbl->Base.PushLayer((ID2D1DeviceContext *)This, layerParameters, layer))
|
||||
|
||||
#define ID2D1DeviceContext1_InvalidateEffectInputRectangle(This, effect, input, inputRectangle) \
|
||||
((This)->lpVtbl->Base.InvalidateEffectInputRectangle((ID2D1DeviceContext *)This, effect, input, inputRectangle))
|
||||
|
||||
#define ID2D1DeviceContext1_GetEffectInvalidRectangleCount(This, effect, rectangleCount) \
|
||||
((This)->lpVtbl->Base.GetEffectInvalidRectangleCount((ID2D1DeviceContext *)This, effect, rectangleCount))
|
||||
|
||||
#define ID2D1DeviceContext1_GetEffectInvalidRectangles(This, effect, rectangles, rectanglesCount) \
|
||||
((This)->lpVtbl->Base.GetEffectInvalidRectangles((ID2D1DeviceContext *)This, effect, rectangles, rectanglesCount))
|
||||
|
||||
#define ID2D1DeviceContext1_GetEffectRequiredInputRectangles(This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount) \
|
||||
((This)->lpVtbl->Base.GetEffectRequiredInputRectangles((ID2D1DeviceContext *)This, renderEffect, renderImageRectangle, inputDescriptions, requiredInputRects, inputCount))
|
||||
|
||||
#define ID2D1DeviceContext1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
|
||||
((This)->lpVtbl->Base.FillOpacityMask((ID2D1DeviceContext *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization) \
|
||||
((This)->lpVtbl->CreateFilledGeometryRealization(This, geometry, flatteningTolerance, geometryRealization))
|
||||
|
||||
#define ID2D1DeviceContext1_CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization) \
|
||||
((This)->lpVtbl->CreateStrokedGeometryRealization(This, geometry, flatteningTolerance, strokeWidth, strokeStyle, geometryRealization))
|
||||
|
||||
#define ID2D1DeviceContext1_DrawGeometryRealization(This, geometryRealization, brush) \
|
||||
((This)->lpVtbl->DrawGeometryRealization(This, geometryRealization, brush))
|
||||
|
||||
typedef interface ID2D1Device1 ID2D1Device1;
|
||||
|
||||
typedef struct ID2D1Device1Vtbl
|
||||
{
|
||||
|
||||
ID2D1DeviceVtbl Base;
|
||||
|
||||
|
||||
STDMETHOD_(D2D1_RENDERING_PRIORITY, GetRenderingPriority)(
|
||||
ID2D1Device1 *This
|
||||
) PURE;
|
||||
|
||||
STDMETHOD_(void, SetRenderingPriority)(
|
||||
ID2D1Device1 *This,
|
||||
D2D1_RENDERING_PRIORITY renderingPriority
|
||||
) PURE;
|
||||
|
||||
STDMETHOD(CreateDeviceContext)(
|
||||
ID2D1Device1 *This,
|
||||
D2D1_DEVICE_CONTEXT_OPTIONS options,
|
||||
_Outptr_ ID2D1DeviceContext1 **deviceContext1
|
||||
) PURE;
|
||||
} ID2D1Device1Vtbl;
|
||||
|
||||
interface ID2D1Device1
|
||||
{
|
||||
CONST struct ID2D1Device1Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
#define ID2D1Device1_QueryInterface(This, riid, ppv) \
|
||||
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
||||
|
||||
#define ID2D1Device1_AddRef(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
|
||||
|
||||
#define ID2D1Device1_Release(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
|
||||
|
||||
#define ID2D1Device1_GetFactory(This, factory) \
|
||||
((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory))
|
||||
|
||||
#define ID2D1Device1_CreatePrintControl(This, wicFactory, documentTarget, printControlProperties, printControl) \
|
||||
((This)->lpVtbl->Base.CreatePrintControl((ID2D1Device *)This, wicFactory, documentTarget, printControlProperties, printControl))
|
||||
|
||||
#define ID2D1Device1_SetMaximumTextureMemory(This, maximumInBytes) \
|
||||
((This)->lpVtbl->Base.SetMaximumTextureMemory((ID2D1Device *)This, maximumInBytes))
|
||||
|
||||
#define ID2D1Device1_GetMaximumTextureMemory(This) \
|
||||
((This)->lpVtbl->Base.GetMaximumTextureMemory((ID2D1Device *)This))
|
||||
|
||||
#define ID2D1Device1_ClearResources(This, millisecondsSinceUse) \
|
||||
((This)->lpVtbl->Base.ClearResources((ID2D1Device *)This, millisecondsSinceUse))
|
||||
|
||||
#define ID2D1Device1_GetRenderingPriority(This) \
|
||||
((This)->lpVtbl->GetRenderingPriority(This))
|
||||
|
||||
#define ID2D1Device1_SetRenderingPriority(This, renderingPriority) \
|
||||
((This)->lpVtbl->SetRenderingPriority(This, renderingPriority))
|
||||
|
||||
#define ID2D1Device1_CreateDeviceContext(This, options, deviceContext1) \
|
||||
((This)->lpVtbl->CreateDeviceContext(This, options, deviceContext1))
|
||||
|
||||
typedef interface ID2D1Factory2 ID2D1Factory2;
|
||||
|
||||
typedef struct ID2D1Factory2Vtbl
|
||||
{
|
||||
|
||||
ID2D1Factory1Vtbl Base;
|
||||
|
||||
|
||||
STDMETHOD(CreateDevice)(
|
||||
ID2D1Factory2 *This,
|
||||
_In_ IDXGIDevice *dxgiDevice,
|
||||
_Outptr_ ID2D1Device1 **d2dDevice1
|
||||
) PURE;
|
||||
} ID2D1Factory2Vtbl;
|
||||
|
||||
interface ID2D1Factory2
|
||||
{
|
||||
CONST struct ID2D1Factory2Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
#define ID2D1Factory2_QueryInterface(This, riid, ppv) \
|
||||
((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
||||
|
||||
#define ID2D1Factory2_AddRef(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This))
|
||||
|
||||
#define ID2D1Factory2_Release(This) \
|
||||
((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This))
|
||||
|
||||
#define ID2D1Factory2_ReloadSystemMetrics(This) \
|
||||
((This)->lpVtbl->Base.Base.ReloadSystemMetrics((ID2D1Factory *)This))
|
||||
|
||||
#define ID2D1Factory2_GetDesktopDpi(This, dpiX, dpiY) \
|
||||
((This)->lpVtbl->Base.Base.GetDesktopDpi((ID2D1Factory *)This, dpiX, dpiY))
|
||||
|
||||
#define ID2D1Factory2_CreateRectangleGeometry(This, rectangle, rectangleGeometry) \
|
||||
((This)->lpVtbl->Base.Base.CreateRectangleGeometry((ID2D1Factory *)This, rectangle, rectangleGeometry))
|
||||
|
||||
#define ID2D1Factory2_CreateRoundedRectangleGeometry(This, roundedRectangle, roundedRectangleGeometry) \
|
||||
((This)->lpVtbl->Base.Base.CreateRoundedRectangleGeometry((ID2D1Factory *)This, roundedRectangle, roundedRectangleGeometry))
|
||||
|
||||
#define ID2D1Factory2_CreateEllipseGeometry(This, ellipse, ellipseGeometry) \
|
||||
((This)->lpVtbl->Base.Base.CreateEllipseGeometry((ID2D1Factory *)This, ellipse, ellipseGeometry))
|
||||
|
||||
#define ID2D1Factory2_CreateGeometryGroup(This, fillMode, geometries, geometriesCount, geometryGroup) \
|
||||
((This)->lpVtbl->Base.Base.CreateGeometryGroup((ID2D1Factory *)This, fillMode, geometries, geometriesCount, geometryGroup))
|
||||
|
||||
#define ID2D1Factory2_CreateTransformedGeometry(This, sourceGeometry, transform, transformedGeometry) \
|
||||
((This)->lpVtbl->Base.Base.CreateTransformedGeometry((ID2D1Factory *)This, sourceGeometry, transform, transformedGeometry))
|
||||
|
||||
#define ID2D1Factory2_CreateWicBitmapRenderTarget(This, target, renderTargetProperties, renderTarget) \
|
||||
((This)->lpVtbl->Base.Base.CreateWicBitmapRenderTarget((ID2D1Factory *)This, target, renderTargetProperties, renderTarget))
|
||||
|
||||
#define ID2D1Factory2_CreateHwndRenderTarget(This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget) \
|
||||
((This)->lpVtbl->Base.Base.CreateHwndRenderTarget((ID2D1Factory *)This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget))
|
||||
|
||||
#define ID2D1Factory2_CreateDxgiSurfaceRenderTarget(This, dxgiSurface, renderTargetProperties, renderTarget) \
|
||||
((This)->lpVtbl->Base.Base.CreateDxgiSurfaceRenderTarget((ID2D1Factory *)This, dxgiSurface, renderTargetProperties, renderTarget))
|
||||
|
||||
#define ID2D1Factory2_CreateDCRenderTarget(This, renderTargetProperties, dcRenderTarget) \
|
||||
((This)->lpVtbl->Base.Base.CreateDCRenderTarget((ID2D1Factory *)This, renderTargetProperties, dcRenderTarget))
|
||||
|
||||
#define ID2D1Factory2_CreateStrokeStyle(This, strokeStyleProperties, dashes, dashesCount, strokeStyle) \
|
||||
((This)->lpVtbl->Base.CreateStrokeStyle((ID2D1Factory1 *)This, strokeStyleProperties, dashes, dashesCount, strokeStyle))
|
||||
|
||||
#define ID2D1Factory2_CreatePathGeometry(This, pathGeometry) \
|
||||
((This)->lpVtbl->Base.CreatePathGeometry((ID2D1Factory1 *)This, pathGeometry))
|
||||
|
||||
#define ID2D1Factory2_CreateDrawingStateBlock(This, drawingStateDescription, textRenderingParams, drawingStateBlock) \
|
||||
((This)->lpVtbl->Base.CreateDrawingStateBlock((ID2D1Factory1 *)This, drawingStateDescription, textRenderingParams, drawingStateBlock))
|
||||
|
||||
#define ID2D1Factory2_CreateGdiMetafile(This, metafileStream, metafile) \
|
||||
((This)->lpVtbl->Base.CreateGdiMetafile((ID2D1Factory1 *)This, metafileStream, metafile))
|
||||
|
||||
#define ID2D1Factory2_RegisterEffectFromStream(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
|
||||
((This)->lpVtbl->Base.RegisterEffectFromStream((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
|
||||
|
||||
#define ID2D1Factory2_RegisterEffectFromString(This, classId, propertyXml, bindings, bindingsCount, effectFactory) \
|
||||
((This)->lpVtbl->Base.RegisterEffectFromString((ID2D1Factory1 *)This, classId, propertyXml, bindings, bindingsCount, effectFactory))
|
||||
|
||||
#define ID2D1Factory2_UnregisterEffect(This, classId) \
|
||||
((This)->lpVtbl->Base.UnregisterEffect((ID2D1Factory1 *)This, classId))
|
||||
|
||||
#define ID2D1Factory2_GetRegisteredEffects(This, effects, effectsCount, effectsReturned, effectsRegistered) \
|
||||
((This)->lpVtbl->Base.GetRegisteredEffects((ID2D1Factory1 *)This, effects, effectsCount, effectsReturned, effectsRegistered))
|
||||
|
||||
#define ID2D1Factory2_GetEffectProperties(This, effectId, properties) \
|
||||
((This)->lpVtbl->Base.GetEffectProperties((ID2D1Factory1 *)This, effectId, properties))
|
||||
|
||||
#define ID2D1Factory2_CreateDevice(This, dxgiDevice, d2dDevice1) \
|
||||
((This)->lpVtbl->CreateDevice(This, dxgiDevice, d2dDevice1))
|
||||
|
||||
typedef interface ID2D1CommandSink1 ID2D1CommandSink1;
|
||||
|
||||
typedef struct ID2D1CommandSink1Vtbl
|
||||
{
|
||||
|
||||
ID2D1CommandSinkVtbl Base;
|
||||
|
||||
|
||||
STDMETHOD(SetPrimitiveBlend1)(
|
||||
ID2D1CommandSink1 *This,
|
||||
D2D1_PRIMITIVE_BLEND primitiveBlend
|
||||
) PURE;
|
||||
} ID2D1CommandSink1Vtbl;
|
||||
|
||||
interface ID2D1CommandSink1
|
||||
{
|
||||
CONST struct ID2D1CommandSink1Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
#define ID2D1CommandSink1_QueryInterface(This, riid, ppv) \
|
||||
((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv))
|
||||
|
||||
#define ID2D1CommandSink1_AddRef(This) \
|
||||
((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This))
|
||||
|
||||
#define ID2D1CommandSink1_Release(This) \
|
||||
((This)->lpVtbl->Base.Base.Release((IUnknown *)This))
|
||||
|
||||
#define ID2D1CommandSink1_BeginDraw(This) \
|
||||
((This)->lpVtbl->Base.BeginDraw((ID2D1CommandSink *)This))
|
||||
|
||||
#define ID2D1CommandSink1_EndDraw(This) \
|
||||
((This)->lpVtbl->Base.EndDraw((ID2D1CommandSink *)This))
|
||||
|
||||
#define ID2D1CommandSink1_SetAntialiasMode(This, antialiasMode) \
|
||||
((This)->lpVtbl->Base.SetAntialiasMode((ID2D1CommandSink *)This, antialiasMode))
|
||||
|
||||
#define ID2D1CommandSink1_SetTags(This, tag1, tag2) \
|
||||
((This)->lpVtbl->Base.SetTags((ID2D1CommandSink *)This, tag1, tag2))
|
||||
|
||||
#define ID2D1CommandSink1_SetTextAntialiasMode(This, textAntialiasMode) \
|
||||
((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1CommandSink *)This, textAntialiasMode))
|
||||
|
||||
#define ID2D1CommandSink1_SetTextRenderingParams(This, textRenderingParams) \
|
||||
((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1CommandSink *)This, textRenderingParams))
|
||||
|
||||
#define ID2D1CommandSink1_SetTransform(This, transform) \
|
||||
((This)->lpVtbl->Base.SetTransform((ID2D1CommandSink *)This, transform))
|
||||
|
||||
#define ID2D1CommandSink1_SetPrimitiveBlend(This, primitiveBlend) \
|
||||
((This)->lpVtbl->Base.SetPrimitiveBlend((ID2D1CommandSink *)This, primitiveBlend))
|
||||
|
||||
#define ID2D1CommandSink1_SetUnitMode(This, unitMode) \
|
||||
((This)->lpVtbl->Base.SetUnitMode((ID2D1CommandSink *)This, unitMode))
|
||||
|
||||
#define ID2D1CommandSink1_Clear(This, color) \
|
||||
((This)->lpVtbl->Base.Clear((ID2D1CommandSink *)This, color))
|
||||
|
||||
#define ID2D1CommandSink1_DrawGlyphRun(This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode) \
|
||||
((This)->lpVtbl->Base.DrawGlyphRun((ID2D1CommandSink *)This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode))
|
||||
|
||||
#define ID2D1CommandSink1_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.DrawLine((ID2D1CommandSink *)This, point0, point1, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1CommandSink1_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.DrawGeometry((ID2D1CommandSink *)This, geometry, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1CommandSink1_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \
|
||||
((This)->lpVtbl->Base.DrawRectangle((ID2D1CommandSink *)This, rect, brush, strokeWidth, strokeStyle))
|
||||
|
||||
#define ID2D1CommandSink1_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform) \
|
||||
((This)->lpVtbl->Base.DrawBitmap((ID2D1CommandSink *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform))
|
||||
|
||||
#define ID2D1CommandSink1_DrawImage(This, image, targetOffset, imageRectangle, interpolationMode, compositeMode) \
|
||||
((This)->lpVtbl->Base.DrawImage((ID2D1CommandSink *)This, image, targetOffset, imageRectangle, interpolationMode, compositeMode))
|
||||
|
||||
#define ID2D1CommandSink1_DrawGdiMetafile(This, gdiMetafile, targetOffset) \
|
||||
((This)->lpVtbl->Base.DrawGdiMetafile((ID2D1CommandSink *)This, gdiMetafile, targetOffset))
|
||||
|
||||
#define ID2D1CommandSink1_FillMesh(This, mesh, brush) \
|
||||
((This)->lpVtbl->Base.FillMesh((ID2D1CommandSink *)This, mesh, brush))
|
||||
|
||||
#define ID2D1CommandSink1_FillOpacityMask(This, opacityMask, brush, destinationRectangle, sourceRectangle) \
|
||||
((This)->lpVtbl->Base.FillOpacityMask((ID2D1CommandSink *)This, opacityMask, brush, destinationRectangle, sourceRectangle))
|
||||
|
||||
#define ID2D1CommandSink1_FillGeometry(This, geometry, brush, opacityBrush) \
|
||||
((This)->lpVtbl->Base.FillGeometry((ID2D1CommandSink *)This, geometry, brush, opacityBrush))
|
||||
|
||||
#define ID2D1CommandSink1_FillRectangle(This, rect, brush) \
|
||||
((This)->lpVtbl->Base.FillRectangle((ID2D1CommandSink *)This, rect, brush))
|
||||
|
||||
#define ID2D1CommandSink1_PushAxisAlignedClip(This, clipRect, antialiasMode) \
|
||||
((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1CommandSink *)This, clipRect, antialiasMode))
|
||||
|
||||
#define ID2D1CommandSink1_PushLayer(This, layerParameters1, layer) \
|
||||
((This)->lpVtbl->Base.PushLayer((ID2D1CommandSink *)This, layerParameters1, layer))
|
||||
|
||||
#define ID2D1CommandSink1_PopAxisAlignedClip(This) \
|
||||
((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1CommandSink *)This))
|
||||
|
||||
#define ID2D1CommandSink1_PopLayer(This) \
|
||||
((This)->lpVtbl->Base.PopLayer((ID2D1CommandSink *)This))
|
||||
|
||||
#define ID2D1CommandSink1_SetPrimitiveBlend1(This, primitiveBlend) \
|
||||
((This)->lpVtbl->SetPrimitiveBlend1(This, primitiveBlend))
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if NTDDI_VERSION >= NTDDI_WINBLUE
|
||||
FLOAT WINAPI
|
||||
D2D1ComputeMaximumScaleFactor(
|
||||
_In_ CONST D2D1_MATRIX_3X2_F *matrix
|
||||
);
|
||||
#endif // #if NTDDI_VERSION >= NTDDI_WINBLUE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
#include <d2d1_2helper.h>
|
||||
#endif // #ifndef _D2D1_2_H_
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
|
||||
/*=========================================================================*\
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
File: D2D1_2Helper.h
|
||||
|
||||
Module Name: D2D
|
||||
|
||||
Description: Helper files over the D2D interfaces and APIs.
|
||||
|
||||
\*=========================================================================*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _D2D1_2HELPER_H_
|
||||
#define _D2D1_2HELPER_H_
|
||||
|
||||
#if NTDDI_VERSION >= NTDDI_WINBLUE
|
||||
|
||||
#ifndef _D2D1_2_H_
|
||||
#include <d2d1_2.h>
|
||||
#endif // #ifndef _D2D1_2_H_
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
namespace D2D1
|
||||
{
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
FLOAT
|
||||
ComputeFlatteningTolerance(
|
||||
_In_ CONST D2D1_MATRIX_3X2_F &matrix,
|
||||
FLOAT dpiX = 96.0f,
|
||||
FLOAT dpiY = 96.0f,
|
||||
FLOAT maxZoomFactor = 1.0f
|
||||
)
|
||||
{
|
||||
D2D1_MATRIX_3X2_F dpiDependentTransform =
|
||||
matrix * D2D1::Matrix3x2F::Scale(dpiX / 96.0f, dpiY / 96.0f);
|
||||
|
||||
FLOAT absMaxZoomFactor = (maxZoomFactor > 0) ? maxZoomFactor : -maxZoomFactor;
|
||||
|
||||
return D2D1_DEFAULT_FLATTENING_TOLERANCE /
|
||||
(absMaxZoomFactor * D2D1ComputeMaximumScaleFactor(&dpiDependentTransform));
|
||||
}
|
||||
|
||||
} // namespace D2D1
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#endif // #if NTDDI_VERSION >= NTDDI_WINBLUE
|
||||
|
||||
#endif // #ifndef _D2D1_HELPER_H_
|
||||
|
||||
Vendored
+2264
File diff suppressed because it is too large
Load Diff
+228
@@ -0,0 +1,228 @@
|
||||
|
||||
/*=========================================================================*\
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
File: D2D1_3Helper.h
|
||||
|
||||
Module Name: D2D
|
||||
|
||||
Description: Helper files over the D2D interfaces and APIs.
|
||||
|
||||
\*=========================================================================*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _D2D1_3HELPER_H_
|
||||
#define _D2D1_3HELPER_H_
|
||||
|
||||
#if NTDDI_VERSION >= NTDDI_WINTHRESHOLD
|
||||
|
||||
#ifndef _D2D1_3_H_
|
||||
#include <d2d1_3.h>
|
||||
#endif // #ifndef _D2D1_3_H_
|
||||
|
||||
#ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
namespace D2D1
|
||||
{
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_GRADIENT_MESH_PATCH
|
||||
GradientMeshPatch(
|
||||
D2D1_POINT_2F point00,
|
||||
D2D1_POINT_2F point01,
|
||||
D2D1_POINT_2F point02,
|
||||
D2D1_POINT_2F point03,
|
||||
D2D1_POINT_2F point10,
|
||||
D2D1_POINT_2F point11,
|
||||
D2D1_POINT_2F point12,
|
||||
D2D1_POINT_2F point13,
|
||||
D2D1_POINT_2F point20,
|
||||
D2D1_POINT_2F point21,
|
||||
D2D1_POINT_2F point22,
|
||||
D2D1_POINT_2F point23,
|
||||
D2D1_POINT_2F point30,
|
||||
D2D1_POINT_2F point31,
|
||||
D2D1_POINT_2F point32,
|
||||
D2D1_POINT_2F point33,
|
||||
D2D1_COLOR_F color00,
|
||||
D2D1_COLOR_F color03,
|
||||
D2D1_COLOR_F color30,
|
||||
D2D1_COLOR_F color33,
|
||||
D2D1_PATCH_EDGE_MODE topEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE leftEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE bottomEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE rightEdgeMode
|
||||
)
|
||||
{
|
||||
D2D1_GRADIENT_MESH_PATCH newPatch;
|
||||
newPatch.point00 = point00;
|
||||
newPatch.point01 = point01;
|
||||
newPatch.point02 = point02;
|
||||
newPatch.point03 = point03;
|
||||
newPatch.point10 = point10;
|
||||
newPatch.point11 = point11;
|
||||
newPatch.point12 = point12;
|
||||
newPatch.point13 = point13;
|
||||
newPatch.point20 = point20;
|
||||
newPatch.point21 = point21;
|
||||
newPatch.point22 = point22;
|
||||
newPatch.point23 = point23;
|
||||
newPatch.point30 = point30;
|
||||
newPatch.point31 = point31;
|
||||
newPatch.point32 = point32;
|
||||
newPatch.point33 = point33;
|
||||
|
||||
newPatch.color00 = color00;
|
||||
newPatch.color03 = color03;
|
||||
newPatch.color30 = color30;
|
||||
newPatch.color33 = color33;
|
||||
|
||||
newPatch.topEdgeMode = topEdgeMode;
|
||||
newPatch.leftEdgeMode = leftEdgeMode;
|
||||
newPatch.bottomEdgeMode = bottomEdgeMode;
|
||||
newPatch.rightEdgeMode = rightEdgeMode;
|
||||
|
||||
return newPatch;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_GRADIENT_MESH_PATCH
|
||||
GradientMeshPatchFromCoonsPatch(
|
||||
D2D1_POINT_2F point0,
|
||||
D2D1_POINT_2F point1,
|
||||
D2D1_POINT_2F point2,
|
||||
D2D1_POINT_2F point3,
|
||||
D2D1_POINT_2F point4,
|
||||
D2D1_POINT_2F point5,
|
||||
D2D1_POINT_2F point6,
|
||||
D2D1_POINT_2F point7,
|
||||
D2D1_POINT_2F point8,
|
||||
D2D1_POINT_2F point9,
|
||||
D2D1_POINT_2F point10,
|
||||
D2D1_POINT_2F point11,
|
||||
D2D1_COLOR_F color0,
|
||||
D2D1_COLOR_F color1,
|
||||
D2D1_COLOR_F color2,
|
||||
D2D1_COLOR_F color3,
|
||||
D2D1_PATCH_EDGE_MODE topEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE leftEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE bottomEdgeMode,
|
||||
D2D1_PATCH_EDGE_MODE rightEdgeMode
|
||||
)
|
||||
{
|
||||
D2D1_GRADIENT_MESH_PATCH newPatch;
|
||||
newPatch.point00 = point0;
|
||||
newPatch.point01 = point1;
|
||||
newPatch.point02 = point2;
|
||||
newPatch.point03 = point3;
|
||||
newPatch.point13 = point4;
|
||||
newPatch.point23 = point5;
|
||||
newPatch.point33 = point6;
|
||||
newPatch.point32 = point7;
|
||||
newPatch.point31 = point8;
|
||||
newPatch.point30 = point9;
|
||||
newPatch.point20 = point10;
|
||||
newPatch.point10 = point11;
|
||||
|
||||
D2D1GetGradientMeshInteriorPointsFromCoonsPatch(
|
||||
&point0,
|
||||
&point1,
|
||||
&point2,
|
||||
&point3,
|
||||
&point4,
|
||||
&point5,
|
||||
&point6,
|
||||
&point7,
|
||||
&point8,
|
||||
&point9,
|
||||
&point10,
|
||||
&point11,
|
||||
&newPatch.point11,
|
||||
&newPatch.point12,
|
||||
&newPatch.point21,
|
||||
&newPatch.point22
|
||||
);
|
||||
|
||||
newPatch.color00 = color0;
|
||||
newPatch.color03 = color1;
|
||||
newPatch.color33 = color2;
|
||||
newPatch.color30 = color3;
|
||||
newPatch.topEdgeMode = topEdgeMode;
|
||||
newPatch.leftEdgeMode = leftEdgeMode;
|
||||
newPatch.bottomEdgeMode = bottomEdgeMode;
|
||||
newPatch.rightEdgeMode = rightEdgeMode;
|
||||
|
||||
return newPatch;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_INK_POINT
|
||||
InkPoint(
|
||||
const D2D1_POINT_2F &point,
|
||||
FLOAT radius
|
||||
)
|
||||
{
|
||||
D2D1_INK_POINT inkPoint;
|
||||
|
||||
inkPoint.x = point.x;
|
||||
inkPoint.y = point.y;
|
||||
inkPoint.radius = radius;
|
||||
|
||||
return inkPoint;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_INK_BEZIER_SEGMENT
|
||||
InkBezierSegment(
|
||||
const D2D1_INK_POINT &point1,
|
||||
const D2D1_INK_POINT &point2,
|
||||
const D2D1_INK_POINT &point3
|
||||
)
|
||||
{
|
||||
D2D1_INK_BEZIER_SEGMENT inkBezierSegment;
|
||||
|
||||
inkBezierSegment.point1 = point1;
|
||||
inkBezierSegment.point2 = point2;
|
||||
inkBezierSegment.point3 = point3;
|
||||
|
||||
return inkBezierSegment;
|
||||
}
|
||||
|
||||
COM_DECLSPEC_NOTHROW
|
||||
D2D1FORCEINLINE
|
||||
D2D1_INK_STYLE_PROPERTIES
|
||||
InkStyleProperties(
|
||||
D2D1_INK_NIB_SHAPE nibShape,
|
||||
const D2D1_MATRIX_3X2_F &nibTransform
|
||||
)
|
||||
{
|
||||
D2D1_INK_STYLE_PROPERTIES inkStyleProperties;
|
||||
|
||||
inkStyleProperties.nibShape = nibShape;
|
||||
inkStyleProperties.nibTransform = nibTransform;
|
||||
|
||||
return inkStyleProperties;
|
||||
}
|
||||
} // namespace D2D1
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // #ifndef D2D_USE_C_DEFINITIONS
|
||||
|
||||
#endif // #if NTDDI_VERSION >= NTDDI_WINTHRESHOLD
|
||||
|
||||
#endif // #ifndef _D2D1_HELPER_H_
|
||||
|
||||
+2307
File diff suppressed because it is too large
Load Diff
+102
@@ -0,0 +1,102 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This file is automatically generated. Please do not edit it directly.
|
||||
//
|
||||
// File name: D2D1Effects_1.h
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // #ifdef _MSC_VER
|
||||
|
||||
#ifndef _D2D1_EFFECTS_1_
|
||||
#define _D2D1_EFFECTS_1_
|
||||
|
||||
#ifndef _D2D1_EFFECTS_
|
||||
#include <d2d1effects.h>
|
||||
#endif // #ifndef _D2D1_EFFECTS_
|
||||
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
// Built in effect CLSIDs
|
||||
DEFINE_GUID(CLSID_D2D1YCbCr, 0x99503cc1, 0x66c7, 0x45c9, 0xa8, 0x75, 0x8a, 0xd8, 0xa7, 0x91, 0x44, 0x01);
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_YCBCR_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the YCbCr effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_YCBCR_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "ChromaSubsampling"
|
||||
// Property Type: D2D1_YCBCR_CHROMA_SUBSAMPLING
|
||||
//
|
||||
D2D1_YCBCR_PROP_CHROMA_SUBSAMPLING = 0,
|
||||
|
||||
//
|
||||
// Property Name: "TransformMatrix"
|
||||
// Property Type: D2D1_MATRIX_3X2_F
|
||||
//
|
||||
D2D1_YCBCR_PROP_TRANSFORM_MATRIX = 1,
|
||||
|
||||
//
|
||||
// Property Name: "InterpolationMode"
|
||||
// Property Type: D2D1_YCBCR_INTERPOLATION_MODE
|
||||
//
|
||||
D2D1_YCBCR_PROP_INTERPOLATION_MODE = 2,
|
||||
D2D1_YCBCR_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_YCBCR_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_YCBCR_CHROMA_SUBSAMPLING
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_YCBCR_CHROMA_SUBSAMPLING
|
||||
{
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO = 0,
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_420 = 1,
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_422 = 2,
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_444 = 3,
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_440 = 4,
|
||||
D2D1_YCBCR_CHROMA_SUBSAMPLING_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_YCBCR_CHROMA_SUBSAMPLING;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_YCBCR_INTERPOLATION_MODE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_YCBCR_INTERPOLATION_MODE
|
||||
{
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_LINEAR = 1,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_CUBIC = 2,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC = 4,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5,
|
||||
D2D1_YCBCR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_YCBCR_INTERPOLATION_MODE;
|
||||
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
||||
+594
@@ -0,0 +1,594 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This file is automatically generated. Please do not edit it directly.
|
||||
//
|
||||
// File name: D2D1Effects_2.h
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // #ifdef _MSC_VER
|
||||
|
||||
#ifndef _D2D1_EFFECTS_2_
|
||||
#define _D2D1_EFFECTS_2_
|
||||
|
||||
#ifndef _D2D1_EFFECTS_1_
|
||||
#include <d2d1effects_1.h>
|
||||
#endif // #ifndef _D2D1_EFFECTS_1_
|
||||
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
#pragma region Application Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
// Built in effect CLSIDs
|
||||
DEFINE_GUID(CLSID_D2D1Contrast, 0xb648a78a, 0x0ed5, 0x4f80, 0xa9, 0x4a, 0x8e, 0x82, 0x5a, 0xca, 0x6b, 0x77);
|
||||
DEFINE_GUID(CLSID_D2D1RgbToHue, 0x23f3e5ec, 0x91e8, 0x4d3d, 0xad, 0x0a, 0xaf, 0xad, 0xc1, 0x00, 0x4a, 0xa1);
|
||||
DEFINE_GUID(CLSID_D2D1HueToRgb, 0x7b78a6bd, 0x0141, 0x4def, 0x8a, 0x52, 0x63, 0x56, 0xee, 0x0c, 0xbd, 0xd5);
|
||||
DEFINE_GUID(CLSID_D2D1ChromaKey, 0x74C01F5B, 0x2A0D, 0x408C, 0x88, 0xE2, 0xC7, 0xA3, 0xC7, 0x19, 0x77, 0x42);
|
||||
DEFINE_GUID(CLSID_D2D1Emboss, 0xb1c5eb2b, 0x0348, 0x43f0, 0x81, 0x07, 0x49, 0x57, 0xca, 0xcb, 0xa2, 0xae);
|
||||
DEFINE_GUID(CLSID_D2D1Exposure, 0xb56c8cfa, 0xf634, 0x41ee, 0xbe, 0xe0, 0xff, 0xa6, 0x17, 0x10, 0x60, 0x04);
|
||||
DEFINE_GUID(CLSID_D2D1Grayscale, 0x36DDE0EB, 0x3725, 0x42E0, 0x83, 0x6D, 0x52, 0xFB, 0x20, 0xAE, 0xE6, 0x44);
|
||||
DEFINE_GUID(CLSID_D2D1Invert, 0xe0c3784d, 0xcb39, 0x4e84, 0xb6, 0xfd, 0x6b, 0x72, 0xf0, 0x81, 0x02, 0x63);
|
||||
DEFINE_GUID(CLSID_D2D1Posterize, 0x2188945e, 0x33a3, 0x4366, 0xb7, 0xbc, 0x08, 0x6b, 0xd0, 0x2d, 0x08, 0x84);
|
||||
DEFINE_GUID(CLSID_D2D1Sepia, 0x3a1af410, 0x5f1d, 0x4dbe, 0x84, 0xdf, 0x91, 0x5d, 0xa7, 0x9b, 0x71, 0x53);
|
||||
DEFINE_GUID(CLSID_D2D1Sharpen, 0xC9B887CB, 0xC5FF, 0x4DC5, 0x97, 0x79, 0x27, 0x3D, 0xCF, 0x41, 0x7C, 0x7D);
|
||||
DEFINE_GUID(CLSID_D2D1Straighten, 0x4da47b12, 0x79a3, 0x4fb0, 0x82, 0x37, 0xbb, 0xc3, 0xb2, 0xa4, 0xde, 0x08);
|
||||
DEFINE_GUID(CLSID_D2D1TemperatureTint, 0x89176087, 0x8AF9, 0x4A08, 0xAE, 0xB1, 0x89, 0x5F, 0x38, 0xDB, 0x17, 0x66);
|
||||
DEFINE_GUID(CLSID_D2D1Vignette, 0xc00c40be, 0x5e67, 0x4ca3, 0x95, 0xb4, 0xf4, 0xb0, 0x2c, 0x11, 0x51, 0x35);
|
||||
DEFINE_GUID(CLSID_D2D1EdgeDetection, 0xEFF583CA, 0xCB07, 0x4AA9, 0xAC, 0x5D, 0x2C, 0xC4, 0x4C, 0x76, 0x46, 0x0F);
|
||||
DEFINE_GUID(CLSID_D2D1HighlightsShadows, 0xCADC8384, 0x323F, 0x4C7E, 0xA3, 0x61, 0x2E, 0x2B, 0x24, 0xDF, 0x6E, 0xE4);
|
||||
DEFINE_GUID(CLSID_D2D1LookupTable3D, 0x349E0EDA, 0x0088, 0x4A79, 0x9C, 0xA3, 0xC7, 0xE3, 0x00, 0x20, 0x20, 0x20);
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_CONTRAST_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Contrast effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_CONTRAST_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Contrast"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_CONTRAST_PROP_CONTRAST = 0,
|
||||
|
||||
//
|
||||
// Property Name: "ClampInput"
|
||||
// Property Type: BOOL
|
||||
//
|
||||
D2D1_CONTRAST_PROP_CLAMP_INPUT = 1,
|
||||
D2D1_CONTRAST_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_CONTRAST_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_RGBTOHUE_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the RgbToHue effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_RGBTOHUE_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "OutputColorSpace"
|
||||
// Property Type: D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
||||
//
|
||||
D2D1_RGBTOHUE_PROP_OUTPUT_COLOR_SPACE = 0,
|
||||
D2D1_RGBTOHUE_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_RGBTOHUE_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE
|
||||
{
|
||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
|
||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
|
||||
D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_HUETORGB_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the HueToRgb effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_HUETORGB_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "InputColorSpace"
|
||||
// Property Type: D2D1_HUETORGB_INPUT_COLOR_SPACE
|
||||
//
|
||||
D2D1_HUETORGB_PROP_INPUT_COLOR_SPACE = 0,
|
||||
D2D1_HUETORGB_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_HUETORGB_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_HUETORGB_INPUT_COLOR_SPACE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_HUETORGB_INPUT_COLOR_SPACE
|
||||
{
|
||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_VALUE = 0,
|
||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_HUE_SATURATION_LIGHTNESS = 1,
|
||||
D2D1_HUETORGB_INPUT_COLOR_SPACE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_HUETORGB_INPUT_COLOR_SPACE;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_CHROMAKEY_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Chroma Key effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_CHROMAKEY_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Color"
|
||||
// Property Type: D2D1_VECTOR_3F
|
||||
//
|
||||
D2D1_CHROMAKEY_PROP_COLOR = 0,
|
||||
|
||||
//
|
||||
// Property Name: "Tolerance"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_CHROMAKEY_PROP_TOLERANCE = 1,
|
||||
|
||||
//
|
||||
// Property Name: "InvertAlpha"
|
||||
// Property Type: BOOL
|
||||
//
|
||||
D2D1_CHROMAKEY_PROP_INVERT_ALPHA = 2,
|
||||
|
||||
//
|
||||
// Property Name: "Feather"
|
||||
// Property Type: BOOL
|
||||
//
|
||||
D2D1_CHROMAKEY_PROP_FEATHER = 3,
|
||||
D2D1_CHROMAKEY_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_CHROMAKEY_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_EMBOSS_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Emboss effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_EMBOSS_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Height"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_EMBOSS_PROP_HEIGHT = 0,
|
||||
|
||||
//
|
||||
// Property Name: "Direction"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_EMBOSS_PROP_DIRECTION = 1,
|
||||
D2D1_EMBOSS_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_EMBOSS_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_EXPOSURE_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Exposure effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_EXPOSURE_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "ExposureValue"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_EXPOSURE_PROP_EXPOSURE_VALUE = 0,
|
||||
D2D1_EXPOSURE_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_EXPOSURE_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_POSTERIZE_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Posterize effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_POSTERIZE_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "RedValueCount"
|
||||
// Property Type: UINT32
|
||||
//
|
||||
D2D1_POSTERIZE_PROP_RED_VALUE_COUNT = 0,
|
||||
|
||||
//
|
||||
// Property Name: "GreenValueCount"
|
||||
// Property Type: UINT32
|
||||
//
|
||||
D2D1_POSTERIZE_PROP_GREEN_VALUE_COUNT = 1,
|
||||
|
||||
//
|
||||
// Property Name: "BlueValueCount"
|
||||
// Property Type: UINT32
|
||||
//
|
||||
D2D1_POSTERIZE_PROP_BLUE_VALUE_COUNT = 2,
|
||||
D2D1_POSTERIZE_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_POSTERIZE_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_SEPIA_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Sepia effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_SEPIA_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Intensity"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_SEPIA_PROP_INTENSITY = 0,
|
||||
|
||||
//
|
||||
// Property Name: "AlphaMode"
|
||||
// Property Type: D2D1_ALPHA_MODE
|
||||
//
|
||||
D2D1_SEPIA_PROP_ALPHA_MODE = 1,
|
||||
D2D1_SEPIA_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_SEPIA_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_SHARPEN_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Sharpen effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_SHARPEN_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Sharpness"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_SHARPEN_PROP_SHARPNESS = 0,
|
||||
|
||||
//
|
||||
// Property Name: "Threshold"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_SHARPEN_PROP_THRESHOLD = 1,
|
||||
D2D1_SHARPEN_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_SHARPEN_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_STRAIGHTEN_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Straighten effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_STRAIGHTEN_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Angle"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_STRAIGHTEN_PROP_ANGLE = 0,
|
||||
|
||||
//
|
||||
// Property Name: "MaintainSize"
|
||||
// Property Type: BOOL
|
||||
//
|
||||
D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE = 1,
|
||||
|
||||
//
|
||||
// Property Name: "ScaleMode"
|
||||
// Property Type: D2D1_STRAIGHTEN_SCALE_MODE
|
||||
//
|
||||
D2D1_STRAIGHTEN_PROP_SCALE_MODE = 2,
|
||||
D2D1_STRAIGHTEN_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_STRAIGHTEN_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_STRAIGHTEN_SCALE_MODE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_STRAIGHTEN_SCALE_MODE
|
||||
{
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_NEAREST_NEIGHBOR = 0,
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_LINEAR = 1,
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_CUBIC = 2,
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3,
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_ANISOTROPIC = 4,
|
||||
D2D1_STRAIGHTEN_SCALE_MODE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_STRAIGHTEN_SCALE_MODE;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_TEMPERATUREANDTINT_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Temperature And Tint effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_TEMPERATUREANDTINT_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Temperature"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_TEMPERATUREANDTINT_PROP_TEMPERATURE = 0,
|
||||
|
||||
//
|
||||
// Property Name: "Tint"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_TEMPERATUREANDTINT_PROP_TINT = 1,
|
||||
D2D1_TEMPERATUREANDTINT_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_TEMPERATUREANDTINT_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_VIGNETTE_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Vignette effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_VIGNETTE_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Color"
|
||||
// Property Type: D2D1_VECTOR_4F
|
||||
//
|
||||
D2D1_VIGNETTE_PROP_COLOR = 0,
|
||||
|
||||
//
|
||||
// Property Name: "TransitionSize"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_VIGNETTE_PROP_TRANSITION_SIZE = 1,
|
||||
|
||||
//
|
||||
// Property Name: "Strength"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_VIGNETTE_PROP_STRENGTH = 2,
|
||||
D2D1_VIGNETTE_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_VIGNETTE_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_EDGEDETECTION_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Edge Detection effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_EDGEDETECTION_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Strength"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_EDGEDETECTION_PROP_STRENGTH = 0,
|
||||
|
||||
//
|
||||
// Property Name: "BlurRadius"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_EDGEDETECTION_PROP_BLUR_RADIUS = 1,
|
||||
|
||||
//
|
||||
// Property Name: "Mode"
|
||||
// Property Type: D2D1_EDGEDETECTION_MODE
|
||||
//
|
||||
D2D1_EDGEDETECTION_PROP_MODE = 2,
|
||||
|
||||
//
|
||||
// Property Name: "OverlayEdges"
|
||||
// Property Type: BOOL
|
||||
//
|
||||
D2D1_EDGEDETECTION_PROP_OVERLAY_EDGES = 3,
|
||||
|
||||
//
|
||||
// Property Name: "AlphaMode"
|
||||
// Property Type: D2D1_ALPHA_MODE
|
||||
//
|
||||
D2D1_EDGEDETECTION_PROP_ALPHA_MODE = 4,
|
||||
D2D1_EDGEDETECTION_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_EDGEDETECTION_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_EDGEDETECTION_MODE
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_EDGEDETECTION_MODE
|
||||
{
|
||||
D2D1_EDGEDETECTION_MODE_SOBEL = 0,
|
||||
D2D1_EDGEDETECTION_MODE_PREWITT = 1,
|
||||
D2D1_EDGEDETECTION_MODE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_EDGEDETECTION_MODE;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_HIGHLIGHTSANDSHADOWS_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Highlights and Shadows effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Highlights"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_HIGHLIGHTS = 0,
|
||||
|
||||
//
|
||||
// Property Name: "Shadows"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_SHADOWS = 1,
|
||||
|
||||
//
|
||||
// Property Name: "Clarity"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_CLARITY = 2,
|
||||
|
||||
//
|
||||
// Property Name: "InputGamma"
|
||||
// Property Type: D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
||||
//
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_INPUT_GAMMA = 3,
|
||||
|
||||
//
|
||||
// Property Name: "MaskBlurRadius"
|
||||
// Property Type: FLOAT
|
||||
//
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_MASK_BLUR_RADIUS = 4,
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_HIGHLIGHTSANDSHADOWS_PROP;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA
|
||||
{
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_LINEAR = 0,
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_SRGB = 1,
|
||||
D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_HIGHLIGHTSANDSHADOWS_INPUT_GAMMA;
|
||||
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_LOOKUPTABLE3D_PROP
|
||||
//
|
||||
// Synopsis:
|
||||
// The enumeration of the Lookup Table 3D effect's top level properties.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_LOOKUPTABLE3D_PROP
|
||||
{
|
||||
|
||||
//
|
||||
// Property Name: "Lut"
|
||||
// Property Type: IUnknown *
|
||||
//
|
||||
D2D1_LOOKUPTABLE3D_PROP_LUT = 0,
|
||||
|
||||
//
|
||||
// Property Name: "AlphaMode"
|
||||
// Property Type: D2D1_ALPHA_MODE
|
||||
//
|
||||
D2D1_LOOKUPTABLE3D_PROP_ALPHA_MODE = 1,
|
||||
D2D1_LOOKUPTABLE3D_PROP_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_LOOKUPTABLE3D_PROP;
|
||||
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // #ifndef _D2D1_EFFECTS_2_
|
||||
Vendored
+6819
File diff suppressed because it is too large
Load Diff
Vendored
+1793
File diff suppressed because it is too large
Load Diff
+306
@@ -0,0 +1,306 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D10_1Shader.h
|
||||
// Content: D3D10.1 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D10_1SHADER_H__
|
||||
#define __D3D10_1SHADER_H__
|
||||
|
||||
#include "d3d10shader.h"
|
||||
|
||||
#include <winapifamily.h>
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Shader debugging structures
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_REGTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_REG_INPUT,
|
||||
D3D10_SHADER_DEBUG_REG_OUTPUT,
|
||||
D3D10_SHADER_DEBUG_REG_CBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_TEMP,
|
||||
D3D10_SHADER_DEBUG_REG_TEMPARRAY,
|
||||
D3D10_SHADER_DEBUG_REG_TEXTURE,
|
||||
D3D10_SHADER_DEBUG_REG_SAMPLER,
|
||||
D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER,
|
||||
D3D10_SHADER_DEBUG_REG_LITERAL,
|
||||
D3D10_SHADER_DEBUG_REG_UNUSED,
|
||||
D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS,
|
||||
D3D11_SHADER_DEBUG_REG_UAV,
|
||||
D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_REGTYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPE_GLOBAL,
|
||||
D3D10_SHADER_DEBUG_SCOPE_BLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORLOOP,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STRUCT,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS,
|
||||
D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK,
|
||||
D3D10_SHADER_DEBUG_SCOPE_NAMESPACE,
|
||||
D3D10_SHADER_DEBUG_SCOPE_ANNOTATION,
|
||||
D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_SCOPETYPE;
|
||||
|
||||
typedef enum _D3D10_SHADER_DEBUG_VARTYPE
|
||||
{
|
||||
D3D10_SHADER_DEBUG_VAR_VARIABLE,
|
||||
D3D10_SHADER_DEBUG_VAR_FUNCTION,
|
||||
D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff,
|
||||
} D3D10_SHADER_DEBUG_VARTYPE;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// These are the serialized structures that get written to the file
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO
|
||||
{
|
||||
UINT File; // offset into file list
|
||||
UINT Line; // line #
|
||||
UINT Column; // column #
|
||||
|
||||
UINT TokenLength;
|
||||
UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore
|
||||
} D3D10_SHADER_DEBUG_TOKEN_INFO;
|
||||
|
||||
// Variable list
|
||||
typedef struct _D3D10_SHADER_DEBUG_VAR_INFO
|
||||
{
|
||||
// Index into token list for declaring identifier
|
||||
UINT TokenId;
|
||||
D3D10_SHADER_VARIABLE_TYPE Type;
|
||||
// register and component for this variable, only valid/necessary for arrays
|
||||
UINT Register;
|
||||
UINT Component;
|
||||
// gives the original variable that declared this variable
|
||||
UINT ScopeVar;
|
||||
// this variable's offset in its ScopeVar
|
||||
UINT ScopeVarOffset;
|
||||
} D3D10_SHADER_DEBUG_VAR_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO
|
||||
{
|
||||
// index into array of variables of variable to initialize
|
||||
UINT Var;
|
||||
// input, cbuffer, tbuffer
|
||||
D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet;
|
||||
// set to cbuffer or tbuffer slot, geometry shader input primitive #,
|
||||
// identifying register for indexable temp, or -1
|
||||
UINT InitialBank;
|
||||
// -1 if temp, otherwise gives register in register set
|
||||
UINT InitialRegister;
|
||||
// -1 if temp, otherwise gives component
|
||||
UINT InitialComponent;
|
||||
// initial value if literal
|
||||
UINT InitialValue;
|
||||
} D3D10_SHADER_DEBUG_INPUT_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO
|
||||
{
|
||||
// Index into variable token
|
||||
UINT TokenId;
|
||||
|
||||
D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces)
|
||||
D3D10_SHADER_VARIABLE_CLASS Class;
|
||||
UINT Rows; // number of rows (matrices)
|
||||
UINT Columns; // number of columns (vectors and matrices)
|
||||
|
||||
// In an array of structures, one struct member scope is provided, and
|
||||
// you'll have to add the array stride times the index to the variable
|
||||
// index you find, then find that variable in this structure's list of
|
||||
// variables.
|
||||
|
||||
// gives a scope to look up struct members. -1 if not a struct
|
||||
UINT StructMemberScope;
|
||||
|
||||
// number of array indices
|
||||
UINT uArrayIndices; // a[3][2][1] has 3 indices
|
||||
// maximum array index for each index
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayElements; // a[3][2][1] has {3, 2, 1}
|
||||
// how many variables each array index moves
|
||||
// offset to UINT[uArrayIndices] in UINT datastore
|
||||
UINT ArrayStrides; // a[3][2][1] has {2, 1, 1}
|
||||
|
||||
UINT uVariables;
|
||||
// index of the first variable, later variables are offsets from this one
|
||||
UINT uFirstVariable;
|
||||
} D3D10_SHADER_DEBUG_SCOPEVAR_INFO;
|
||||
|
||||
// scope data, this maps variable names to debug variables (useful for the watch window)
|
||||
typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO
|
||||
{
|
||||
D3D10_SHADER_DEBUG_SCOPETYPE ScopeType;
|
||||
UINT Name; // offset to name of scope in strings list
|
||||
UINT uNameLen; // length of name string
|
||||
UINT uVariables;
|
||||
UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list
|
||||
} D3D10_SHADER_DEBUG_SCOPE_INFO;
|
||||
|
||||
// instruction outputs
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR
|
||||
{
|
||||
// index variable being written to, if -1 it's not going to a variable
|
||||
UINT Var;
|
||||
// range data that the compiler expects to be true
|
||||
UINT uValueMin, uValueMax;
|
||||
INT iValueMin, iValueMax;
|
||||
FLOAT fValueMin, fValueMax;
|
||||
|
||||
BOOL bNaNPossible, bInfPossible;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTVAR;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO
|
||||
{
|
||||
// Only temp, indexable temp, and output are valid here
|
||||
D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet;
|
||||
// -1 means no output
|
||||
UINT OutputReg;
|
||||
// if a temp array, identifier for which one
|
||||
UINT TempArrayReg;
|
||||
// -1 means masked out
|
||||
UINT OutputComponents[4];
|
||||
D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4];
|
||||
// when indexing the output, get the value of this register, then add
|
||||
// that to uOutputReg. If uIndexReg is -1, then there is no index.
|
||||
// find the variable whose register is the sum (by looking in the ScopeVar)
|
||||
// and component matches, then set it. This should only happen for indexable
|
||||
// temps and outputs.
|
||||
UINT IndexReg;
|
||||
UINT IndexComp;
|
||||
} D3D10_SHADER_DEBUG_OUTPUTREG_INFO;
|
||||
|
||||
// per instruction data
|
||||
typedef struct _D3D10_SHADER_DEBUG_INST_INFO
|
||||
{
|
||||
UINT Id; // Which instruction this is in the bytecode
|
||||
UINT Opcode; // instruction type
|
||||
|
||||
// 0, 1, or 2
|
||||
UINT uOutputs;
|
||||
|
||||
// up to two outputs per instruction
|
||||
D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2];
|
||||
|
||||
// index into the list of tokens for this instruction's token
|
||||
UINT TokenId;
|
||||
|
||||
// how many function calls deep this instruction is
|
||||
UINT NestingLevel;
|
||||
|
||||
// list of scopes from outer-most to inner-most
|
||||
// Number of scopes
|
||||
UINT Scopes;
|
||||
UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array
|
||||
|
||||
// list of variables accessed by this instruction
|
||||
// Number of variables
|
||||
UINT AccessedVars;
|
||||
UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array
|
||||
} D3D10_SHADER_DEBUG_INST_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_FILE_INFO
|
||||
{
|
||||
UINT FileName; // Offset to LPCSTR for file name
|
||||
UINT FileNameLen; // Length of file name
|
||||
UINT FileData; // Offset to LPCSTR of length FileLen
|
||||
UINT FileLen; // Length of file
|
||||
} D3D10_SHADER_DEBUG_FILE_INFO;
|
||||
|
||||
typedef struct _D3D10_SHADER_DEBUG_INFO
|
||||
{
|
||||
UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO)
|
||||
UINT Creator; // Offset to LPCSTR for compiler version
|
||||
UINT EntrypointName; // Offset to LPCSTR for Entry point name
|
||||
UINT ShaderTarget; // Offset to LPCSTR for shader target
|
||||
UINT CompileFlags; // flags used to compile
|
||||
UINT Files; // number of included files
|
||||
UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files]
|
||||
UINT Instructions; // number of instructions
|
||||
UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions]
|
||||
UINT Variables; // number of variables
|
||||
UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables]
|
||||
UINT InputVariables; // number of variables to initialize before running
|
||||
UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables]
|
||||
UINT Tokens; // number of tokens to initialize
|
||||
UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens]
|
||||
UINT Scopes; // number of scopes
|
||||
UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes]
|
||||
UINT ScopeVariables; // number of variables declared
|
||||
UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes]
|
||||
UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset
|
||||
UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset
|
||||
} D3D10_SHADER_DEBUG_INFO;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3D10ShaderReflection1:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Interface definitions
|
||||
//
|
||||
|
||||
|
||||
typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1;
|
||||
typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1;
|
||||
|
||||
// {C3457783-A846-47CE-9520-CEA6F66E7447}
|
||||
DEFINE_GUID(IID_ID3D10ShaderReflection1,
|
||||
0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D10ShaderReflection1
|
||||
|
||||
DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetMovInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetMovcInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetConversionInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
||||
STDMETHOD(GetBitwiseInstructionCount)(THIS_ _Out_ UINT* pCount) PURE;
|
||||
|
||||
STDMETHOD(GetGSInputPrimitive)(THIS_ _Out_ D3D10_PRIMITIVE* pPrim) PURE;
|
||||
STDMETHOD(IsLevel9Shader)(THIS_ _Out_ BOOL* pbLevel9Shader) PURE;
|
||||
STDMETHOD(IsSampleFrequencyShader)(THIS_ _Out_ BOOL* pbSampleFrequency) PURE;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D10_1SHADER_H__
|
||||
|
||||
Vendored
+14586
File diff suppressed because it is too large
Load Diff
Vendored
+5222
File diff suppressed because it is too large
Load Diff
Vendored
+2721
File diff suppressed because it is too large
Load Diff
Vendored
+4817
File diff suppressed because it is too large
Load Diff
+283
@@ -0,0 +1,283 @@
|
||||
/*-------------------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
*-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 8.00.0613 */
|
||||
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 500
|
||||
#endif
|
||||
|
||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
||||
#endif
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
#ifndef __RPCNDR_H_VERSION__
|
||||
#error this stub requires an updated version of <rpcndr.h>
|
||||
#endif /* __RPCNDR_H_VERSION__ */
|
||||
|
||||
#ifndef COM_NO_WINDOWS_H
|
||||
#include "windows.h"
|
||||
#include "ole2.h"
|
||||
#endif /*COM_NO_WINDOWS_H*/
|
||||
|
||||
#ifndef __d3d11on12_h__
|
||||
#define __d3d11on12_h__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifndef __ID3D11On12Device_FWD_DEFINED__
|
||||
#define __ID3D11On12Device_FWD_DEFINED__
|
||||
typedef interface ID3D11On12Device ID3D11On12Device;
|
||||
|
||||
#endif /* __ID3D11On12Device_FWD_DEFINED__ */
|
||||
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
#include "d3d11.h"
|
||||
#include "d3d12.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d11on12_0000_0000 */
|
||||
/* [local] */
|
||||
|
||||
#include <winapifamily.h>
|
||||
#pragma region App Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// D3D11On12CreateDevice
|
||||
// ------------------
|
||||
//
|
||||
// pDevice
|
||||
// Specifies a pre-existing D3D12 device to use for D3D11 interop.
|
||||
// May not be NULL.
|
||||
// Flags
|
||||
// Any of those documented for D3D11CreateDeviceAndSwapChain.
|
||||
// pFeatureLevels
|
||||
// Array of any of the following:
|
||||
// D3D_FEATURE_LEVEL_12_1
|
||||
// D3D_FEATURE_LEVEL_12_0
|
||||
// D3D_FEATURE_LEVEL_11_1
|
||||
// D3D_FEATURE_LEVEL_11_0
|
||||
// D3D_FEATURE_LEVEL_10_1
|
||||
// D3D_FEATURE_LEVEL_10_0
|
||||
// D3D_FEATURE_LEVEL_9_3
|
||||
// D3D_FEATURE_LEVEL_9_2
|
||||
// D3D_FEATURE_LEVEL_9_1
|
||||
// The first feature level which is less than or equal to the
|
||||
// D3D12 device's feature level will be used to perform D3D11 validation.
|
||||
// Creation will fail if no acceptable feature levels are provided.
|
||||
// Providing NULL will default to the D3D12 device's feature level.
|
||||
// FeatureLevels
|
||||
// Size of feature levels array.
|
||||
// ppCommandQueues
|
||||
// Array of unique queues for D3D11On12 to use. Valid queue types:
|
||||
// 3D command queue.
|
||||
// Flags must be compatible with device flags, and its NodeMask must
|
||||
// be a subset of the NodeMask provided to this API.
|
||||
// NumQueues
|
||||
// Size of command queue array.
|
||||
// NodeMask
|
||||
// Which node of the D3D12 device to use. Only 1 bit may be set.
|
||||
// ppDevice
|
||||
// Pointer to returned interface. May be NULL.
|
||||
// ppImmediateContext
|
||||
// Pointer to returned interface. May be NULL.
|
||||
// pChosenFeatureLevel
|
||||
// Pointer to returned feature level. May be NULL.
|
||||
//
|
||||
// Return Values
|
||||
// Any of those documented for
|
||||
// D3D11CreateDevice
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
typedef HRESULT (WINAPI* PFN_D3D11ON12_CREATE_DEVICE)( _In_ IUnknown*, UINT,
|
||||
_In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL*, UINT FeatureLevels,
|
||||
_In_reads_opt_( NumQueues ) IUnknown* CONST*, UINT NumQueues,
|
||||
UINT, _COM_Outptr_opt_ ID3D11Device**, _COM_Outptr_opt_ ID3D11DeviceContext**,
|
||||
_Out_opt_ D3D_FEATURE_LEVEL* );
|
||||
|
||||
HRESULT WINAPI D3D11On12CreateDevice(
|
||||
_In_ IUnknown* pDevice,
|
||||
UINT Flags,
|
||||
_In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
|
||||
UINT FeatureLevels,
|
||||
_In_reads_opt_( NumQueues ) IUnknown* CONST* ppCommandQueues,
|
||||
UINT NumQueues,
|
||||
UINT NodeMask,
|
||||
_COM_Outptr_opt_ ID3D11Device** ppDevice,
|
||||
_COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext,
|
||||
_Out_opt_ D3D_FEATURE_LEVEL* pChosenFeatureLevel );
|
||||
|
||||
typedef struct D3D11_RESOURCE_FLAGS
|
||||
{
|
||||
UINT BindFlags;
|
||||
UINT MiscFlags;
|
||||
UINT CPUAccessFlags;
|
||||
UINT StructureByteStride;
|
||||
} D3D11_RESOURCE_FLAGS;
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0000_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0000_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D11On12Device_INTERFACE_DEFINED__
|
||||
#define __ID3D11On12Device_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D11On12Device */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D11On12Device;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("85611e73-70a9-490e-9614-a9e302777904")
|
||||
ID3D11On12Device : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateWrappedResource(
|
||||
_In_ IUnknown *pResource12,
|
||||
_In_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
||||
D3D12_RESOURCE_STATES InState,
|
||||
D3D12_RESOURCE_STATES OutState,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppResource11) = 0;
|
||||
|
||||
virtual void STDMETHODCALLTYPE ReleaseWrappedResources(
|
||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
||||
UINT NumResources) = 0;
|
||||
|
||||
virtual void STDMETHODCALLTYPE AcquireWrappedResources(
|
||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
||||
UINT NumResources) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D11On12DeviceVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D11On12Device * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D11On12Device * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D11On12Device * This);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateWrappedResource )(
|
||||
ID3D11On12Device * This,
|
||||
_In_ IUnknown *pResource12,
|
||||
_In_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
||||
D3D12_RESOURCE_STATES InState,
|
||||
D3D12_RESOURCE_STATES OutState,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppResource11);
|
||||
|
||||
void ( STDMETHODCALLTYPE *ReleaseWrappedResources )(
|
||||
ID3D11On12Device * This,
|
||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
||||
UINT NumResources);
|
||||
|
||||
void ( STDMETHODCALLTYPE *AcquireWrappedResources )(
|
||||
ID3D11On12Device * This,
|
||||
_In_reads_( NumResources ) ID3D11Resource *const *ppResources,
|
||||
UINT NumResources);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D11On12DeviceVtbl;
|
||||
|
||||
interface ID3D11On12Device
|
||||
{
|
||||
CONST_VTBL struct ID3D11On12DeviceVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D11On12Device_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D11On12Device_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D11On12Device_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D11On12Device_CreateWrappedResource(This,pResource12,pFlags11,InState,OutState,riid,ppResource11) \
|
||||
( (This)->lpVtbl -> CreateWrappedResource(This,pResource12,pFlags11,InState,OutState,riid,ppResource11) )
|
||||
|
||||
#define ID3D11On12Device_ReleaseWrappedResources(This,ppResources,NumResources) \
|
||||
( (This)->lpVtbl -> ReleaseWrappedResources(This,ppResources,NumResources) )
|
||||
|
||||
#define ID3D11On12Device_AcquireWrappedResources(This,ppResources,NumResources) \
|
||||
( (This)->lpVtbl -> AcquireWrappedResources(This,ppResources,NumResources) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D11On12Device_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d11on12_0000_0001 */
|
||||
/* [local] */
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
|
||||
#pragma endregion
|
||||
DEFINE_GUID(IID_ID3D11On12Device,0x85611e73,0x70a9,0x490e,0x96,0x14,0xa9,0xe3,0x02,0x77,0x79,0x04);
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0001_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d11on12_0000_0001_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+601
@@ -0,0 +1,601 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// File: D3D11Shader.h
|
||||
// Content: D3D11 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D11SHADER_H__
|
||||
#define __D3D11SHADER_H__
|
||||
|
||||
#include "d3dcommon.h"
|
||||
|
||||
|
||||
typedef enum D3D11_SHADER_VERSION_TYPE
|
||||
{
|
||||
D3D11_SHVER_PIXEL_SHADER = 0,
|
||||
D3D11_SHVER_VERTEX_SHADER = 1,
|
||||
D3D11_SHVER_GEOMETRY_SHADER = 2,
|
||||
|
||||
// D3D11 Shaders
|
||||
D3D11_SHVER_HULL_SHADER = 3,
|
||||
D3D11_SHVER_DOMAIN_SHADER = 4,
|
||||
D3D11_SHVER_COMPUTE_SHADER = 5,
|
||||
|
||||
D3D11_SHVER_RESERVED0 = 0xFFF0,
|
||||
} D3D11_SHADER_VERSION_TYPE;
|
||||
|
||||
#define D3D11_SHVER_GET_TYPE(_Version) \
|
||||
(((_Version) >> 16) & 0xffff)
|
||||
#define D3D11_SHVER_GET_MAJOR(_Version) \
|
||||
(((_Version) >> 4) & 0xf)
|
||||
#define D3D11_SHVER_GET_MINOR(_Version) \
|
||||
(((_Version) >> 0) & 0xf)
|
||||
|
||||
// Slot ID for library function return
|
||||
#define D3D_RETURN_PARAMETER_INDEX (-1)
|
||||
|
||||
typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
|
||||
|
||||
|
||||
typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR SemanticName; // Name of the semantic
|
||||
UINT SemanticIndex; // Index of the semantic
|
||||
UINT Register; // Number of member variables
|
||||
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
|
||||
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
|
||||
BYTE Mask; // Mask to indicate which components of the register
|
||||
// are used (combination of D3D10_COMPONENT_MASK values)
|
||||
BYTE ReadWriteMask; // Mask to indicate whether a given component is
|
||||
// never written (if this is an output signature) or
|
||||
// always read (if this is an input signature).
|
||||
// (combination of D3D_MASK_* values)
|
||||
UINT Stream; // Stream index
|
||||
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
|
||||
} D3D11_SIGNATURE_PARAMETER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_BUFFER_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the constant buffer
|
||||
D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
|
||||
UINT Variables; // Number of member variables
|
||||
UINT Size; // Size of CB (in bytes)
|
||||
UINT uFlags; // Buffer description flags
|
||||
} D3D11_SHADER_BUFFER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_VARIABLE_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the variable
|
||||
UINT StartOffset; // Offset in constant buffer's backing store
|
||||
UINT Size; // Size of variable (in bytes)
|
||||
UINT uFlags; // Variable flags
|
||||
LPVOID DefaultValue; // Raw pointer to default value
|
||||
UINT StartTexture; // First texture index (or -1 if no textures used)
|
||||
UINT TextureSize; // Number of texture slots possibly used.
|
||||
UINT StartSampler; // First sampler index (or -1 if no textures used)
|
||||
UINT SamplerSize; // Number of sampler slots possibly used.
|
||||
} D3D11_SHADER_VARIABLE_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_TYPE_DESC
|
||||
{
|
||||
D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
|
||||
D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
|
||||
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Elements; // Number of elements (0 if not an array)
|
||||
UINT Members; // Number of members (0 if not a structure)
|
||||
UINT Offset; // Offset from the start of structure (0 if not a structure member)
|
||||
LPCSTR Name; // Name of type, can be NULL
|
||||
} D3D11_SHADER_TYPE_DESC;
|
||||
|
||||
typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
|
||||
|
||||
typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
|
||||
|
||||
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
|
||||
|
||||
typedef struct _D3D11_SHADER_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
UINT InputParameters; // Number of parameters in the input signature
|
||||
UINT OutputParameters; // Number of parameters in the output signature
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT CutInstructionCount; // Number of cut instructions used
|
||||
UINT EmitInstructionCount; // Number of emit instructions used
|
||||
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
|
||||
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
|
||||
D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
|
||||
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
|
||||
UINT cGSInstanceCount; // Number of Geometry shader instances
|
||||
UINT cControlPoints; // Number of control points in the HS->DS stage
|
||||
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
|
||||
D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
|
||||
D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
|
||||
// instruction counts
|
||||
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
|
||||
UINT cInterlockedInstructions; // Number of interlocked instructions
|
||||
UINT cTextureStoreInstructions; // Number of texture writes
|
||||
} D3D11_SHADER_DESC;
|
||||
|
||||
typedef struct _D3D11_SHADER_INPUT_BIND_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the resource
|
||||
D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
|
||||
UINT BindPoint; // Starting bind point
|
||||
UINT BindCount; // Number of contiguous bind points (for arrays)
|
||||
|
||||
UINT uFlags; // Input binding flags
|
||||
D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
|
||||
D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
|
||||
UINT NumSamples; // Number of samples (0 if not MS texture)
|
||||
} D3D11_SHADER_INPUT_BIND_DESC;
|
||||
|
||||
#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
|
||||
#define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
|
||||
#define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
|
||||
#define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
|
||||
#define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
|
||||
#define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
|
||||
#define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
|
||||
#define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
|
||||
#define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
|
||||
|
||||
|
||||
typedef struct _D3D11_LIBRARY_DESC
|
||||
{
|
||||
LPCSTR Creator; // The name of the originator of the library.
|
||||
UINT Flags; // Compilation flags.
|
||||
UINT FunctionCount; // Number of functions exported from the library.
|
||||
} D3D11_LIBRARY_DESC;
|
||||
|
||||
typedef struct _D3D11_FUNCTION_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT MovInstructionCount; // Number of mov instructions used
|
||||
UINT MovcInstructionCount; // Number of movc instructions used
|
||||
UINT ConversionInstructionCount; // Number of type conversion instructions used
|
||||
UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
|
||||
D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
|
||||
UINT64 RequiredFeatureFlags; // Required feature flags
|
||||
|
||||
LPCSTR Name; // Function name
|
||||
INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
|
||||
BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
|
||||
BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
|
||||
BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
|
||||
} D3D11_FUNCTION_DESC;
|
||||
|
||||
typedef struct _D3D11_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR Name; // Parameter name.
|
||||
LPCSTR SemanticName; // Parameter semantic name (+index).
|
||||
D3D_SHADER_VARIABLE_TYPE Type; // Element type.
|
||||
D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
|
||||
UINT Rows; // Rows are for matrix parameters.
|
||||
UINT Columns; // Components or Columns in matrix.
|
||||
D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
|
||||
D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
|
||||
|
||||
UINT FirstInRegister; // The first input register for this parameter.
|
||||
UINT FirstInComponent; // The first input register component for this parameter.
|
||||
UINT FirstOutRegister; // The first output register for this parameter.
|
||||
UINT FirstOutComponent; // The first output register component for this parameter.
|
||||
} D3D11_PARAMETER_DESC;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Interfaces ////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType;
|
||||
typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE;
|
||||
|
||||
typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable;
|
||||
typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE;
|
||||
|
||||
typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer;
|
||||
typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER;
|
||||
|
||||
typedef interface ID3D11ShaderReflection ID3D11ShaderReflection;
|
||||
typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION;
|
||||
|
||||
typedef interface ID3D11LibraryReflection ID3D11LibraryReflection;
|
||||
typedef interface ID3D11LibraryReflection *LPD3D11LIBRARYREFLECTION;
|
||||
|
||||
typedef interface ID3D11FunctionReflection ID3D11FunctionReflection;
|
||||
typedef interface ID3D11FunctionReflection *LPD3D11FUNCTIONREFLECTION;
|
||||
|
||||
typedef interface ID3D11FunctionParameterReflection ID3D11FunctionParameterReflection;
|
||||
typedef interface ID3D11FunctionParameterReflection *LPD3D11FUNCTIONPARAMETERREFLECTION;
|
||||
|
||||
// {6E6FFA6A-9BAE-4613-A51E-91652D508C21}
|
||||
interface DECLSPEC_UUID("6E6FFA6A-9BAE-4613-A51E-91652D508C21") ID3D11ShaderReflectionType;
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionType,
|
||||
0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionType
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionType)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_TYPE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
|
||||
|
||||
STDMETHOD(IsEqual)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
|
||||
STDMETHOD(IsOfType)(THIS_ _In_ ID3D11ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D11ShaderReflectionType* pBase) PURE;
|
||||
};
|
||||
|
||||
// {51F23923-F3E5-4BD1-91CB-606177D8DB4C}
|
||||
interface DECLSPEC_UUID("51F23923-F3E5-4BD1-91CB-606177D8DB4C") ID3D11ShaderReflectionVariable;
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionVariable,
|
||||
0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionVariable
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_VARIABLE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
|
||||
};
|
||||
|
||||
// {EB62D63D-93DD-4318-8AE8-C6F83AD371B8}
|
||||
interface DECLSPEC_UUID("EB62D63D-93DD-4318-8AE8-C6F83AD371B8") ID3D11ShaderReflectionConstantBuffer;
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer,
|
||||
0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflectionConstantBuffer
|
||||
|
||||
DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
};
|
||||
|
||||
// The ID3D11ShaderReflection IID may change from SDK version to SDK version
|
||||
// if the reflection API changes. This prevents new code with the new API
|
||||
// from working with an old binary. Recompiling with the new header
|
||||
// will pick up the new IID.
|
||||
|
||||
// 8d536ca1-0cca-4956-a837-786963755584
|
||||
interface DECLSPEC_UUID("8d536ca1-0cca-4956-a837-786963755584") ID3D11ShaderReflection;
|
||||
DEFINE_GUID(IID_ID3D11ShaderReflection,
|
||||
0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ShaderReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
|
||||
_Out_ LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
|
||||
STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
|
||||
_Out_opt_ UINT* pSizeX,
|
||||
_Out_opt_ UINT* pSizeY,
|
||||
_Out_opt_ UINT* pSizeZ) PURE;
|
||||
|
||||
STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
|
||||
};
|
||||
|
||||
// {54384F1B-5B3E-4BB7-AE01-60BA3097CBB6}
|
||||
interface DECLSPEC_UUID("54384F1B-5B3E-4BB7-AE01-60BA3097CBB6") ID3D11LibraryReflection;
|
||||
DEFINE_GUID(IID_ID3D11LibraryReflection,
|
||||
0x54384f1b, 0x5b3e, 0x4bb7, 0xae, 0x1, 0x60, 0xba, 0x30, 0x97, 0xcb, 0xb6);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11LibraryReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11LibraryReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_LIBRARY_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
|
||||
};
|
||||
|
||||
// {207BCECB-D683-4A06-A8A3-9B149B9F73A4}
|
||||
interface DECLSPEC_UUID("207BCECB-D683-4A06-A8A3-9B149B9F73A4") ID3D11FunctionReflection;
|
||||
DEFINE_GUID(IID_ID3D11FunctionReflection,
|
||||
0x207bcecb, 0xd683, 0x4a06, 0xa8, 0xa3, 0x9b, 0x14, 0x9b, 0x9f, 0x73, 0xa4);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11FunctionReflection
|
||||
|
||||
DECLARE_INTERFACE(ID3D11FunctionReflection)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_FUNCTION_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
|
||||
STDMETHOD_(ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
||||
_Out_ D3D11_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
||||
|
||||
// Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
|
||||
STDMETHOD_(ID3D11FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
|
||||
};
|
||||
|
||||
// {42757488-334F-47FE-982E-1A65D08CC462}
|
||||
interface DECLSPEC_UUID("42757488-334F-47FE-982E-1A65D08CC462") ID3D11FunctionParameterReflection;
|
||||
DEFINE_GUID(IID_ID3D11FunctionParameterReflection,
|
||||
0x42757488, 0x334f, 0x47fe, 0x98, 0x2e, 0x1a, 0x65, 0xd0, 0x8c, 0xc4, 0x62);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11FunctionParameterReflection
|
||||
|
||||
DECLARE_INTERFACE(ID3D11FunctionParameterReflection)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D11_PARAMETER_DESC * pDesc) PURE;
|
||||
};
|
||||
|
||||
// {CAC701EE-80FC-4122-8242-10B39C8CEC34}
|
||||
interface DECLSPEC_UUID("CAC701EE-80FC-4122-8242-10B39C8CEC34") ID3D11Module;
|
||||
DEFINE_GUID(IID_ID3D11Module,
|
||||
0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11Module
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11Module, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Create an instance of a module for resource re-binding.
|
||||
STDMETHOD(CreateInstance)(THIS_ _In_opt_ LPCSTR pNamespace,
|
||||
_COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance) PURE;
|
||||
};
|
||||
|
||||
|
||||
// {469E07F7-045A-48D5-AA12-68A478CDF75D}
|
||||
interface DECLSPEC_UUID("469E07F7-045A-48D5-AA12-68A478CDF75D") ID3D11ModuleInstance;
|
||||
DEFINE_GUID(IID_ID3D11ModuleInstance,
|
||||
0x469e07f7, 0x45a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11ModuleInstance
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11ModuleInstance, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
//
|
||||
// Resource binding API.
|
||||
//
|
||||
STDMETHOD(BindConstantBuffer)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
|
||||
STDMETHOD(BindConstantBufferByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT cbDstOffset) PURE;
|
||||
|
||||
STDMETHOD(BindResource)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
STDMETHOD(BindResourceByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
|
||||
STDMETHOD(BindSampler)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
STDMETHOD(BindSamplerByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
|
||||
STDMETHOD(BindUnorderedAccessView)(THIS_ _In_ UINT uSrcSlot, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
STDMETHOD(BindUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pName, _In_ UINT uDstSlot, _In_ UINT uCount) PURE;
|
||||
|
||||
STDMETHOD(BindResourceAsUnorderedAccessView)(THIS_ _In_ UINT uSrcSrvSlot, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
|
||||
STDMETHOD(BindResourceAsUnorderedAccessViewByName)(THIS_ _In_ LPCSTR pSrvName, _In_ UINT uDstUavSlot, _In_ UINT uCount) PURE;
|
||||
};
|
||||
|
||||
|
||||
// {59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E}
|
||||
interface DECLSPEC_UUID("59A6CD0E-E10D-4C1F-88C0-63ABA1DAF30E") ID3D11Linker;
|
||||
DEFINE_GUID(IID_ID3D11Linker,
|
||||
0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0xe);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11Linker
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11Linker, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Link the shader and produce a shader blob suitable to D3D runtime.
|
||||
STDMETHOD(Link)(THIS_ _In_ interface ID3D11ModuleInstance * pEntry,
|
||||
_In_ LPCSTR pEntryName,
|
||||
_In_ LPCSTR pTargetName,
|
||||
_In_ UINT uFlags,
|
||||
_COM_Outptr_ ID3DBlob ** ppShaderBlob,
|
||||
_Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
||||
|
||||
// Add an instance of a library module to be used for linking.
|
||||
STDMETHOD(UseLibrary)(THIS_ _In_ interface ID3D11ModuleInstance * pLibraryMI) PURE;
|
||||
|
||||
// Add a clip plane with the plane coefficients taken from a cbuffer entry for 10L9 shaders.
|
||||
STDMETHOD(AddClipPlaneFromCBuffer)(THIS_ _In_ UINT uCBufferSlot, _In_ UINT uCBufferEntry) PURE;
|
||||
};
|
||||
|
||||
|
||||
// {D80DD70C-8D2F-4751-94A1-03C79B3556DB}
|
||||
interface DECLSPEC_UUID("D80DD70C-8D2F-4751-94A1-03C79B3556DB") ID3D11LinkingNode;
|
||||
DEFINE_GUID(IID_ID3D11LinkingNode,
|
||||
0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x3, 0xc7, 0x9b, 0x35, 0x56, 0xdb);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11LinkingNode
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11LinkingNode, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
};
|
||||
|
||||
|
||||
// {54133220-1CE8-43D3-8236-9855C5CEECFF}
|
||||
interface DECLSPEC_UUID("54133220-1CE8-43D3-8236-9855C5CEECFF") ID3D11FunctionLinkingGraph;
|
||||
DEFINE_GUID(IID_ID3D11FunctionLinkingGraph,
|
||||
0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D11FunctionLinkingGraph
|
||||
|
||||
DECLARE_INTERFACE_(ID3D11FunctionLinkingGraph, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
// Create a shader module out of FLG description.
|
||||
STDMETHOD(CreateModuleInstance)(THIS_ _COM_Outptr_ interface ID3D11ModuleInstance ** ppModuleInstance,
|
||||
_Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
||||
|
||||
STDMETHOD(SetInputSignature)(THIS_ __in_ecount(cInputParameters) const D3D11_PARAMETER_DESC * pInputParameters,
|
||||
_In_ UINT cInputParameters,
|
||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppInputNode) PURE;
|
||||
|
||||
STDMETHOD(SetOutputSignature)(THIS_ __in_ecount(cOutputParameters) const D3D11_PARAMETER_DESC * pOutputParameters,
|
||||
_In_ UINT cOutputParameters,
|
||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppOutputNode) PURE;
|
||||
|
||||
STDMETHOD(CallFunction)(THIS_ _In_opt_ LPCSTR pModuleInstanceNamespace,
|
||||
_In_ interface ID3D11Module * pModuleWithFunctionPrototype,
|
||||
_In_ LPCSTR pFunctionName,
|
||||
_COM_Outptr_ interface ID3D11LinkingNode ** ppCallNode) PURE;
|
||||
|
||||
STDMETHOD(PassValue)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
|
||||
_In_ INT SrcParameterIndex,
|
||||
_In_ interface ID3D11LinkingNode * pDstNode,
|
||||
_In_ INT DstParameterIndex) PURE;
|
||||
|
||||
STDMETHOD(PassValueWithSwizzle)(THIS_ _In_ interface ID3D11LinkingNode * pSrcNode,
|
||||
_In_ INT SrcParameterIndex,
|
||||
_In_ LPCSTR pSrcSwizzle,
|
||||
_In_ interface ID3D11LinkingNode * pDstNode,
|
||||
_In_ INT DstParameterIndex,
|
||||
_In_ LPCSTR pDstSwizzle) PURE;
|
||||
|
||||
STDMETHOD(GetLastError)(THIS_ _Always_(_Outptr_opt_result_maybenull_) ID3DBlob ** ppErrorBuffer) PURE;
|
||||
|
||||
STDMETHOD(GenerateHlsl)(THIS_ _In_ UINT uFlags, // uFlags is reserved for future use.
|
||||
_COM_Outptr_ ID3DBlob ** ppBuffer) PURE;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D11SHADER_H__
|
||||
|
||||
Vendored
+6265
File diff suppressed because it is too large
Load Diff
+1926
File diff suppressed because it is too large
Load Diff
+882
@@ -0,0 +1,882 @@
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 8.00.0613 */
|
||||
/* @@MIDL_FILE_HEADING( ) */
|
||||
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 500
|
||||
#endif
|
||||
|
||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
||||
#endif
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
#ifndef __RPCNDR_H_VERSION__
|
||||
#error this stub requires an updated version of <rpcndr.h>
|
||||
#endif /* __RPCNDR_H_VERSION__ */
|
||||
|
||||
#ifndef COM_NO_WINDOWS_H
|
||||
#include "windows.h"
|
||||
#include "ole2.h"
|
||||
#endif /*COM_NO_WINDOWS_H*/
|
||||
|
||||
#ifndef __d3dcommon_h__
|
||||
#define __d3dcommon_h__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifndef __ID3D10Blob_FWD_DEFINED__
|
||||
#define __ID3D10Blob_FWD_DEFINED__
|
||||
typedef interface ID3D10Blob ID3D10Blob;
|
||||
|
||||
#endif /* __ID3D10Blob_FWD_DEFINED__ */
|
||||
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3dcommon_0000_0000 */
|
||||
/* [local] */
|
||||
|
||||
typedef
|
||||
enum D3D_DRIVER_TYPE
|
||||
{
|
||||
D3D_DRIVER_TYPE_UNKNOWN = 0,
|
||||
D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 ) ,
|
||||
D3D_DRIVER_TYPE_REFERENCE = ( D3D_DRIVER_TYPE_HARDWARE + 1 ) ,
|
||||
D3D_DRIVER_TYPE_NULL = ( D3D_DRIVER_TYPE_REFERENCE + 1 ) ,
|
||||
D3D_DRIVER_TYPE_SOFTWARE = ( D3D_DRIVER_TYPE_NULL + 1 ) ,
|
||||
D3D_DRIVER_TYPE_WARP = ( D3D_DRIVER_TYPE_SOFTWARE + 1 )
|
||||
} D3D_DRIVER_TYPE;
|
||||
|
||||
typedef
|
||||
enum D3D_FEATURE_LEVEL
|
||||
{
|
||||
D3D_FEATURE_LEVEL_9_1 = 0x9100,
|
||||
D3D_FEATURE_LEVEL_9_2 = 0x9200,
|
||||
D3D_FEATURE_LEVEL_9_3 = 0x9300,
|
||||
D3D_FEATURE_LEVEL_10_0 = 0xa000,
|
||||
D3D_FEATURE_LEVEL_10_1 = 0xa100,
|
||||
D3D_FEATURE_LEVEL_11_0 = 0xb000,
|
||||
D3D_FEATURE_LEVEL_11_1 = 0xb100,
|
||||
D3D_FEATURE_LEVEL_12_0 = 0xc000,
|
||||
D3D_FEATURE_LEVEL_12_1 = 0xc100
|
||||
} D3D_FEATURE_LEVEL;
|
||||
|
||||
#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048
|
||||
#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096
|
||||
#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
|
||||
#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
|
||||
#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512
|
||||
#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096
|
||||
#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256
|
||||
#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2
|
||||
#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535
|
||||
#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575
|
||||
#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1
|
||||
#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4
|
||||
#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128
|
||||
#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048
|
||||
#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192
|
||||
typedef
|
||||
enum D3D_PRIMITIVE_TOPOLOGY
|
||||
{
|
||||
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
||||
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
||||
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
|
||||
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
|
||||
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
|
||||
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
|
||||
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
|
||||
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
|
||||
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
|
||||
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
|
||||
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
|
||||
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
|
||||
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
|
||||
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
|
||||
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
|
||||
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
|
||||
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
|
||||
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
|
||||
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
|
||||
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
|
||||
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
|
||||
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
|
||||
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
|
||||
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
|
||||
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
|
||||
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
|
||||
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
|
||||
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
|
||||
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
|
||||
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
|
||||
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
|
||||
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
|
||||
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
|
||||
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
|
||||
} D3D_PRIMITIVE_TOPOLOGY;
|
||||
|
||||
typedef
|
||||
enum D3D_PRIMITIVE
|
||||
{
|
||||
D3D_PRIMITIVE_UNDEFINED = 0,
|
||||
D3D_PRIMITIVE_POINT = 1,
|
||||
D3D_PRIMITIVE_LINE = 2,
|
||||
D3D_PRIMITIVE_TRIANGLE = 3,
|
||||
D3D_PRIMITIVE_LINE_ADJ = 6,
|
||||
D3D_PRIMITIVE_TRIANGLE_ADJ = 7,
|
||||
D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
|
||||
D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
|
||||
D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
|
||||
D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
|
||||
D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
|
||||
D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
|
||||
D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
|
||||
D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
|
||||
D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
|
||||
D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
|
||||
D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
|
||||
D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
|
||||
D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
|
||||
D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
|
||||
D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
|
||||
D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
|
||||
D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
|
||||
D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
|
||||
D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
|
||||
D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
|
||||
D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
|
||||
D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
|
||||
D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
|
||||
D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
|
||||
D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
|
||||
D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
|
||||
D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
|
||||
D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
|
||||
D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
|
||||
D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
|
||||
D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
|
||||
D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
|
||||
D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
||||
D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
||||
D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
||||
D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
||||
D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
||||
D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
||||
D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
||||
D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
||||
D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
||||
D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
||||
D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
||||
D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
||||
D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH
|
||||
} D3D_PRIMITIVE;
|
||||
|
||||
typedef
|
||||
enum D3D_SRV_DIMENSION
|
||||
{
|
||||
D3D_SRV_DIMENSION_UNKNOWN = 0,
|
||||
D3D_SRV_DIMENSION_BUFFER = 1,
|
||||
D3D_SRV_DIMENSION_TEXTURE1D = 2,
|
||||
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
||||
D3D_SRV_DIMENSION_TEXTURE2D = 4,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
||||
D3D_SRV_DIMENSION_TEXTURE3D = 8,
|
||||
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
|
||||
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
||||
D3D_SRV_DIMENSION_BUFFEREX = 11,
|
||||
D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
||||
D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
||||
D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX
|
||||
} D3D_SRV_DIMENSION;
|
||||
|
||||
typedef struct _D3D_SHADER_MACRO
|
||||
{
|
||||
LPCSTR Name;
|
||||
LPCSTR Definition;
|
||||
} D3D_SHADER_MACRO;
|
||||
|
||||
typedef struct _D3D_SHADER_MACRO *LPD3D_SHADER_MACRO;
|
||||
|
||||
DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D10Blob_INTERFACE_DEFINED__
|
||||
#define __ID3D10Blob_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D10Blob */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D10Blob;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("8BA5FB08-5195-40e2-AC58-0D989C3A0102")
|
||||
ID3D10Blob : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
|
||||
|
||||
virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D10BlobVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D10Blob * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D10Blob * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D10Blob * This);
|
||||
|
||||
LPVOID ( STDMETHODCALLTYPE *GetBufferPointer )(
|
||||
ID3D10Blob * This);
|
||||
|
||||
SIZE_T ( STDMETHODCALLTYPE *GetBufferSize )(
|
||||
ID3D10Blob * This);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D10BlobVtbl;
|
||||
|
||||
interface ID3D10Blob
|
||||
{
|
||||
CONST_VTBL struct ID3D10BlobVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D10Blob_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D10Blob_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D10Blob_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D10Blob_GetBufferPointer(This) \
|
||||
( (This)->lpVtbl -> GetBufferPointer(This) )
|
||||
|
||||
#define ID3D10Blob_GetBufferSize(This) \
|
||||
( (This)->lpVtbl -> GetBufferSize(This) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D10Blob_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3dcommon_0000_0001 */
|
||||
/* [local] */
|
||||
|
||||
typedef interface ID3D10Blob* LPD3D10BLOB;
|
||||
typedef ID3D10Blob ID3DBlob;
|
||||
|
||||
typedef ID3DBlob* LPD3DBLOB;
|
||||
#define IID_ID3DBlob IID_ID3D10Blob
|
||||
typedef
|
||||
enum _D3D_INCLUDE_TYPE
|
||||
{
|
||||
D3D_INCLUDE_LOCAL = 0,
|
||||
D3D_INCLUDE_SYSTEM = ( D3D_INCLUDE_LOCAL + 1 ) ,
|
||||
D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL,
|
||||
D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM,
|
||||
D3D_INCLUDE_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_INCLUDE_TYPE;
|
||||
|
||||
typedef interface ID3DInclude ID3DInclude;
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DInclude
|
||||
DECLARE_INTERFACE(ID3DInclude)
|
||||
{
|
||||
STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
|
||||
STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
|
||||
};
|
||||
typedef ID3DInclude* LPD3DINCLUDE;
|
||||
typedef
|
||||
enum _D3D_SHADER_VARIABLE_CLASS
|
||||
{
|
||||
D3D_SVC_SCALAR = 0,
|
||||
D3D_SVC_VECTOR = ( D3D_SVC_SCALAR + 1 ) ,
|
||||
D3D_SVC_MATRIX_ROWS = ( D3D_SVC_VECTOR + 1 ) ,
|
||||
D3D_SVC_MATRIX_COLUMNS = ( D3D_SVC_MATRIX_ROWS + 1 ) ,
|
||||
D3D_SVC_OBJECT = ( D3D_SVC_MATRIX_COLUMNS + 1 ) ,
|
||||
D3D_SVC_STRUCT = ( D3D_SVC_OBJECT + 1 ) ,
|
||||
D3D_SVC_INTERFACE_CLASS = ( D3D_SVC_STRUCT + 1 ) ,
|
||||
D3D_SVC_INTERFACE_POINTER = ( D3D_SVC_INTERFACE_CLASS + 1 ) ,
|
||||
D3D10_SVC_SCALAR = D3D_SVC_SCALAR,
|
||||
D3D10_SVC_VECTOR = D3D_SVC_VECTOR,
|
||||
D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS,
|
||||
D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS,
|
||||
D3D10_SVC_OBJECT = D3D_SVC_OBJECT,
|
||||
D3D10_SVC_STRUCT = D3D_SVC_STRUCT,
|
||||
D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS,
|
||||
D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER,
|
||||
D3D_SVC_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_CLASS;
|
||||
|
||||
typedef
|
||||
enum _D3D_SHADER_VARIABLE_FLAGS
|
||||
{
|
||||
D3D_SVF_USERPACKED = 1,
|
||||
D3D_SVF_USED = 2,
|
||||
D3D_SVF_INTERFACE_POINTER = 4,
|
||||
D3D_SVF_INTERFACE_PARAMETER = 8,
|
||||
D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED,
|
||||
D3D10_SVF_USED = D3D_SVF_USED,
|
||||
D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER,
|
||||
D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER,
|
||||
D3D_SVF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_FLAGS;
|
||||
|
||||
typedef
|
||||
enum _D3D_SHADER_VARIABLE_TYPE
|
||||
{
|
||||
D3D_SVT_VOID = 0,
|
||||
D3D_SVT_BOOL = 1,
|
||||
D3D_SVT_INT = 2,
|
||||
D3D_SVT_FLOAT = 3,
|
||||
D3D_SVT_STRING = 4,
|
||||
D3D_SVT_TEXTURE = 5,
|
||||
D3D_SVT_TEXTURE1D = 6,
|
||||
D3D_SVT_TEXTURE2D = 7,
|
||||
D3D_SVT_TEXTURE3D = 8,
|
||||
D3D_SVT_TEXTURECUBE = 9,
|
||||
D3D_SVT_SAMPLER = 10,
|
||||
D3D_SVT_SAMPLER1D = 11,
|
||||
D3D_SVT_SAMPLER2D = 12,
|
||||
D3D_SVT_SAMPLER3D = 13,
|
||||
D3D_SVT_SAMPLERCUBE = 14,
|
||||
D3D_SVT_PIXELSHADER = 15,
|
||||
D3D_SVT_VERTEXSHADER = 16,
|
||||
D3D_SVT_PIXELFRAGMENT = 17,
|
||||
D3D_SVT_VERTEXFRAGMENT = 18,
|
||||
D3D_SVT_UINT = 19,
|
||||
D3D_SVT_UINT8 = 20,
|
||||
D3D_SVT_GEOMETRYSHADER = 21,
|
||||
D3D_SVT_RASTERIZER = 22,
|
||||
D3D_SVT_DEPTHSTENCIL = 23,
|
||||
D3D_SVT_BLEND = 24,
|
||||
D3D_SVT_BUFFER = 25,
|
||||
D3D_SVT_CBUFFER = 26,
|
||||
D3D_SVT_TBUFFER = 27,
|
||||
D3D_SVT_TEXTURE1DARRAY = 28,
|
||||
D3D_SVT_TEXTURE2DARRAY = 29,
|
||||
D3D_SVT_RENDERTARGETVIEW = 30,
|
||||
D3D_SVT_DEPTHSTENCILVIEW = 31,
|
||||
D3D_SVT_TEXTURE2DMS = 32,
|
||||
D3D_SVT_TEXTURE2DMSARRAY = 33,
|
||||
D3D_SVT_TEXTURECUBEARRAY = 34,
|
||||
D3D_SVT_HULLSHADER = 35,
|
||||
D3D_SVT_DOMAINSHADER = 36,
|
||||
D3D_SVT_INTERFACE_POINTER = 37,
|
||||
D3D_SVT_COMPUTESHADER = 38,
|
||||
D3D_SVT_DOUBLE = 39,
|
||||
D3D_SVT_RWTEXTURE1D = 40,
|
||||
D3D_SVT_RWTEXTURE1DARRAY = 41,
|
||||
D3D_SVT_RWTEXTURE2D = 42,
|
||||
D3D_SVT_RWTEXTURE2DARRAY = 43,
|
||||
D3D_SVT_RWTEXTURE3D = 44,
|
||||
D3D_SVT_RWBUFFER = 45,
|
||||
D3D_SVT_BYTEADDRESS_BUFFER = 46,
|
||||
D3D_SVT_RWBYTEADDRESS_BUFFER = 47,
|
||||
D3D_SVT_STRUCTURED_BUFFER = 48,
|
||||
D3D_SVT_RWSTRUCTURED_BUFFER = 49,
|
||||
D3D_SVT_APPEND_STRUCTURED_BUFFER = 50,
|
||||
D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51,
|
||||
D3D_SVT_MIN8FLOAT = 52,
|
||||
D3D_SVT_MIN10FLOAT = 53,
|
||||
D3D_SVT_MIN16FLOAT = 54,
|
||||
D3D_SVT_MIN12INT = 55,
|
||||
D3D_SVT_MIN16INT = 56,
|
||||
D3D_SVT_MIN16UINT = 57,
|
||||
D3D10_SVT_VOID = D3D_SVT_VOID,
|
||||
D3D10_SVT_BOOL = D3D_SVT_BOOL,
|
||||
D3D10_SVT_INT = D3D_SVT_INT,
|
||||
D3D10_SVT_FLOAT = D3D_SVT_FLOAT,
|
||||
D3D10_SVT_STRING = D3D_SVT_STRING,
|
||||
D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE,
|
||||
D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D,
|
||||
D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D,
|
||||
D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D,
|
||||
D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE,
|
||||
D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER,
|
||||
D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D,
|
||||
D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D,
|
||||
D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D,
|
||||
D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE,
|
||||
D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER,
|
||||
D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER,
|
||||
D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT,
|
||||
D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT,
|
||||
D3D10_SVT_UINT = D3D_SVT_UINT,
|
||||
D3D10_SVT_UINT8 = D3D_SVT_UINT8,
|
||||
D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER,
|
||||
D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER,
|
||||
D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL,
|
||||
D3D10_SVT_BLEND = D3D_SVT_BLEND,
|
||||
D3D10_SVT_BUFFER = D3D_SVT_BUFFER,
|
||||
D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER,
|
||||
D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER,
|
||||
D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY,
|
||||
D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY,
|
||||
D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW,
|
||||
D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW,
|
||||
D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS,
|
||||
D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY,
|
||||
D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY,
|
||||
D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER,
|
||||
D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER,
|
||||
D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER,
|
||||
D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER,
|
||||
D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE,
|
||||
D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D,
|
||||
D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY,
|
||||
D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D,
|
||||
D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY,
|
||||
D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D,
|
||||
D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER,
|
||||
D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER,
|
||||
D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER,
|
||||
D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER,
|
||||
D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER,
|
||||
D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER,
|
||||
D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER,
|
||||
D3D_SVT_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_TYPE;
|
||||
|
||||
typedef
|
||||
enum _D3D_SHADER_INPUT_FLAGS
|
||||
{
|
||||
D3D_SIF_USERPACKED = 0x1,
|
||||
D3D_SIF_COMPARISON_SAMPLER = 0x2,
|
||||
D3D_SIF_TEXTURE_COMPONENT_0 = 0x4,
|
||||
D3D_SIF_TEXTURE_COMPONENT_1 = 0x8,
|
||||
D3D_SIF_TEXTURE_COMPONENTS = 0xc,
|
||||
D3D_SIF_UNUSED = 0x10,
|
||||
D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED,
|
||||
D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER,
|
||||
D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0,
|
||||
D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1,
|
||||
D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS,
|
||||
D3D_SIF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_INPUT_FLAGS;
|
||||
|
||||
typedef
|
||||
enum _D3D_SHADER_INPUT_TYPE
|
||||
{
|
||||
D3D_SIT_CBUFFER = 0,
|
||||
D3D_SIT_TBUFFER = ( D3D_SIT_CBUFFER + 1 ) ,
|
||||
D3D_SIT_TEXTURE = ( D3D_SIT_TBUFFER + 1 ) ,
|
||||
D3D_SIT_SAMPLER = ( D3D_SIT_TEXTURE + 1 ) ,
|
||||
D3D_SIT_UAV_RWTYPED = ( D3D_SIT_SAMPLER + 1 ) ,
|
||||
D3D_SIT_STRUCTURED = ( D3D_SIT_UAV_RWTYPED + 1 ) ,
|
||||
D3D_SIT_UAV_RWSTRUCTURED = ( D3D_SIT_STRUCTURED + 1 ) ,
|
||||
D3D_SIT_BYTEADDRESS = ( D3D_SIT_UAV_RWSTRUCTURED + 1 ) ,
|
||||
D3D_SIT_UAV_RWBYTEADDRESS = ( D3D_SIT_BYTEADDRESS + 1 ) ,
|
||||
D3D_SIT_UAV_APPEND_STRUCTURED = ( D3D_SIT_UAV_RWBYTEADDRESS + 1 ) ,
|
||||
D3D_SIT_UAV_CONSUME_STRUCTURED = ( D3D_SIT_UAV_APPEND_STRUCTURED + 1 ) ,
|
||||
D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = ( D3D_SIT_UAV_CONSUME_STRUCTURED + 1 ) ,
|
||||
D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER,
|
||||
D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER,
|
||||
D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE,
|
||||
D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER,
|
||||
D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED,
|
||||
D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED,
|
||||
D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED,
|
||||
D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS,
|
||||
D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS,
|
||||
D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED,
|
||||
D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED,
|
||||
D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER
|
||||
} D3D_SHADER_INPUT_TYPE;
|
||||
|
||||
typedef
|
||||
enum _D3D_SHADER_CBUFFER_FLAGS
|
||||
{
|
||||
D3D_CBF_USERPACKED = 1,
|
||||
D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED,
|
||||
D3D_CBF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_CBUFFER_FLAGS;
|
||||
|
||||
typedef
|
||||
enum _D3D_CBUFFER_TYPE
|
||||
{
|
||||
D3D_CT_CBUFFER = 0,
|
||||
D3D_CT_TBUFFER = ( D3D_CT_CBUFFER + 1 ) ,
|
||||
D3D_CT_INTERFACE_POINTERS = ( D3D_CT_TBUFFER + 1 ) ,
|
||||
D3D_CT_RESOURCE_BIND_INFO = ( D3D_CT_INTERFACE_POINTERS + 1 ) ,
|
||||
D3D10_CT_CBUFFER = D3D_CT_CBUFFER,
|
||||
D3D10_CT_TBUFFER = D3D_CT_TBUFFER,
|
||||
D3D11_CT_CBUFFER = D3D_CT_CBUFFER,
|
||||
D3D11_CT_TBUFFER = D3D_CT_TBUFFER,
|
||||
D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS,
|
||||
D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO
|
||||
} D3D_CBUFFER_TYPE;
|
||||
|
||||
typedef
|
||||
enum D3D_NAME
|
||||
{
|
||||
D3D_NAME_UNDEFINED = 0,
|
||||
D3D_NAME_POSITION = 1,
|
||||
D3D_NAME_CLIP_DISTANCE = 2,
|
||||
D3D_NAME_CULL_DISTANCE = 3,
|
||||
D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
|
||||
D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
|
||||
D3D_NAME_VERTEX_ID = 6,
|
||||
D3D_NAME_PRIMITIVE_ID = 7,
|
||||
D3D_NAME_INSTANCE_ID = 8,
|
||||
D3D_NAME_IS_FRONT_FACE = 9,
|
||||
D3D_NAME_SAMPLE_INDEX = 10,
|
||||
D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
|
||||
D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
|
||||
D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
|
||||
D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
|
||||
D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
|
||||
D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
|
||||
D3D_NAME_TARGET = 64,
|
||||
D3D_NAME_DEPTH = 65,
|
||||
D3D_NAME_COVERAGE = 66,
|
||||
D3D_NAME_DEPTH_GREATER_EQUAL = 67,
|
||||
D3D_NAME_DEPTH_LESS_EQUAL = 68,
|
||||
D3D_NAME_STENCIL_REF = 69,
|
||||
D3D_NAME_INNER_COVERAGE = 70,
|
||||
D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED,
|
||||
D3D10_NAME_POSITION = D3D_NAME_POSITION,
|
||||
D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE,
|
||||
D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE,
|
||||
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX,
|
||||
D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX,
|
||||
D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID,
|
||||
D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID,
|
||||
D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID,
|
||||
D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE,
|
||||
D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX,
|
||||
D3D10_NAME_TARGET = D3D_NAME_TARGET,
|
||||
D3D10_NAME_DEPTH = D3D_NAME_DEPTH,
|
||||
D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE,
|
||||
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR,
|
||||
D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL,
|
||||
D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL,
|
||||
D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF,
|
||||
D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE
|
||||
} D3D_NAME;
|
||||
|
||||
typedef
|
||||
enum D3D_RESOURCE_RETURN_TYPE
|
||||
{
|
||||
D3D_RETURN_TYPE_UNORM = 1,
|
||||
D3D_RETURN_TYPE_SNORM = 2,
|
||||
D3D_RETURN_TYPE_SINT = 3,
|
||||
D3D_RETURN_TYPE_UINT = 4,
|
||||
D3D_RETURN_TYPE_FLOAT = 5,
|
||||
D3D_RETURN_TYPE_MIXED = 6,
|
||||
D3D_RETURN_TYPE_DOUBLE = 7,
|
||||
D3D_RETURN_TYPE_CONTINUED = 8,
|
||||
D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
||||
D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
||||
D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
||||
D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
||||
D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
||||
D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
||||
D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
||||
D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
||||
D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
||||
D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
||||
D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
||||
D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
||||
D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE,
|
||||
D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED
|
||||
} D3D_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef
|
||||
enum D3D_REGISTER_COMPONENT_TYPE
|
||||
{
|
||||
D3D_REGISTER_COMPONENT_UNKNOWN = 0,
|
||||
D3D_REGISTER_COMPONENT_UINT32 = 1,
|
||||
D3D_REGISTER_COMPONENT_SINT32 = 2,
|
||||
D3D_REGISTER_COMPONENT_FLOAT32 = 3,
|
||||
D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN,
|
||||
D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32,
|
||||
D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32,
|
||||
D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32
|
||||
} D3D_REGISTER_COMPONENT_TYPE;
|
||||
|
||||
typedef
|
||||
enum D3D_TESSELLATOR_DOMAIN
|
||||
{
|
||||
D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_DOMAIN_ISOLINE = 1,
|
||||
D3D_TESSELLATOR_DOMAIN_TRI = 2,
|
||||
D3D_TESSELLATOR_DOMAIN_QUAD = 3,
|
||||
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED,
|
||||
D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE,
|
||||
D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI,
|
||||
D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD
|
||||
} D3D_TESSELLATOR_DOMAIN;
|
||||
|
||||
typedef
|
||||
enum D3D_TESSELLATOR_PARTITIONING
|
||||
{
|
||||
D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_PARTITIONING_INTEGER = 1,
|
||||
D3D_TESSELLATOR_PARTITIONING_POW2 = 2,
|
||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
|
||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
|
||||
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED,
|
||||
D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER,
|
||||
D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
|
||||
} D3D_TESSELLATOR_PARTITIONING;
|
||||
|
||||
typedef
|
||||
enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE
|
||||
{
|
||||
D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_OUTPUT_POINT = 1,
|
||||
D3D_TESSELLATOR_OUTPUT_LINE = 2,
|
||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
|
||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
|
||||
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED,
|
||||
D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT,
|
||||
D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW
|
||||
} D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
|
||||
|
||||
typedef
|
||||
enum D3D_MIN_PRECISION
|
||||
{
|
||||
D3D_MIN_PRECISION_DEFAULT = 0,
|
||||
D3D_MIN_PRECISION_FLOAT_16 = 1,
|
||||
D3D_MIN_PRECISION_FLOAT_2_8 = 2,
|
||||
D3D_MIN_PRECISION_RESERVED = 3,
|
||||
D3D_MIN_PRECISION_SINT_16 = 4,
|
||||
D3D_MIN_PRECISION_UINT_16 = 5,
|
||||
D3D_MIN_PRECISION_ANY_16 = 0xf0,
|
||||
D3D_MIN_PRECISION_ANY_10 = 0xf1
|
||||
} D3D_MIN_PRECISION;
|
||||
|
||||
typedef
|
||||
enum D3D_INTERPOLATION_MODE
|
||||
{
|
||||
D3D_INTERPOLATION_UNDEFINED = 0,
|
||||
D3D_INTERPOLATION_CONSTANT = 1,
|
||||
D3D_INTERPOLATION_LINEAR = 2,
|
||||
D3D_INTERPOLATION_LINEAR_CENTROID = 3,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5,
|
||||
D3D_INTERPOLATION_LINEAR_SAMPLE = 6,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7
|
||||
} D3D_INTERPOLATION_MODE;
|
||||
|
||||
typedef
|
||||
enum _D3D_PARAMETER_FLAGS
|
||||
{
|
||||
D3D_PF_NONE = 0,
|
||||
D3D_PF_IN = 0x1,
|
||||
D3D_PF_OUT = 0x2,
|
||||
D3D_PF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_PARAMETER_FLAGS;
|
||||
|
||||
DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);
|
||||
DEFINE_GUID(WKPDID_D3DDebugObjectNameW,0x4cca5fd8,0x921f,0x42c8,0x85,0x66,0x70,0xca,0xf2,0xa9,0xb7,0x41);
|
||||
DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2);
|
||||
#define D3D_SET_OBJECT_NAME_N_A(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectName, Chars, pName)
|
||||
#define D3D_SET_OBJECT_NAME_A(pObject, pName) D3D_SET_OBJECT_NAME_N_A(pObject, lstrlenA(pName), pName)
|
||||
#define D3D_SET_OBJECT_NAME_N_W(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectNameW, Chars*2, pName)
|
||||
#define D3D_SET_OBJECT_NAME_W(pObject, pName) D3D_SET_OBJECT_NAME_N_W(pObject, wcslen(pName), pName)
|
||||
#define D3D_COMPONENT_MASK_X 1
|
||||
#define D3D_COMPONENT_MASK_Y 2
|
||||
#define D3D_COMPONENT_MASK_Z 4
|
||||
#define D3D_COMPONENT_MASK_W 8
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Vendored
+109
@@ -0,0 +1,109 @@
|
||||
//+--------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Abstract:
|
||||
// Public API definitions for DWrite, D2D and DImage.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#ifndef DCOMMON_H_INCLUDED
|
||||
#define DCOMMON_H_INCLUDED
|
||||
|
||||
#include <dxgiformat.h>
|
||||
|
||||
#ifndef DX_DECLARE_INTERFACE
|
||||
#define DX_DECLARE_INTERFACE(x) DECLSPEC_UUID(x) DECLSPEC_NOVTABLE
|
||||
#endif
|
||||
|
||||
#ifndef CHECKMETHOD
|
||||
#define CHECKMETHOD(method) virtual DECLSPEC_NOTHROW _Must_inspect_result_ HRESULT STDMETHODCALLTYPE method
|
||||
#endif
|
||||
|
||||
//
|
||||
// Forward declarations
|
||||
//
|
||||
interface IDXGISurface;
|
||||
|
||||
//+----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// DWRITE_MEASURING_MODE
|
||||
//
|
||||
// Synopsis:
|
||||
// The measuring method used for text layout.
|
||||
//
|
||||
//-------------------------------------------------------------------------------
|
||||
typedef enum DWRITE_MEASURING_MODE
|
||||
{
|
||||
//
|
||||
// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
|
||||
//
|
||||
DWRITE_MEASURING_MODE_NATURAL,
|
||||
|
||||
//
|
||||
// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
|
||||
//
|
||||
DWRITE_MEASURING_MODE_GDI_CLASSIC,
|
||||
|
||||
//
|
||||
// Text is measured using the same glyph display metrics as text measured by GDI using a font
|
||||
// created with CLEARTYPE_NATURAL_QUALITY.
|
||||
//
|
||||
DWRITE_MEASURING_MODE_GDI_NATURAL
|
||||
|
||||
} DWRITE_MEASURING_MODE;
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Enum:
|
||||
// D2D1_ALPHA_MODE
|
||||
//
|
||||
// Synopsis:
|
||||
// Qualifies how alpha is to be treated in a bitmap or render target containing
|
||||
// alpha.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef enum D2D1_ALPHA_MODE
|
||||
{
|
||||
|
||||
//
|
||||
// Alpha mode should be determined implicitly. Some target surfaces do not supply
|
||||
// or imply this information in which case alpha must be specified.
|
||||
//
|
||||
D2D1_ALPHA_MODE_UNKNOWN = 0,
|
||||
|
||||
//
|
||||
// Treat the alpha as premultipled.
|
||||
//
|
||||
D2D1_ALPHA_MODE_PREMULTIPLIED = 1,
|
||||
|
||||
//
|
||||
// Opacity is in the 'A' component only.
|
||||
//
|
||||
D2D1_ALPHA_MODE_STRAIGHT = 2,
|
||||
|
||||
//
|
||||
// Ignore any alpha channel information.
|
||||
//
|
||||
D2D1_ALPHA_MODE_IGNORE = 3,
|
||||
|
||||
D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff
|
||||
|
||||
} D2D1_ALPHA_MODE;
|
||||
|
||||
//+-----------------------------------------------------------------------------
|
||||
//
|
||||
// Struct:
|
||||
// D2D1_PIXEL_FORMAT
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct D2D1_PIXEL_FORMAT
|
||||
{
|
||||
DXGI_FORMAT format;
|
||||
D2D1_ALPHA_MODE alphaMode;
|
||||
|
||||
} D2D1_PIXEL_FORMAT;
|
||||
|
||||
#endif /* DCOMMON_H_INCLUDED */
|
||||
Vendored
+5090
File diff suppressed because it is too large
Load Diff
Vendored
+1922
File diff suppressed because it is too large
Load Diff
Vendored
+965
@@ -0,0 +1,965 @@
|
||||
//+--------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Abstract:
|
||||
// DirectX Typography Services public API definitions.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef DWRITE_2_H_INCLUDED
|
||||
#define DWRITE_2_H_INCLUDED
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <DWrite_1.h>
|
||||
|
||||
|
||||
interface IDWriteFontFallback;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// How to align glyphs to the margin.
|
||||
/// </summary>
|
||||
enum DWRITE_OPTICAL_ALIGNMENT
|
||||
{
|
||||
/// <summary>
|
||||
/// Align to the default metrics of the glyph.
|
||||
/// </summary>
|
||||
DWRITE_OPTICAL_ALIGNMENT_NONE,
|
||||
|
||||
/// <summary>
|
||||
/// Align glyphs to the margins. Without this, some small whitespace
|
||||
/// may be present between the text and the margin from the glyph's side
|
||||
/// bearing values. Note that glyphs may still overhang outside the
|
||||
/// margin, such as flourishes or italic slants.
|
||||
/// </summary>
|
||||
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS,
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Whether to enable grid-fitting of glyph outlines (a.k.a. hinting).
|
||||
/// </summary>
|
||||
enum DWRITE_GRID_FIT_MODE
|
||||
{
|
||||
/// <summary>
|
||||
/// Choose grid fitting base on the font's gasp table information.
|
||||
/// </summary>
|
||||
DWRITE_GRID_FIT_MODE_DEFAULT,
|
||||
|
||||
/// <summary>
|
||||
/// Always disable grid fitting, using the ideal glyph outlines.
|
||||
/// </summary>
|
||||
DWRITE_GRID_FIT_MODE_DISABLED,
|
||||
|
||||
/// <summary>
|
||||
/// Enable grid fitting, adjusting glyph outlines for device pixel display.
|
||||
/// </summary>
|
||||
DWRITE_GRID_FIT_MODE_ENABLED
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Overall metrics associated with text after layout.
|
||||
/// All coordinates are in device independent pixels (DIPs).
|
||||
/// </summary>
|
||||
struct DWRITE_TEXT_METRICS1 : DWRITE_TEXT_METRICS
|
||||
{
|
||||
/// <summary>
|
||||
/// The height of the formatted text taking into account the
|
||||
/// trailing whitespace at the end of each line, which will
|
||||
/// matter for vertical reading directions.
|
||||
/// </summary>
|
||||
FLOAT heightIncludingTrailingWhitespace;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The text renderer interface represents a set of application-defined
|
||||
/// callbacks that perform rendering of text, inline objects, and decorations
|
||||
/// such as underlines.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("D3E0E934-22A0-427E-AAE4-7D9574B59DB1") IDWriteTextRenderer1 : public IDWriteTextRenderer
|
||||
{
|
||||
/// <summary>
|
||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to
|
||||
/// render a run of glyphs.
|
||||
/// </summary>
|
||||
/// <param name="clientDrawingContext">The context passed to
|
||||
/// IDWriteTextLayout::Draw.</param>
|
||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
||||
/// <param name="orientationAngle">Orientation of the glyph run.</param>
|
||||
/// <param name="measuringMode">Specifies measuring method for glyphs in
|
||||
/// the run. Renderer implementations may choose different rendering
|
||||
/// modes for given measuring methods, but best results are seen when
|
||||
/// the rendering mode matches the corresponding measuring mode:
|
||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL
|
||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC
|
||||
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL
|
||||
/// </param>
|
||||
/// <param name="glyphRun">The glyph run to draw.</param>
|
||||
/// <param name="glyphRunDescription">Properties of the characters
|
||||
/// associated with this run.</param>
|
||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// If a non-identity orientation is passed, the glyph run should be
|
||||
/// rotated around the given baseline x and y coordinates. The function
|
||||
/// IDWriteAnalyzer2::GetGlyphOrientationTransform will return the
|
||||
/// necessary transform for you, which can be combined with any existing
|
||||
/// world transform on the drawing context.
|
||||
/// </remarks>
|
||||
STDMETHOD(DrawGlyphRun)(
|
||||
_In_opt_ void* clientDrawingContext,
|
||||
FLOAT baselineOriginX,
|
||||
FLOAT baselineOriginY,
|
||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
||||
DWRITE_MEASURING_MODE measuringMode,
|
||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
||||
_In_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
|
||||
_In_opt_ IUnknown* clientDrawingEffect
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to draw
|
||||
/// an underline.
|
||||
/// </summary>
|
||||
/// <param name="clientDrawingContext">The context passed to
|
||||
/// IDWriteTextLayout::Draw.</param>
|
||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
||||
/// <param name="orientationAngle">Orientation of the underline.</param>
|
||||
/// <param name="underline">Underline logical information.</param>
|
||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// A single underline can be broken into multiple calls, depending on
|
||||
/// how the formatting changes attributes. If font sizes/styles change
|
||||
/// within an underline, the thickness and offset will be averaged
|
||||
/// weighted according to characters.
|
||||
///
|
||||
/// To get the correct top coordinate of the underline rect, add
|
||||
/// underline::offset to the baseline's Y. Otherwise the underline will
|
||||
/// be immediately under the text. The x coordinate will always be passed
|
||||
/// as the left side, regardless of text directionality. This simplifies
|
||||
/// drawing and reduces the problem of round-off that could potentially
|
||||
/// cause gaps or a double stamped alpha blend. To avoid alpha overlap,
|
||||
/// round the end points to the nearest device pixel.
|
||||
/// </remarks>
|
||||
STDMETHOD(DrawUnderline)(
|
||||
_In_opt_ void* clientDrawingContext,
|
||||
FLOAT baselineOriginX,
|
||||
FLOAT baselineOriginY,
|
||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
||||
_In_ DWRITE_UNDERLINE const* underline,
|
||||
_In_opt_ IUnknown* clientDrawingEffect
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// IDWriteTextLayout::Draw calls this function to instruct the client to draw
|
||||
/// a strikethrough.
|
||||
/// </summary>
|
||||
/// <param name="clientDrawingContext">The context passed to
|
||||
/// IDWriteTextLayout::Draw.</param>
|
||||
/// <param name="baselineOriginX">X-coordinate of the baseline.</param>
|
||||
/// <param name="baselineOriginY">Y-coordinate of the baseline.</param>
|
||||
/// <param name="orientationAngle">Orientation of the strikethrough.</param>
|
||||
/// <param name="strikethrough">Strikethrough logical information.</param>
|
||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// A single strikethrough can be broken into multiple calls, depending on
|
||||
/// how the formatting changes attributes. Strikethrough is not averaged
|
||||
/// across font sizes/styles changes.
|
||||
/// To get the correct top coordinate of the strikethrough rect,
|
||||
/// add strikethrough::offset to the baseline's Y.
|
||||
/// Like underlines, the x coordinate will always be passed as the left side,
|
||||
/// regardless of text directionality.
|
||||
/// </remarks>
|
||||
STDMETHOD(DrawStrikethrough)(
|
||||
_In_opt_ void* clientDrawingContext,
|
||||
FLOAT baselineOriginX,
|
||||
FLOAT baselineOriginY,
|
||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
||||
_In_ DWRITE_STRIKETHROUGH const* strikethrough,
|
||||
_In_opt_ IUnknown* clientDrawingEffect
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// IDWriteTextLayout::Draw calls this application callback when it needs to
|
||||
/// draw an inline object.
|
||||
/// </summary>
|
||||
/// <param name="clientDrawingContext">The context passed to
|
||||
/// IDWriteTextLayout::Draw.</param>
|
||||
/// <param name="originX">X-coordinate at the top-left corner of the
|
||||
/// inline object.</param>
|
||||
/// <param name="originY">Y-coordinate at the top-left corner of the
|
||||
/// inline object.</param>
|
||||
/// <param name="orientationAngle">Orientation of the inline object.</param>
|
||||
/// <param name="inlineObject">The object set using IDWriteTextLayout::SetInlineObject.</param>
|
||||
/// <param name="isSideways">The object should be drawn on its side.</param>
|
||||
/// <param name="isRightToLeft">The object is in an right-to-left context
|
||||
/// and should be drawn flipped.</param>
|
||||
/// <param name="clientDrawingEffect">The drawing effect set in
|
||||
/// IDWriteTextLayout::SetDrawingEffect.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// The right-to-left flag is a hint to draw the appropriate visual for
|
||||
/// that reading direction. For example, it would look strange to draw an
|
||||
/// arrow pointing to the right to indicate a submenu. The sideways flag
|
||||
/// similarly hints that the object is drawn in a different orientation.
|
||||
/// If a non-identity orientation is passed, the top left of the inline
|
||||
/// object should be rotated around the given x and y coordinates.
|
||||
/// IDWriteAnalyzer2::GetGlyphOrientationTransform returns the necessary
|
||||
/// transform for this.
|
||||
/// </remarks>
|
||||
STDMETHOD(DrawInlineObject)(
|
||||
_In_opt_ void* clientDrawingContext,
|
||||
FLOAT originX,
|
||||
FLOAT originY,
|
||||
DWRITE_GLYPH_ORIENTATION_ANGLE orientationAngle,
|
||||
_In_ IDWriteInlineObject* inlineObject,
|
||||
BOOL isSideways,
|
||||
BOOL isRightToLeft,
|
||||
_In_opt_ IUnknown* clientDrawingEffect
|
||||
) PURE;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The format of text used for text layout.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This object may not be thread-safe and it may carry the state of text format change.
|
||||
/// </remarks>
|
||||
interface DWRITE_DECLARE_INTERFACE("5F174B49-0D8B-4CFB-8BCA-F1CCE9D06C67") IDWriteTextFormat1 : public IDWriteTextFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the preferred orientation of glyphs when using a vertical reading direction.
|
||||
/// </summary>
|
||||
/// <param name="glyphOrientation">Preferred glyph orientation.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetVerticalGlyphOrientation)(
|
||||
DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get the preferred orientation of glyphs when using a vertical reading
|
||||
/// direction.
|
||||
/// </summary>
|
||||
STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Set whether or not the last word on the last line is wrapped.
|
||||
/// </summary>
|
||||
/// <param name="isLastLineWrappingEnabled">Line wrapping option.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetLastLineWrapping)(
|
||||
BOOL isLastLineWrappingEnabled
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get whether or not the last word on the last line is wrapped.
|
||||
/// </summary>
|
||||
STDMETHOD_(BOOL, GetLastLineWrapping)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Set how the glyphs align to the edges the margin. Default behavior is
|
||||
/// to align glyphs using their default glyphs metrics which include side
|
||||
/// bearings.
|
||||
/// </summary>
|
||||
/// <param name="opticalAlignment">Optical alignment option.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetOpticalAlignment)(
|
||||
DWRITE_OPTICAL_ALIGNMENT opticalAlignment
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get how the glyphs align to the edges the margin.
|
||||
/// </summary>
|
||||
STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Apply a custom font fallback onto layout. If none is specified,
|
||||
/// layout uses the system fallback list.
|
||||
/// </summary>
|
||||
/// <param name="fontFallback">Custom font fallback created from
|
||||
/// IDWriteFontFallbackBuilder::CreateFontFallback or from
|
||||
/// IDWriteFactory2::GetSystemFontFallback.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetFontFallback)(
|
||||
IDWriteFontFallback* fontFallback
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get the current font fallback object.
|
||||
/// </summary>
|
||||
STDMETHOD(GetFontFallback)(
|
||||
__out IDWriteFontFallback** fontFallback
|
||||
) PURE;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The text layout interface represents a block of text after it has
|
||||
/// been fully analyzed and formatted.
|
||||
///
|
||||
/// All coordinates are in device independent pixels (DIPs).
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("1093C18F-8D5E-43F0-B064-0917311B525E") IDWriteTextLayout2 : public IDWriteTextLayout1
|
||||
{
|
||||
/// <summary>
|
||||
/// GetMetrics retrieves overall metrics for the formatted string.
|
||||
/// </summary>
|
||||
/// <param name="textMetrics">The returned metrics.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Drawing effects like underline and strikethrough do not contribute
|
||||
/// to the text size, which is essentially the sum of advance widths and
|
||||
/// line heights. Additionally, visible swashes and other graphic
|
||||
/// adornments may extend outside the returned width and height.
|
||||
/// </remarks>
|
||||
STDMETHOD(GetMetrics)(
|
||||
_Out_ DWRITE_TEXT_METRICS1* textMetrics
|
||||
) PURE;
|
||||
|
||||
using IDWriteTextLayout::GetMetrics;
|
||||
|
||||
/// <summary>
|
||||
/// Set the preferred orientation of glyphs when using a vertical reading direction.
|
||||
/// </summary>
|
||||
/// <param name="glyphOrientation">Preferred glyph orientation.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetVerticalGlyphOrientation)(
|
||||
DWRITE_VERTICAL_GLYPH_ORIENTATION glyphOrientation
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get the preferred orientation of glyphs when using a vertical reading
|
||||
/// direction.
|
||||
/// </summary>
|
||||
STDMETHOD_(DWRITE_VERTICAL_GLYPH_ORIENTATION, GetVerticalGlyphOrientation)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Set whether or not the last word on the last line is wrapped.
|
||||
/// </summary>
|
||||
/// <param name="isLastLineWrappingEnabled">Line wrapping option.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetLastLineWrapping)(
|
||||
BOOL isLastLineWrappingEnabled
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get whether or not the last word on the last line is wrapped.
|
||||
/// </summary>
|
||||
STDMETHOD_(BOOL, GetLastLineWrapping)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Set how the glyphs align to the edges the margin. Default behavior is
|
||||
/// to align glyphs using their default glyphs metrics which include side
|
||||
/// bearings.
|
||||
/// </summary>
|
||||
/// <param name="opticalAlignment">Optical alignment option.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetOpticalAlignment)(
|
||||
DWRITE_OPTICAL_ALIGNMENT opticalAlignment
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get how the glyphs align to the edges the margin.
|
||||
/// </summary>
|
||||
STDMETHOD_(DWRITE_OPTICAL_ALIGNMENT, GetOpticalAlignment)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Apply a custom font fallback onto layout. If none is specified,
|
||||
/// layout uses the system fallback list.
|
||||
/// </summary>
|
||||
/// <param name="fontFallback">Custom font fallback created from
|
||||
/// IDWriteFontFallbackBuilder::CreateFontFallback or
|
||||
/// IDWriteFactory2::GetSystemFontFallback.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(SetFontFallback)(
|
||||
IDWriteFontFallback* fontFallback
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Get the current font fallback object.
|
||||
/// </summary>
|
||||
STDMETHOD(GetFontFallback)(
|
||||
__out IDWriteFontFallback** fontFallback
|
||||
) PURE;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The text analyzer interface represents a set of application-defined
|
||||
/// callbacks that perform rendering of text, inline objects, and decorations
|
||||
/// such as underlines.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("553A9FF3-5693-4DF7-B52B-74806F7F2EB9") IDWriteTextAnalyzer2 : public IDWriteTextAnalyzer1
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns 2x3 transform matrix for the respective angle to draw the
|
||||
/// glyph run or other object.
|
||||
/// </summary>
|
||||
/// <param name="glyphOrientationAngle">The angle reported to one of the application callbacks,
|
||||
/// including IDWriteTextAnalysisSink1::SetGlyphOrientation and IDWriteTextRenderer1::Draw*.</param>
|
||||
/// <param name="isSideways">Whether the run's glyphs are sideways or not.</param>
|
||||
/// <param name="originX">X origin of the element, be it a glyph run or underline or other.</param>
|
||||
/// <param name="originY">Y origin of the element, be it a glyph run or underline or other.</param>
|
||||
/// <param name="transform">Returned transform.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// This rotates around the given origin x and y, returning a translation component
|
||||
/// such that the glyph run, text decoration, or inline object is drawn with the
|
||||
/// right orientation at the expected coordinate.
|
||||
/// </remarks>
|
||||
STDMETHOD(GetGlyphOrientationTransform)(
|
||||
DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle,
|
||||
BOOL isSideways,
|
||||
FLOAT originX,
|
||||
FLOAT originY,
|
||||
_Out_ DWRITE_MATRIX* transform
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of typographic feature tags for the given script and language.
|
||||
/// </summary>
|
||||
/// <param name="fontFace">The font face to get features from.</param>
|
||||
/// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param>
|
||||
/// <param name="localeName">The locale to use when selecting the feature,
|
||||
/// such en-us or ja-jp.</param>
|
||||
/// <param name="maxTagCount">Maximum tag count.</param>
|
||||
/// <param name="actualTagCount">Actual tag count. If greater than
|
||||
/// maxTagCount, E_NOT_SUFFICIENT_BUFFER is returned, and the call
|
||||
/// should be retried with a larger buffer.</param>
|
||||
/// <param name="tags">Feature tag list.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(GetTypographicFeatures)(
|
||||
IDWriteFontFace* fontFace,
|
||||
DWRITE_SCRIPT_ANALYSIS scriptAnalysis,
|
||||
_In_opt_z_ WCHAR const* localeName,
|
||||
UINT32 maxTagCount,
|
||||
_Out_ UINT32* actualTagCount,
|
||||
_Out_writes_(maxTagCount) DWRITE_FONT_FEATURE_TAG* tags
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of which glyphs are affected by a given feature.
|
||||
/// </summary>
|
||||
/// <param name="fontFace">The font face to read glyph information from.</param>
|
||||
/// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param>
|
||||
/// <param name="localeName">The locale to use when selecting the feature,
|
||||
/// such en-us or ja-jp.</param>
|
||||
/// <param name="featureTag">OpenType feature name to use, which may be one
|
||||
/// of the DWRITE_FONT_FEATURE_TAG values or a custom feature using
|
||||
/// DWRITE_MAKE_OPENTYPE_TAG.</param>
|
||||
/// <param name="glyphCount">Number of glyph indices to check.</param>
|
||||
/// <param name="glyphIndices">Glyph indices to check for feature application.</param>
|
||||
/// <param name="featureApplies">Output of which glyphs are affected by the
|
||||
/// feature, where for each glyph affected, the respective array index
|
||||
/// will be 1. The result is returned per-glyph without regard to
|
||||
/// neighboring context of adjacent glyphs.</param>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(CheckTypographicFeature)(
|
||||
IDWriteFontFace* fontFace,
|
||||
DWRITE_SCRIPT_ANALYSIS scriptAnalysis,
|
||||
_In_opt_z_ WCHAR const* localeName,
|
||||
DWRITE_FONT_FEATURE_TAG featureTag,
|
||||
UINT32 glyphCount,
|
||||
_In_reads_(glyphCount) UINT16 const* glyphIndices,
|
||||
_Out_writes_(glyphCount) UINT8* featureApplies
|
||||
) PURE;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A font fallback definition used for mapping characters to fonts capable of
|
||||
/// supporting them.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("EFA008F9-F7A1-48BF-B05C-F224713CC0FF") IDWriteFontFallback : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines an appropriate font to use to render the range of text.
|
||||
/// </summary>
|
||||
/// <param name="source">The text source implementation holds the text and
|
||||
/// locale.</param>
|
||||
/// <param name="textLength">Length of the text to analyze.</param>
|
||||
/// <param name="baseFontCollection">Default font collection to use.</param>
|
||||
/// <param name="baseFont">Base font to check (optional).</param>
|
||||
/// <param name="baseFamilyName">Family name of the base font. If you pass
|
||||
/// null, no matching will be done against the family.</param>
|
||||
/// <param name="baseWeight">Desired weight.</param>
|
||||
/// <param name="baseStyle">Desired style.</param>
|
||||
/// <param name="baseStretch">Desired stretch.</param>
|
||||
/// <param name="mappedLength">Length of text mapped to the mapped font.
|
||||
/// This will always be less or equal to the input text length and
|
||||
/// greater than zero (if the text length is non-zero) so that the
|
||||
/// caller advances at least one character each call.</param>
|
||||
/// <param name="mappedFont">The font that should be used to render the
|
||||
/// first mappedLength characters of the text. If it returns NULL,
|
||||
/// then no known font can render the text, and mappedLength is the
|
||||
/// number of unsupported characters to skip.</param>
|
||||
/// <param name="scale">Scale factor to multiply the em size of the
|
||||
/// returned font by.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(MapCharacters)(
|
||||
IDWriteTextAnalysisSource* analysisSource,
|
||||
UINT32 textPosition,
|
||||
UINT32 textLength,
|
||||
_In_opt_ IDWriteFontCollection* baseFontCollection,
|
||||
_In_opt_z_ wchar_t const* baseFamilyName,
|
||||
DWRITE_FONT_WEIGHT baseWeight,
|
||||
DWRITE_FONT_STYLE baseStyle,
|
||||
DWRITE_FONT_STRETCH baseStretch,
|
||||
_Deref_out_range_(0, textLength) UINT32* mappedLength,
|
||||
_COM_Outptr_ IDWriteFont** mappedFont,
|
||||
_Out_ FLOAT* scale
|
||||
) PURE;
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builder used to create a font fallback definition by appending a series of
|
||||
/// fallback mappings, followed by a creation call.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This object may not be thread-safe.
|
||||
/// </remarks>
|
||||
interface DWRITE_DECLARE_INTERFACE("FD882D06-8ABA-4FB8-B849-8BE8B73E14DE") IDWriteFontFallbackBuilder : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Appends a single mapping to the list. Call this once for each additional mapping.
|
||||
/// </summary>
|
||||
/// <param name="ranges">Unicode ranges that apply to this mapping.</param>
|
||||
/// <param name="rangesCount">Number of Unicode ranges.</param>
|
||||
/// <param name="localeName">Locale of the context (e.g. document locale).</param>
|
||||
/// <param name="baseFamilyName">Base family name to match against, if applicable.</param>
|
||||
/// <param name="fontCollection">Explicit font collection for this mapping (optional).</param>
|
||||
/// <param name="targetFamilyNames">List of target family name strings.</param>
|
||||
/// <param name="targetFamilyNamesCount">Number of target family names.</param>
|
||||
/// <param name="scale">Scale factor to multiply the result target font by.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(AddMapping)(
|
||||
_In_reads_(rangesCount) DWRITE_UNICODE_RANGE const* ranges,
|
||||
UINT32 rangesCount,
|
||||
_In_reads_(targetFamilyNamesCount) WCHAR const** targetFamilyNames,
|
||||
UINT32 targetFamilyNamesCount,
|
||||
_In_opt_ IDWriteFontCollection* fontCollection = NULL,
|
||||
_In_opt_z_ WCHAR const* localeName = NULL,
|
||||
_In_opt_z_ WCHAR const* baseFamilyName = NULL,
|
||||
FLOAT scale = 1.0f
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Appends all the mappings from an existing font fallback object.
|
||||
/// </summary>
|
||||
/// <param name="fontFallback">Font fallback to read mappings from.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(AddMappings)(
|
||||
IDWriteFontFallback* fontFallback
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the finalized fallback object from the mappings added.
|
||||
/// </summary>
|
||||
/// <param name="fontFallback">Created fallback list.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(CreateFontFallback)(
|
||||
_COM_Outptr_ IDWriteFontFallback** fontFallback
|
||||
) PURE;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DWRITE_COLOR_F
|
||||
/// </summary>
|
||||
#ifndef D3DCOLORVALUE_DEFINED
|
||||
|
||||
typedef struct _D3DCOLORVALUE {
|
||||
union {
|
||||
FLOAT r;
|
||||
FLOAT dvR;
|
||||
};
|
||||
union {
|
||||
FLOAT g;
|
||||
FLOAT dvG;
|
||||
};
|
||||
union {
|
||||
FLOAT b;
|
||||
FLOAT dvB;
|
||||
};
|
||||
union {
|
||||
FLOAT a;
|
||||
FLOAT dvA;
|
||||
};
|
||||
} D3DCOLORVALUE;
|
||||
|
||||
#define D3DCOLORVALUE_DEFINED
|
||||
#endif D3DCOLORVALUE_DEFINED
|
||||
|
||||
typedef D3DCOLORVALUE DWRITE_COLOR_F;
|
||||
|
||||
/// <summary>
|
||||
/// The IDWriteFont interface represents a physical font in a font collection.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWriteFont2 : public IDWriteFont1
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
|
||||
/// or FALSE if not.
|
||||
/// </summary>
|
||||
STDMETHOD_(BOOL, IsColorFont)() PURE;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The interface that represents an absolute reference to a font face.
|
||||
/// It contains font face type, appropriate file references and face identification data.
|
||||
/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("d8b768ff-64bc-4e66-982b-ec8e87f693f7") IDWriteFontFace2 : public IDWriteFontFace1
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns TRUE if the font contains color information (COLR and CPAL tables),
|
||||
/// or FALSE if not.
|
||||
/// </summary>
|
||||
STDMETHOD_(BOOL, IsColorFont)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of color palettes defined by the font. The return
|
||||
/// value is zero if the font has no color information. Color fonts must
|
||||
/// have at least one palette, with palette index zero being the default.
|
||||
/// </summary>
|
||||
STDMETHOD_(UINT32, GetColorPaletteCount)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of entries in each color palette. All color palettes
|
||||
/// in a font have the same number of palette entries. The return value is
|
||||
/// zero if the font has no color information.
|
||||
/// </summary>
|
||||
STDMETHOD_(UINT32, GetPaletteEntryCount)() PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Reads color values from the font's color palette.
|
||||
/// </summary>
|
||||
/// <param name="colorPaletteIndex">Zero-based index of the color palette. If the
|
||||
/// font does not have a palette with the specified index, the method returns
|
||||
/// DWRITE_E_NOCOLOR.<param>
|
||||
/// <param name="firstEntryIndex">Zero-based index of the first palette entry
|
||||
/// to read.</param>
|
||||
/// <param name="entryCount">Number of palette entries to read.</param>
|
||||
/// <param name="paletteEntries">Array that receives the color values.<param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// The return value is E_INVALIDARG if firstEntryIndex + entryCount is greater
|
||||
/// than the actual number of palette entries as returned by GetPaletteEntryCount.
|
||||
/// The return value is DWRITE_E_NOCOLOR if the font does not have a palette
|
||||
/// with the specified palette index.
|
||||
/// </returns>
|
||||
STDMETHOD(GetPaletteEntries)(
|
||||
UINT32 colorPaletteIndex,
|
||||
UINT32 firstEntryIndex,
|
||||
UINT32 entryCount,
|
||||
_Out_writes_(entryCount) DWRITE_COLOR_F* paletteEntries
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Determines the recommended text rendering and grid-fit mode to be used based on the
|
||||
/// font, size, world transform, and measuring mode.
|
||||
/// </summary>
|
||||
/// <param name="fontEmSize">Logical font size in DIPs.</param>
|
||||
/// <param name="dpiX">Number of pixels per logical inch in the horizontal direction.</param>
|
||||
/// <param name="dpiY">Number of pixels per logical inch in the vertical direction.</param>
|
||||
/// <param name="transform">Specifies the world transform.</param>
|
||||
/// <param name="outlineThreshold">Specifies the quality of the graphics system's outline rendering,
|
||||
/// affects the size threshold above which outline rendering is used.</param>
|
||||
/// <param name="measuringMode">Specifies the method used to measure during text layout. For proper
|
||||
/// glyph spacing, the function returns a rendering mode that is compatible with the specified
|
||||
/// measuring mode.</param>
|
||||
/// <param name="renderingParams">Rendering parameters object. This parameter is necessary in case the rendering parameters
|
||||
/// object overrides the rendering mode.</param>
|
||||
/// <param name="renderingMode">Receives the recommended rendering mode.</param>
|
||||
/// <param name="gridFitMode">Receives the recommended grid-fit mode.</param>
|
||||
/// <remarks>
|
||||
/// This method should be used to determine the actual rendering mode in cases where the rendering
|
||||
/// mode of the rendering params object is DWRITE_RENDERING_MODE_DEFAULT, and the actual grid-fit
|
||||
/// mode when the rendering params object is DWRITE_GRID_FIT_MODE_DEFAULT.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(GetRecommendedRenderingMode)(
|
||||
FLOAT fontEmSize,
|
||||
FLOAT dpiX,
|
||||
FLOAT dpiY,
|
||||
_In_opt_ DWRITE_MATRIX const* transform,
|
||||
BOOL isSideways,
|
||||
DWRITE_OUTLINE_THRESHOLD outlineThreshold,
|
||||
DWRITE_MEASURING_MODE measuringMode,
|
||||
_In_opt_ IDWriteRenderingParams* renderingParams,
|
||||
_Out_ DWRITE_RENDERING_MODE* renderingMode,
|
||||
_Out_ DWRITE_GRID_FIT_MODE* gridFitMode
|
||||
) PURE;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Represents a color glyph run. The IDWriteFactory2::TranslateColorGlyphRun
|
||||
/// method returns an ordered collection of color glyph runs, which can be
|
||||
/// layered on top of each other to produce a color representation of the
|
||||
/// given base glyph run.
|
||||
/// </summary>
|
||||
struct DWRITE_COLOR_GLYPH_RUN
|
||||
{
|
||||
/// <summary>
|
||||
/// Glyph run to render.
|
||||
/// </summary>
|
||||
DWRITE_GLYPH_RUN glyphRun;
|
||||
|
||||
/// <summary>
|
||||
/// Optional glyph run description.
|
||||
/// </summary>
|
||||
_Maybenull_ DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription;
|
||||
|
||||
/// <summary>
|
||||
/// Location at which to draw this glyph run.
|
||||
/// </summary>
|
||||
FLOAT baselineOriginX;
|
||||
FLOAT baselineOriginY;
|
||||
|
||||
/// <summary>
|
||||
/// Color to use for this layer, if any. This is the same color that
|
||||
/// IDWriteFontFace2::GetPaletteEntries would return for the current
|
||||
/// palette index if the paletteIndex member is less than 0xFFFF. If
|
||||
/// the paletteIndex member is 0xFFFF then there is no associated
|
||||
/// palette entry, this member is set to { 0, 0, 0, 0 }, and the client
|
||||
/// should use the current foreground brush.
|
||||
/// </summary>
|
||||
DWRITE_COLOR_F runColor;
|
||||
|
||||
/// <summary>
|
||||
/// Zero-based index of this layer's color entry in the current color
|
||||
/// palette, or 0xFFFF if this layer is to be rendered using
|
||||
/// the current foreground brush.
|
||||
/// </summary>
|
||||
UINT16 paletteIndex;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Enumerator for an ordered collection of color glyph runs.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("d31fbe17-f157-41a2-8d24-cb779e0560e8") IDWriteColorGlyphRunEnumerator : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Advances to the first or next color run. The runs are enumerated
|
||||
/// in order from back to front.
|
||||
/// </summary>
|
||||
/// <param name="hasRun">Receives TRUE if there is a current run or
|
||||
/// FALSE if the end of the sequence has been reached.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(MoveNext)(
|
||||
_Out_ BOOL* hasRun
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current color glyph run.
|
||||
/// </summary>
|
||||
/// <param name="colorGlyphRun">Receives a pointer to the color
|
||||
/// glyph run. The pointer remains valid until the next call to
|
||||
/// MoveNext or until the interface is released.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code. An error is returned if there is
|
||||
/// no current glyph run, i.e., if MoveNext has not yet been called
|
||||
/// or if the end of the sequence has been reached.
|
||||
/// </returns>
|
||||
STDMETHOD(GetCurrentRun)(
|
||||
_Outptr_ DWRITE_COLOR_GLYPH_RUN const** colorGlyphRun
|
||||
) PURE;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The interface that represents text rendering settings for glyph rasterization and filtering.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("F9D711C3-9777-40AE-87E8-3E5AF9BF0948") IDWriteRenderingParams2 : public IDWriteRenderingParams1
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the grid fitting mode.
|
||||
/// </summary>
|
||||
STDMETHOD_(DWRITE_GRID_FIT_MODE, GetGridFitMode)() PURE;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The root factory interface for all DWrite objects.
|
||||
/// </summary>
|
||||
interface DWRITE_DECLARE_INTERFACE("0439fc60-ca44-4994-8dee-3a9af7b732ec") IDWriteFactory2 : public IDWriteFactory1
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the system-appropriate font fallback mapping list.
|
||||
/// </summary>
|
||||
/// <param name="fontFallback">The system fallback list.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(GetSystemFontFallback)(
|
||||
_COM_Outptr_ IDWriteFontFallback** fontFallback
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Create a custom font fallback builder.
|
||||
/// </summary>
|
||||
/// <param name="fontFallbackBuilder">Empty font fallback builder.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(CreateFontFallbackBuilder)(
|
||||
_COM_Outptr_ IDWriteFontFallbackBuilder** fontFallbackBuilder
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Translates a glyph run to a sequence of color glyph runs, which can be
|
||||
/// rendered to produce a color representation of the original "base" run.
|
||||
/// </summary>
|
||||
/// <param name="baselineOriginX">Horizontal origin of the base glyph run in
|
||||
/// pre-transform coordinates.</param>
|
||||
/// <param name="baselineOriginY">Vertical origin of the base glyph run in
|
||||
/// pre-transform coordinates.</param>
|
||||
/// <param name="glyphRun">Pointer to the original "base" glyph run.</param>
|
||||
/// <param name="glyphRunDescription">Optional glyph run description.</param>
|
||||
/// <param name="measuringMode">Measuring mode, needed to compute the origins
|
||||
/// of each glyph.</param>
|
||||
/// <param name="worldToDeviceTransform">Matrix converting from the client's
|
||||
/// coordinate space to device coordinates (pixels), i.e., the world transform
|
||||
/// multiplied by any DPI scaling.</param>
|
||||
/// <param name="colorPaletteIndex">Zero-based index of the color palette to use.
|
||||
/// Valid indices are less than the number of palettes in the font, as returned
|
||||
/// by IDWriteFontFace2::GetColorPaletteCount.</param>
|
||||
/// <param name="colorLayers">If the function succeeds, receives a pointer
|
||||
/// to an enumerator object that can be used to obtain the color glyph runs.
|
||||
/// If the base run has no color glyphs, then the output pointer is NULL
|
||||
/// and the method returns DWRITE_E_NOCOLOR.</param>
|
||||
/// <returns>
|
||||
/// Returns DWRITE_E_NOCOLOR if the font has no color information, the base
|
||||
/// glyph run does not contain any color glyphs, or the specified color palette
|
||||
/// index is out of range. In this case, the client should render the base glyph
|
||||
/// run. Otherwise, returns a standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(TranslateColorGlyphRun)(
|
||||
FLOAT baselineOriginX,
|
||||
FLOAT baselineOriginY,
|
||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
||||
_In_opt_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
|
||||
DWRITE_MEASURING_MODE measuringMode,
|
||||
_In_opt_ DWRITE_MATRIX const* worldToDeviceTransform,
|
||||
UINT32 colorPaletteIndex,
|
||||
_COM_Outptr_ IDWriteColorGlyphRunEnumerator** colorLayers
|
||||
) PURE;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a rendering parameters object with the specified properties.
|
||||
/// </summary>
|
||||
/// <param name="gamma">The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256.</param>
|
||||
/// <param name="enhancedContrast">The amount of contrast enhancement, zero or greater.</param>
|
||||
/// <param name="clearTypeLevel">The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType).</param>
|
||||
/// <param name="pixelGeometry">The geometry of a device pixel.</param>
|
||||
/// <param name="renderingMode">Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode.</param>
|
||||
/// <param name="gridFitMode">How to grid fit glyph outlines. In most cases, this should be DWRITE_GRID_FIT_DEFAULT to automatically choose an appropriate mode.</param>
|
||||
/// <param name="renderingParams">Holds the newly created rendering parameters object, or NULL in case of failure.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(CreateCustomRenderingParams)(
|
||||
FLOAT gamma,
|
||||
FLOAT enhancedContrast,
|
||||
FLOAT grayscaleEnhancedContrast,
|
||||
FLOAT clearTypeLevel,
|
||||
DWRITE_PIXEL_GEOMETRY pixelGeometry,
|
||||
DWRITE_RENDERING_MODE renderingMode,
|
||||
DWRITE_GRID_FIT_MODE gridFitMode,
|
||||
_COM_Outptr_ IDWriteRenderingParams2** renderingParams
|
||||
) PURE;
|
||||
|
||||
using IDWriteFactory::CreateCustomRenderingParams;
|
||||
using IDWriteFactory1::CreateCustomRenderingParams;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a glyph run analysis object, which encapsulates information
|
||||
/// used to render a glyph run.
|
||||
/// </summary>
|
||||
/// <param name="glyphRun">Structure specifying the properties of the glyph run.</param>
|
||||
/// <param name="transform">Optional transform applied to the glyphs and their positions. This transform is applied after the
|
||||
/// scaling specified by the emSize and pixelsPerDip.</param>
|
||||
/// <param name="renderingMode">Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default
|
||||
/// and not outline).</param>
|
||||
/// <param name="measuringMode">Specifies the method to measure glyphs.</param>
|
||||
/// <param name="gridFitMode">How to grid-fit glyph outlines. This must be non-default.</param>
|
||||
/// <param name="baselineOriginX">Horizontal position of the baseline origin, in DIPs.</param>
|
||||
/// <param name="baselineOriginY">Vertical position of the baseline origin, in DIPs.</param>
|
||||
/// <param name="glyphRunAnalysis">Receives a pointer to the newly created object.</param>
|
||||
/// <returns>
|
||||
/// Standard HRESULT error code.
|
||||
/// </returns>
|
||||
STDMETHOD(CreateGlyphRunAnalysis)(
|
||||
_In_ DWRITE_GLYPH_RUN const* glyphRun,
|
||||
_In_opt_ DWRITE_MATRIX const* transform,
|
||||
DWRITE_RENDERING_MODE renderingMode,
|
||||
DWRITE_MEASURING_MODE measuringMode,
|
||||
DWRITE_GRID_FIT_MODE gridFitMode,
|
||||
DWRITE_TEXT_ANTIALIAS_MODE antialiasMode,
|
||||
FLOAT baselineOriginX,
|
||||
FLOAT baselineOriginY,
|
||||
_COM_Outptr_ IDWriteGlyphRunAnalysis** glyphRunAnalysis
|
||||
) PURE;
|
||||
|
||||
using IDWriteFactory::CreateGlyphRunAnalysis;
|
||||
};
|
||||
|
||||
|
||||
#endif /* DWRITE_2_H_INCLUDED */
|
||||
Vendored
+1743
File diff suppressed because it is too large
Load Diff
Vendored
+2951
File diff suppressed because it is too large
Load Diff
Vendored
+2474
File diff suppressed because it is too large
Load Diff
Vendored
+2121
File diff suppressed because it is too large
Load Diff
Vendored
+1494
File diff suppressed because it is too large
Load Diff
+137
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// Copyright (C) Microsoft. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __dxgiformat_h__
|
||||
#define __dxgiformat_h__
|
||||
|
||||
#define DXGI_FORMAT_DEFINED 1
|
||||
|
||||
typedef enum DXGI_FORMAT
|
||||
{
|
||||
DXGI_FORMAT_UNKNOWN = 0,
|
||||
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
||||
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
||||
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
||||
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
||||
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
||||
DXGI_FORMAT_R32G32B32_UINT = 7,
|
||||
DXGI_FORMAT_R32G32B32_SINT = 8,
|
||||
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
||||
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
||||
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
||||
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
||||
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
||||
DXGI_FORMAT_R32G32_FLOAT = 16,
|
||||
DXGI_FORMAT_R32G32_UINT = 17,
|
||||
DXGI_FORMAT_R32G32_SINT = 18,
|
||||
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
||||
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
||||
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
||||
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
||||
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
||||
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
||||
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
||||
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
||||
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
||||
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
||||
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
||||
DXGI_FORMAT_R16G16_FLOAT = 34,
|
||||
DXGI_FORMAT_R16G16_UNORM = 35,
|
||||
DXGI_FORMAT_R16G16_UINT = 36,
|
||||
DXGI_FORMAT_R16G16_SNORM = 37,
|
||||
DXGI_FORMAT_R16G16_SINT = 38,
|
||||
DXGI_FORMAT_R32_TYPELESS = 39,
|
||||
DXGI_FORMAT_D32_FLOAT = 40,
|
||||
DXGI_FORMAT_R32_FLOAT = 41,
|
||||
DXGI_FORMAT_R32_UINT = 42,
|
||||
DXGI_FORMAT_R32_SINT = 43,
|
||||
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
||||
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
||||
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
||||
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
||||
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
||||
DXGI_FORMAT_R8G8_UNORM = 49,
|
||||
DXGI_FORMAT_R8G8_UINT = 50,
|
||||
DXGI_FORMAT_R8G8_SNORM = 51,
|
||||
DXGI_FORMAT_R8G8_SINT = 52,
|
||||
DXGI_FORMAT_R16_TYPELESS = 53,
|
||||
DXGI_FORMAT_R16_FLOAT = 54,
|
||||
DXGI_FORMAT_D16_UNORM = 55,
|
||||
DXGI_FORMAT_R16_UNORM = 56,
|
||||
DXGI_FORMAT_R16_UINT = 57,
|
||||
DXGI_FORMAT_R16_SNORM = 58,
|
||||
DXGI_FORMAT_R16_SINT = 59,
|
||||
DXGI_FORMAT_R8_TYPELESS = 60,
|
||||
DXGI_FORMAT_R8_UNORM = 61,
|
||||
DXGI_FORMAT_R8_UINT = 62,
|
||||
DXGI_FORMAT_R8_SNORM = 63,
|
||||
DXGI_FORMAT_R8_SINT = 64,
|
||||
DXGI_FORMAT_A8_UNORM = 65,
|
||||
DXGI_FORMAT_R1_UNORM = 66,
|
||||
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
||||
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
||||
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
||||
DXGI_FORMAT_BC1_TYPELESS = 70,
|
||||
DXGI_FORMAT_BC1_UNORM = 71,
|
||||
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
||||
DXGI_FORMAT_BC2_TYPELESS = 73,
|
||||
DXGI_FORMAT_BC2_UNORM = 74,
|
||||
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
||||
DXGI_FORMAT_BC3_TYPELESS = 76,
|
||||
DXGI_FORMAT_BC3_UNORM = 77,
|
||||
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
||||
DXGI_FORMAT_BC4_TYPELESS = 79,
|
||||
DXGI_FORMAT_BC4_UNORM = 80,
|
||||
DXGI_FORMAT_BC4_SNORM = 81,
|
||||
DXGI_FORMAT_BC5_TYPELESS = 82,
|
||||
DXGI_FORMAT_BC5_UNORM = 83,
|
||||
DXGI_FORMAT_BC5_SNORM = 84,
|
||||
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
||||
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
||||
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
||||
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
||||
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
||||
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
||||
DXGI_FORMAT_BC6H_UF16 = 95,
|
||||
DXGI_FORMAT_BC6H_SF16 = 96,
|
||||
DXGI_FORMAT_BC7_TYPELESS = 97,
|
||||
DXGI_FORMAT_BC7_UNORM = 98,
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
||||
DXGI_FORMAT_AYUV = 100,
|
||||
DXGI_FORMAT_Y410 = 101,
|
||||
DXGI_FORMAT_Y416 = 102,
|
||||
DXGI_FORMAT_NV12 = 103,
|
||||
DXGI_FORMAT_P010 = 104,
|
||||
DXGI_FORMAT_P016 = 105,
|
||||
DXGI_FORMAT_420_OPAQUE = 106,
|
||||
DXGI_FORMAT_YUY2 = 107,
|
||||
DXGI_FORMAT_Y210 = 108,
|
||||
DXGI_FORMAT_Y216 = 109,
|
||||
DXGI_FORMAT_NV11 = 110,
|
||||
DXGI_FORMAT_AI44 = 111,
|
||||
DXGI_FORMAT_IA44 = 112,
|
||||
DXGI_FORMAT_P8 = 113,
|
||||
DXGI_FORMAT_A8P8 = 114,
|
||||
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
|
||||
|
||||
DXGI_FORMAT_P208 = 130,
|
||||
DXGI_FORMAT_V208 = 131,
|
||||
DXGI_FORMAT_V408 = 132,
|
||||
|
||||
|
||||
DXGI_FORMAT_FORCE_UINT = 0xffffffff
|
||||
} DXGI_FORMAT;
|
||||
|
||||
#endif // __dxgiformat_h__
|
||||
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// Copyright (C) Microsoft. All rights reserved.
|
||||
//
|
||||
#ifndef __dxgitype_h__
|
||||
#define __dxgitype_h__
|
||||
|
||||
#include "dxgiformat.h"
|
||||
|
||||
#define _FACDXGI 0x87a
|
||||
#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
|
||||
#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)
|
||||
|
||||
// DXGI error messages have moved to winerror.h
|
||||
|
||||
#define DXGI_CPU_ACCESS_NONE ( 0 )
|
||||
#define DXGI_CPU_ACCESS_DYNAMIC ( 1 )
|
||||
#define DXGI_CPU_ACCESS_READ_WRITE ( 2 )
|
||||
#define DXGI_CPU_ACCESS_SCRATCH ( 3 )
|
||||
#define DXGI_CPU_ACCESS_FIELD 15
|
||||
|
||||
|
||||
typedef struct DXGI_RGB
|
||||
{
|
||||
float Red;
|
||||
float Green;
|
||||
float Blue;
|
||||
} DXGI_RGB;
|
||||
|
||||
#ifndef D3DCOLORVALUE_DEFINED
|
||||
typedef struct _D3DCOLORVALUE {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
} D3DCOLORVALUE;
|
||||
|
||||
#define D3DCOLORVALUE_DEFINED
|
||||
#endif
|
||||
|
||||
typedef D3DCOLORVALUE DXGI_RGBA;
|
||||
|
||||
typedef struct DXGI_GAMMA_CONTROL
|
||||
{
|
||||
DXGI_RGB Scale;
|
||||
DXGI_RGB Offset;
|
||||
DXGI_RGB GammaCurve[ 1025 ];
|
||||
} DXGI_GAMMA_CONTROL;
|
||||
|
||||
typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES
|
||||
{
|
||||
BOOL ScaleAndOffsetSupported;
|
||||
float MaxConvertedValue;
|
||||
float MinConvertedValue;
|
||||
UINT NumGammaControlPoints;
|
||||
float ControlPointPositions[1025];
|
||||
} DXGI_GAMMA_CONTROL_CAPABILITIES;
|
||||
|
||||
typedef struct DXGI_RATIONAL
|
||||
{
|
||||
UINT Numerator;
|
||||
UINT Denominator;
|
||||
} DXGI_RATIONAL;
|
||||
|
||||
typedef enum DXGI_MODE_SCANLINE_ORDER
|
||||
{
|
||||
DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0,
|
||||
DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1,
|
||||
DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
|
||||
DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
|
||||
} DXGI_MODE_SCANLINE_ORDER;
|
||||
|
||||
typedef enum DXGI_MODE_SCALING
|
||||
{
|
||||
DXGI_MODE_SCALING_UNSPECIFIED = 0,
|
||||
DXGI_MODE_SCALING_CENTERED = 1,
|
||||
DXGI_MODE_SCALING_STRETCHED = 2
|
||||
} DXGI_MODE_SCALING;
|
||||
|
||||
typedef enum DXGI_MODE_ROTATION
|
||||
{
|
||||
DXGI_MODE_ROTATION_UNSPECIFIED = 0,
|
||||
DXGI_MODE_ROTATION_IDENTITY = 1,
|
||||
DXGI_MODE_ROTATION_ROTATE90 = 2,
|
||||
DXGI_MODE_ROTATION_ROTATE180 = 3,
|
||||
DXGI_MODE_ROTATION_ROTATE270 = 4
|
||||
} DXGI_MODE_ROTATION;
|
||||
|
||||
typedef struct DXGI_MODE_DESC
|
||||
{
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
DXGI_RATIONAL RefreshRate;
|
||||
DXGI_FORMAT Format;
|
||||
DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
|
||||
DXGI_MODE_SCALING Scaling;
|
||||
} DXGI_MODE_DESC;
|
||||
|
||||
// The following values are used with DXGI_SAMPLE_DESC::Quality:
|
||||
#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff
|
||||
#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe
|
||||
|
||||
typedef struct DXGI_SAMPLE_DESC
|
||||
{
|
||||
UINT Count;
|
||||
UINT Quality;
|
||||
} DXGI_SAMPLE_DESC;
|
||||
|
||||
typedef enum DXGI_COLOR_SPACE_TYPE
|
||||
{
|
||||
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
|
||||
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
|
||||
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
|
||||
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
|
||||
DXGI_COLOR_SPACE_RESERVED = 4,
|
||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
|
||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
|
||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
|
||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
|
||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
|
||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
|
||||
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
|
||||
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
|
||||
} DXGI_COLOR_SPACE_TYPE;
|
||||
|
||||
typedef struct DXGI_JPEG_DC_HUFFMAN_TABLE
|
||||
{
|
||||
BYTE CodeCounts[12];
|
||||
BYTE CodeValues[12];
|
||||
} DXGI_JPEG_DC_HUFFMAN_TABLE;
|
||||
|
||||
typedef struct DXGI_JPEG_AC_HUFFMAN_TABLE
|
||||
{
|
||||
BYTE CodeCounts[16];
|
||||
BYTE CodeValues[162];
|
||||
} DXGI_JPEG_AC_HUFFMAN_TABLE;
|
||||
|
||||
typedef struct DXGI_JPEG_QUANTIZATION_TABLE
|
||||
{
|
||||
BYTE Elements[64];
|
||||
} DXGI_JPEG_QUANTIZATION_TABLE;
|
||||
|
||||
#endif // __dxgitype_h__
|
||||
|
||||
Vendored
+1158
File diff suppressed because it is too large
Load Diff
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
Submodule 3rdparty/pugixml added at f205aaf6e1
Vendored
+6698
File diff suppressed because it is too large
Load Diff
Vendored
+3301
File diff suppressed because it is too large
Load Diff
+29
-1
@@ -11,8 +11,36 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message( FATAL_ERROR "RPCS3 can only be compiled on 64-bit platforms." )
|
||||
endif()
|
||||
|
||||
add_subdirectory( asmjit )
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
|
||||
message( FATAL_ERROR "RPCS3 requires at least gcc-5.1." )
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.1)
|
||||
message( FATAL_ERROR "RPCS3 can't be compiled with gcc-6.1, see #1691." )
|
||||
endif()
|
||||
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||
endif()
|
||||
|
||||
add_definitions(-DCMAKE_BUILD)
|
||||
|
||||
# We use libpng's static library and don't need to build the shared library and run the tests
|
||||
set(PNG_SHARED OFF CACHE BOOL "Build shared lib." FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "Build tests." FORCE)
|
||||
|
||||
# Select the version of libpng to use, default is builtin
|
||||
if (NOT USE_SYSTEM_LIBPNG)
|
||||
add_subdirectory( 3rdparty/libpng )
|
||||
endif()
|
||||
|
||||
option(VULKAN_PREBUILT "" OFF)
|
||||
|
||||
# TODO: do real installation, including copying directory structure
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
||||
add_subdirectory( Vulkan )
|
||||
add_subdirectory( rpcs3 )
|
||||
add_subdirectory( rsx_program_decompiler )
|
||||
|
||||
@@ -3,17 +3,19 @@ RPCS3
|
||||
|
||||
[](https://travis-ci.org/RPCS3/rpcs3)
|
||||
[](https://ci.appveyor.com/project/rpcs3/rpcs3/branch/master)
|
||||
[](https://scan.coverity.com/projects/3960)
|
||||
[](https://coveralls.io/r/DHrpcs3/rpcs3)
|
||||
[](https://scan.coverity.com/projects/3960)
|
||||
|
||||
An open-source PlayStation 3 emulator/debugger written in C++.
|
||||
|
||||
You can find some basic information in the [FAQ](https://github.com/DHrpcs3/rpcs3/wiki/FAQ). For discussion about this emulator and PS3 emulation please visit the [official forums](http://www.emunewz.net/forum/forumdisplay.php?fid=162).
|
||||
You can find some basic information in the [FAQ](https://github.com/RPCS3/rpcs3/wiki/FAQ). For discussion about this emulator and PS3 emulation please visit the [official forums](http://www.emunewz.net/forum/forumdisplay.php?fid=172).
|
||||
|
||||
Official Discord server: https://discord.me/RPCS3
|
||||
|
||||
Support Nekotekina on Patreon: https://www.patreon.com/Nekotekina
|
||||
|
||||
### Development
|
||||
|
||||
If you want to contribute please take a took at the [Coding Style](https://github.com/DHrpcs3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/DHrpcs3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/DHrpcs3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.
|
||||
If you want to contribute please take a look at the [Coding Style](https://github.com/RPCS3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/RPCS3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.
|
||||
|
||||
|
||||
### Dependencies
|
||||
@@ -21,27 +23,47 @@ If you want to contribute please take a took at the [Coding Style](https://githu
|
||||
__Windows__
|
||||
* [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
|
||||
* [Visual C++ Redistributable Packages for Visual Studio 2015](http://www.microsoft.com/en-us/download/details.aspx?id=48145)
|
||||
* [Cmake 3.1.0+](http://www.cmake.org/download/) (add to PATH)
|
||||
* [Python 2.7+](https://www.python.org/downloads/) (add to PATH)
|
||||
* [Cmake 3.1.0+](http://www.cmake.org/download/) (required; add to PATH)
|
||||
* [Python 3.3+](https://www.python.org/downloads/) (required; add to PATH)
|
||||
|
||||
__Linux__
|
||||
* Debian & Ubuntu: `sudo apt-get install libopenal-dev libwxgtk3.0-dev build-essential libglew-dev`
|
||||
* GCC 5.1+ or Clang 3.5.0+ ([not GCC 6.1](https://github.com/RPCS3/rpcs3/issues/1691))
|
||||
* Debian & Ubuntu: `sudo apt-get install cmake build-essential libopenal-dev libwxgtk3.0-dev libglew-dev zlib1g-dev libedit-dev libvulkan-dev git`
|
||||
* Arch: `sudo pacman -S glew openal wxgtk cmake llvm`
|
||||
|
||||
__Mac OSX__
|
||||
* Install with Homebrew: `brew install glew wxwidgets` (add `llvm36` to that list if you want to build with ppu jit)
|
||||
Mac OSX is not supported at this moment because it doesn't meet system requirements (OpenGL 4.3)
|
||||
* Xcode 6+ (tested with Xcode 6.4)
|
||||
* Install with Homebrew: `brew install glew wxwidgets`
|
||||
* Remove '-framework QuickTime' from '_ldflags' in /usr/local/bin/wx-config
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
To initialize the repository don't forget to execute `git submodule update --init` to pull the wxWidgets source.
|
||||
* __Windows__:
|
||||
Open the *.SLN* file, and press *Build* > *Rebuild Solution*.
|
||||
* __Linux & Mac OSX__:
|
||||
If you want to build with LLVM, then LLVM 3.6.2 is required.
|
||||
`cd rpcs3 && cmake CMakeLists.txt && make && cd ../` Then run with `cd bin && ./rpcs3`
|
||||
If you are on OSX and want to build with llvm don't forget to add `-DLLVM_DIR=/usr/local/opt/llvm36/lib/llvm-3.6/share/llvm/cmake` (or wherever llvm brew was installed) to cmake invocation.
|
||||
- __Windows__: </br>
|
||||
1) To initialize the repository don't forget to execute `git submodule update --init` to pull the submodules. </br>
|
||||
2) Open the *.SLN* file. </br>
|
||||
3) Build the projects in *__BUILD_BEFORE* folder: right-click on every project > *Build*. </br>
|
||||
4) Press *BUILD* > *Build Solution* or *Rebuild Solution*. </br>
|
||||
|
||||
### Support
|
||||
* [Donate by PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MPJ3S9XQXCE3G)
|
||||
- __Linux & Mac OSX__: </br>
|
||||
1) `git clone https://github.com/RPCS3/rpcs3.git` </br>
|
||||
2) `cd rpcs3/` </br>
|
||||
3) `git submodule update --init` </br>
|
||||
4) `cmake CMakeLists.txt && make GitVersion && make` </br>
|
||||
5) Run RPCS3 with `./bin/rpcs3` </br>
|
||||
|
||||
If you are on OSX and want to build with llvm don't forget to add `-DLLVM_DIR=...` (or wherever llvm brew was installed) to cmake invocation.
|
||||
|
||||
When using GDB, configure it to ignore SIGSEGV signal (`handle SIGSEGV nostop noprint`).
|
||||
|
||||
##### CMake Build Options (Linux & Mac OSX)
|
||||
|
||||
- ```-DUSE_SYSTEM_LIBPNG=ON/OFF``` (default = *OFF*) </br>
|
||||
Build against the shared libpng instead of using the builtin one. libpng 1.6+ highly recommended. Try this option if you get version conflict errors or only see black game icons.
|
||||
|
||||
- ```-DUSE_SYSTEM_FFMPEG=ON/OFF``` (default = *OFF*) </br>
|
||||
Build against the shared ffmpeg libraries instead of using the builtin patched version. Try this if the builtin version breaks the OpenGL renderer for you.
|
||||
|
||||
### License
|
||||
|
||||
Most files are licensed under the terms of GNU GPLv2 License, see LICENSE file for details. Some files may be licensed differently, check appropriate file headers for details.
|
||||
|
||||
+956
-619
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,150 @@
|
||||
#pragma once
|
||||
|
||||
#include "Atomic.h"
|
||||
#include <memory>
|
||||
|
||||
// Unfinished. Only std::default_delete will work as expected.
|
||||
template<typename T, typename D>
|
||||
class atomic_ptr_base : D
|
||||
{
|
||||
protected:
|
||||
atomic_t<T*> m_ptr;
|
||||
|
||||
constexpr atomic_ptr_base(T* ptr)
|
||||
: m_ptr(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
~atomic_ptr_base()
|
||||
{
|
||||
if (m_ptr)
|
||||
{
|
||||
(*this)(m_ptr.load());
|
||||
}
|
||||
}
|
||||
|
||||
D& get_deleter()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
const D& get_deleter() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// Simple atomic pointer with unique ownership. Draft, unfinished.
|
||||
template<typename T, typename D = std::default_delete<T>>
|
||||
class atomic_ptr final : atomic_ptr_base<T, D>
|
||||
{
|
||||
using base = atomic_ptr_base<T, D>;
|
||||
|
||||
static_assert(sizeof(T*) == sizeof(base), "atomic_ptr<> error: invalid deleter (empty class expected)");
|
||||
|
||||
public:
|
||||
constexpr atomic_ptr()
|
||||
: base(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr atomic_ptr(std::nullptr_t)
|
||||
: base(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
explicit atomic_ptr(T* ptr)
|
||||
: base(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T2, typename = std::enable_if_t<std::is_convertible<T2, T>::value>>
|
||||
atomic_ptr(std::unique_ptr<T2, D>&& ptr)
|
||||
: base(ptr.release())
|
||||
{
|
||||
}
|
||||
|
||||
atomic_ptr& operator =(std::nullptr_t)
|
||||
{
|
||||
if (T* old = base::m_ptr.exchange(nullptr))
|
||||
{
|
||||
this->get_deleter()(old);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2, typename = std::enable_if_t<std::is_convertible<T2, T>::value>>
|
||||
atomic_ptr& operator =(std::unique_ptr<T2, D>&& ptr)
|
||||
{
|
||||
if (T* old = base::m_ptr.exchange(ptr.release()))
|
||||
{
|
||||
this->get_deleter()(old);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(std::unique_ptr<T, D>& ptr)
|
||||
{
|
||||
ptr.reset(base::m_ptr.exchange(ptr.release()));
|
||||
}
|
||||
|
||||
std::add_lvalue_reference_t<T> operator *() const
|
||||
{
|
||||
return *base::m_ptr;
|
||||
}
|
||||
|
||||
T* operator ->() const
|
||||
{
|
||||
return base::m_ptr;
|
||||
}
|
||||
|
||||
T* get() const
|
||||
{
|
||||
return base::m_ptr;
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return base::m_ptr != nullptr;
|
||||
}
|
||||
|
||||
T* release() const
|
||||
{
|
||||
return base::m_ptr.exchange(0);
|
||||
}
|
||||
|
||||
void reset(T* ptr = nullptr)
|
||||
{
|
||||
if (T* old = base::m_ptr.exchange(ptr))
|
||||
{
|
||||
this->get_deleter()(old);
|
||||
}
|
||||
}
|
||||
|
||||
// Steal the pointer from `ptr`, convert old value to unique_ptr
|
||||
std::unique_ptr<T, D> exchange(std::unique_ptr<T, D>&& ptr)
|
||||
{
|
||||
return std::unique_ptr<T, D>(base::m_ptr.exchange(ptr.release()));
|
||||
}
|
||||
|
||||
// If pointer is null, steal it from `ptr`
|
||||
bool test_and_swap(std::unique_ptr<T, D>&& ptr)
|
||||
{
|
||||
if (base::m_ptr.compare_and_swap_test(nullptr, ptr.get()))
|
||||
{
|
||||
ptr.release();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename D>
|
||||
class atomic_ptr<T[], D> final : atomic_ptr_base<T[], D>
|
||||
{
|
||||
// TODO
|
||||
};
|
||||
+42
-92
@@ -1,57 +1,29 @@
|
||||
#include "stdafx.h"
|
||||
#include "rpcs3/Ini.h"
|
||||
#include "AutoPause.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Utilities/File.h"
|
||||
#include "Config.h"
|
||||
#include "Emu/System.h"
|
||||
#include "AutoPause.h"
|
||||
|
||||
using namespace Debug;
|
||||
cfg::bool_entry g_cfg_debug_autopause_syscall(cfg::root.misc, "Auto Pause at System Call");
|
||||
cfg::bool_entry g_cfg_debug_autopause_func_call(cfg::root.misc, "Auto Pause at Function Call");
|
||||
|
||||
std::unique_ptr<AutoPause> g_autopause;
|
||||
|
||||
AutoPause& AutoPause::getInstance(void)
|
||||
debug::autopause& debug::autopause::get_instance()
|
||||
{
|
||||
if (!g_autopause)
|
||||
// Use magic static
|
||||
static autopause instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
// Load Auto Pause Configuration from file "pause.bin"
|
||||
void debug::autopause::reload(void)
|
||||
{
|
||||
auto& instance = get_instance();
|
||||
|
||||
instance.m_pause_function.clear();
|
||||
instance.m_pause_syscall.clear();
|
||||
|
||||
// TODO: better format, possibly a config entry
|
||||
if (fs::file list{ fs::get_config_dir() + "pause.bin" })
|
||||
{
|
||||
g_autopause.reset(new AutoPause);
|
||||
}
|
||||
|
||||
return *g_autopause;
|
||||
}
|
||||
|
||||
//Still use binary format. Default Setting should be "disable all auto pause".
|
||||
AutoPause::AutoPause(void)
|
||||
{
|
||||
m_pause_function.reserve(16);
|
||||
m_pause_syscall.reserve(16);
|
||||
initialized = false;
|
||||
//Reload(false, false);
|
||||
Reload();
|
||||
}
|
||||
|
||||
//Notice: I would not allow to write the binary to file in this command.
|
||||
AutoPause::~AutoPause(void)
|
||||
{
|
||||
initialized = false;
|
||||
m_pause_function.clear();
|
||||
m_pause_syscall.clear();
|
||||
m_pause_function_enable = false;
|
||||
m_pause_syscall_enable = false;
|
||||
}
|
||||
|
||||
//Load Auto Pause Configuration from file "pause.bin"
|
||||
//This would be able to create in a GUI window.
|
||||
void AutoPause::Reload(void)
|
||||
{
|
||||
if (fs::is_file("pause.bin"))
|
||||
{
|
||||
m_pause_function.clear();
|
||||
m_pause_function.reserve(16);
|
||||
m_pause_syscall.clear();
|
||||
m_pause_syscall.reserve(16);
|
||||
|
||||
fs::file list("pause.bin");
|
||||
//System calls ID and Function calls ID are all u32 iirc.
|
||||
u32 num;
|
||||
size_t fmax = list.size();
|
||||
size_t fcur = 0;
|
||||
@@ -64,60 +36,38 @@ void AutoPause::Reload(void)
|
||||
|
||||
if (num < 1024)
|
||||
{
|
||||
//Less than 1024 - be regarded as a system call.
|
||||
//emplace_back may not cause reductant move/copy operation.
|
||||
m_pause_syscall.emplace_back(num);
|
||||
LOG_WARNING(HLE, "Auto Pause: Find System Call ID 0x%x", num);
|
||||
instance.m_pause_syscall.emplace(num);
|
||||
LOG_WARNING(HLE, "Set autopause at syscall %lld", num);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pause_function.emplace_back(num);
|
||||
LOG_WARNING(HLE, "Auto Pause: Find Function Call ID 0x%x", num);
|
||||
instance.m_pause_function.emplace(num);
|
||||
LOG_WARNING(HLE, "Set autopause at function 0x%08x", num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pause_syscall_enable = Ini.DBGAutoPauseSystemCall.GetValue();
|
||||
m_pause_function_enable = Ini.DBGAutoPauseFunctionCall.GetValue();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void AutoPause::TryPause(u32 code)
|
||||
bool debug::autopause::pause_syscall(u64 code)
|
||||
{
|
||||
if (code < 1024)
|
||||
if (g_cfg_debug_autopause_syscall && get_instance().m_pause_syscall.count(code) != 0)
|
||||
{
|
||||
//Would first check Enable setting. Then the list length.
|
||||
if ((!m_pause_syscall_enable)
|
||||
|| (m_pause_syscall.size() <= 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_pause_syscall.size(); ++i)
|
||||
{
|
||||
if (code == m_pause_syscall[i])
|
||||
{
|
||||
Emu.Pause();
|
||||
LOG_ERROR(HLE, "Auto Pause Triggered: System call 0x%x", code); // Used Error
|
||||
}
|
||||
}
|
||||
Emu.Pause();
|
||||
LOG_SUCCESS(HLE, "Autopause triggered at syscall %lld", code);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Well similiar.. Seperate the list caused by possible setting difference.
|
||||
if ((!m_pause_function_enable)
|
||||
|| (m_pause_function.size() <= 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_pause_function.size(); ++i)
|
||||
{
|
||||
if (code == m_pause_function[i])
|
||||
{
|
||||
Emu.Pause();
|
||||
LOG_ERROR(HLE, "Auto Pause Triggered: Function call 0x%x", code); // Used Error
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool debug::autopause::pause_function(u32 code)
|
||||
{
|
||||
if (g_cfg_debug_autopause_func_call && get_instance().m_pause_function.count(code) != 0)
|
||||
{
|
||||
Emu.Pause();
|
||||
LOG_SUCCESS(HLE, "Autopause triggered at function 0x%08x", code);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+15
-17
@@ -1,24 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
//Regarded as a Debugger Enchantment
|
||||
namespace Debug {
|
||||
//To store the pause function/call id, and let those pause there.
|
||||
//Would be with a GUI to configure those.
|
||||
struct AutoPause
|
||||
#include <unordered_set>
|
||||
|
||||
// Regarded as a Debugger Enchantment
|
||||
namespace debug
|
||||
{
|
||||
// To store the pause function/call id, and let those pause there.
|
||||
// Would be with a GUI to configure those.
|
||||
class autopause
|
||||
{
|
||||
std::vector<u32> m_pause_syscall;
|
||||
std::vector<u32> m_pause_function;
|
||||
bool initialized;
|
||||
bool m_pause_syscall_enable;
|
||||
bool m_pause_function_enable;
|
||||
std::unordered_set<u64> m_pause_syscall;
|
||||
std::unordered_set<u32> m_pause_function;
|
||||
|
||||
AutoPause();
|
||||
~AutoPause();
|
||||
static autopause& get_instance();
|
||||
public:
|
||||
static AutoPause& getInstance(void);
|
||||
|
||||
void Reload(void);
|
||||
|
||||
void TryPause(u32 code);
|
||||
static void reload();
|
||||
static bool pause_syscall(u64 code);
|
||||
static bool pause_function(u32 code);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+309
-453
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
template<typename T, uint N>
|
||||
struct bf_base
|
||||
{
|
||||
using type = T;
|
||||
using vtype = simple_t<type>;
|
||||
using utype = typename std::make_unsigned<vtype>::type;
|
||||
|
||||
// Datatype bitsize
|
||||
static constexpr uint bitmax = sizeof(T) * 8; static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds");
|
||||
|
||||
// Field bitsize
|
||||
static constexpr uint bitsize = N;
|
||||
|
||||
// Value mask
|
||||
static constexpr utype vmask = static_cast<utype>(~utype{} >> (bitmax - bitsize));
|
||||
|
||||
protected:
|
||||
type m_data;
|
||||
};
|
||||
|
||||
// Bitfield accessor (N bits from I position, 0 is LSB)
|
||||
template<typename T, uint I, uint N>
|
||||
struct bf_t : bf_base<T, N>
|
||||
{
|
||||
using type = typename bf_t::type;
|
||||
using vtype = typename bf_t::vtype;
|
||||
using utype = typename bf_t::utype;
|
||||
|
||||
// Field offset
|
||||
static constexpr uint bitpos = I; static_assert(bitpos + N <= bf_t::bitmax, "bf_t<> error: I out of bounds");
|
||||
|
||||
// Get bitmask of size N, at I pos
|
||||
static constexpr utype data_mask()
|
||||
{
|
||||
return static_cast<utype>(~utype{} >> (bf_t::bitmax - bf_t::bitsize) << bitpos);
|
||||
}
|
||||
|
||||
// Bitfield extraction helper
|
||||
template<typename T2, typename = void>
|
||||
struct extract_impl
|
||||
{
|
||||
static_assert(!sizeof(T2), "bf_t<> error: Invalid type");
|
||||
};
|
||||
|
||||
template<typename T2>
|
||||
struct extract_impl<T2, std::enable_if_t<std::is_unsigned<T2>::value>>
|
||||
{
|
||||
// Load unsigned value
|
||||
static constexpr T2 extract(const T& data)
|
||||
{
|
||||
return static_cast<T2>((static_cast<utype>(data) >> bitpos) & bf_t::vmask);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T2>
|
||||
struct extract_impl<T2, std::enable_if_t<std::is_signed<T2>::value>>
|
||||
{
|
||||
// Load signed value (sign-extended)
|
||||
static constexpr T2 extract(const T& data)
|
||||
{
|
||||
return static_cast<T2>(static_cast<vtype>(static_cast<utype>(data) << (bf_t::bitmax - bitpos - N)) >> (bf_t::bitmax - N));
|
||||
}
|
||||
};
|
||||
|
||||
// Bitfield extraction
|
||||
static constexpr vtype extract(const T& data)
|
||||
{
|
||||
return extract_impl<vtype>::extract(data);
|
||||
}
|
||||
|
||||
// Bitfield insertion
|
||||
static constexpr vtype insert(vtype value)
|
||||
{
|
||||
return static_cast<vtype>((value & bf_t::vmask) << bitpos);
|
||||
}
|
||||
|
||||
// Load bitfield value
|
||||
constexpr operator vtype() const
|
||||
{
|
||||
return extract(this->m_data);
|
||||
}
|
||||
|
||||
// Load raw data with mask applied
|
||||
constexpr T unshifted() const
|
||||
{
|
||||
return static_cast<T>(this->m_data & data_mask());
|
||||
}
|
||||
|
||||
// Optimized bool conversion (must be removed if inappropriate)
|
||||
explicit constexpr operator bool() const
|
||||
{
|
||||
return unshifted() != 0;
|
||||
}
|
||||
|
||||
// Store bitfield value
|
||||
bf_t& operator =(vtype value)
|
||||
{
|
||||
this->m_data = static_cast<vtype>((this->m_data & ~data_mask()) | insert(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
vtype operator ++(int)
|
||||
{
|
||||
utype result = *this;
|
||||
*this = static_cast<vtype>(result + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
bf_t& operator ++()
|
||||
{
|
||||
return *this = *this + 1;
|
||||
}
|
||||
|
||||
vtype operator --(int)
|
||||
{
|
||||
utype result = *this;
|
||||
*this = static_cast<vtype>(result - 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
bf_t& operator --()
|
||||
{
|
||||
return *this = *this - 1;
|
||||
}
|
||||
|
||||
bf_t& operator +=(vtype right)
|
||||
{
|
||||
return *this = *this + right;
|
||||
}
|
||||
|
||||
bf_t& operator -=(vtype right)
|
||||
{
|
||||
return *this = *this - right;
|
||||
}
|
||||
|
||||
bf_t& operator *=(vtype right)
|
||||
{
|
||||
return *this = *this * right;
|
||||
}
|
||||
|
||||
bf_t& operator &=(vtype right)
|
||||
{
|
||||
this->m_data &= static_cast<vtype>((static_cast<utype>(right) & bf_t::vmask) << bitpos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bf_t& operator |=(vtype right)
|
||||
{
|
||||
this->m_data |= static_cast<vtype>((static_cast<utype>(right) & bf_t::vmask) << bitpos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bf_t& operator ^=(vtype right)
|
||||
{
|
||||
this->m_data ^= static_cast<vtype>((static_cast<utype>(right) & bf_t::vmask) << bitpos);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// Field pack (concatenated from left to right)
|
||||
template<typename F = void, typename... Fields>
|
||||
struct cf_t : bf_base<typename F::type, F::bitsize + cf_t<Fields...>::bitsize>
|
||||
{
|
||||
using type = typename cf_t::type;
|
||||
using vtype = typename cf_t::vtype;
|
||||
using utype = typename cf_t::utype;
|
||||
|
||||
// Get disjunction of all "data" masks of concatenated values
|
||||
static constexpr vtype data_mask()
|
||||
{
|
||||
return static_cast<vtype>(F::data_mask() | cf_t<Fields...>::data_mask());
|
||||
}
|
||||
|
||||
// Extract all bitfields and concatenate
|
||||
static constexpr vtype extract(const type& data)
|
||||
{
|
||||
return static_cast<vtype>(static_cast<utype>(F::extract(data)) << cf_t<Fields...>::bitsize | cf_t<Fields...>::extract(data));
|
||||
}
|
||||
|
||||
// Split bitfields and insert them
|
||||
static constexpr vtype insert(vtype value)
|
||||
{
|
||||
return static_cast<vtype>(F::insert(value >> cf_t<Fields...>::bitsize) | cf_t<Fields...>::insert(value));
|
||||
}
|
||||
|
||||
// Load value
|
||||
constexpr operator vtype() const
|
||||
{
|
||||
return extract(this->m_data);
|
||||
}
|
||||
|
||||
// Store value
|
||||
cf_t& operator =(vtype value)
|
||||
{
|
||||
this->m_data = (this->m_data & ~data_mask()) | insert(value);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
// Empty field pack (recursion terminator)
|
||||
template<>
|
||||
struct cf_t<void>
|
||||
{
|
||||
static constexpr uint bitsize = 0;
|
||||
|
||||
static constexpr uint data_mask()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static constexpr auto extract(const T& data) -> decltype(+T())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static constexpr T insert(T value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Fixed field (provides constant values in field pack)
|
||||
template<typename T, T V, uint N>
|
||||
struct ff_t : bf_base<T, N>
|
||||
{
|
||||
using type = typename ff_t::type;
|
||||
using vtype = typename ff_t::vtype;
|
||||
|
||||
// Return constant value
|
||||
static constexpr vtype extract(const type& data)
|
||||
{
|
||||
static_assert((V & ff_t::vmask) == V, "ff_t<> error: V out of bounds");
|
||||
return V;
|
||||
}
|
||||
|
||||
// Get value
|
||||
operator vtype() const
|
||||
{
|
||||
return V;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, uint I, uint N>
|
||||
struct fmt_unveil<bf_t<T, I, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<T>>::type;
|
||||
|
||||
static inline auto get(const bf_t<T, I, N>& bf)
|
||||
{
|
||||
return fmt_unveil<type>::get(bf);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename F, typename... Fields>
|
||||
struct fmt_unveil<cf_t<F, Fields...>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<typename F::type>>::type;
|
||||
|
||||
static inline auto get(const cf_t<F, Fields...>& cf)
|
||||
{
|
||||
return fmt_unveil<type>::get(cf);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, T V, uint N>
|
||||
struct fmt_unveil<ff_t<T, V, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<T>>::type;
|
||||
|
||||
static inline auto get(const ff_t<T, V, N>& ff)
|
||||
{
|
||||
return fmt_unveil<type>::get(ff);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,285 @@
|
||||
#include "stdafx.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include "yaml-cpp/yaml.h"
|
||||
|
||||
namespace cfg
|
||||
{
|
||||
logs::channel cfg("CFG", logs::level::notice);
|
||||
|
||||
entry_base::entry_base(type _type)
|
||||
: m_type(_type)
|
||||
{
|
||||
if (_type != type::node)
|
||||
{
|
||||
fmt::throw_exception<std::logic_error>("Invalid root node" HERE);
|
||||
}
|
||||
}
|
||||
|
||||
entry_base::entry_base(type _type, node& owner, const std::string& name)
|
||||
: m_type(_type)
|
||||
{
|
||||
if (!owner.m_nodes.emplace(name, this).second)
|
||||
{
|
||||
fmt::throw_exception<std::logic_error>("Node already exists: %s" HERE, name);
|
||||
}
|
||||
}
|
||||
|
||||
entry_base& entry_base::operator[](const std::string& name) const
|
||||
{
|
||||
if (m_type == type::node)
|
||||
{
|
||||
return *static_cast<const node&>(*this).m_nodes.at(name);
|
||||
}
|
||||
|
||||
fmt::throw_exception<std::logic_error>("Invalid node type" HERE);
|
||||
}
|
||||
|
||||
entry_base& entry_base::operator[](const char* name) const
|
||||
{
|
||||
if (m_type == type::node)
|
||||
{
|
||||
return *static_cast<const node&>(*this).m_nodes.at(name);
|
||||
}
|
||||
|
||||
fmt::throw_exception<std::logic_error>("Invalid node type" HERE);
|
||||
}
|
||||
|
||||
bool entry_base::from_string(const std::string&)
|
||||
{
|
||||
fmt::throw_exception<std::logic_error>("from_string() purecall" HERE);
|
||||
}
|
||||
|
||||
bool entry_base::from_list(std::vector<std::string>&&)
|
||||
{
|
||||
fmt::throw_exception<std::logic_error>("from_list() purecall" HERE);
|
||||
}
|
||||
|
||||
// Emit YAML
|
||||
static void encode(YAML::Emitter& out, const class entry_base& rhs);
|
||||
|
||||
// Incrementally load config entries from YAML::Node.
|
||||
// The config value is preserved if the corresponding YAML node doesn't exist.
|
||||
static void decode(const YAML::Node& data, class entry_base& rhs);
|
||||
}
|
||||
|
||||
bool cfg::try_to_int64(s64* out, const std::string& value, s64 min, s64 max)
|
||||
{
|
||||
// TODO: this could be rewritten without exceptions (but it should be as safe as possible and provide logs)
|
||||
s64 result;
|
||||
std::size_t pos;
|
||||
|
||||
try
|
||||
{
|
||||
result = std::stoll(value, &pos, 0 /* Auto-detect numeric base */);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
if (out) cfg.error("cfg::try_to_int('%s'): exception: %s", value, e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pos != value.size())
|
||||
{
|
||||
if (out) cfg.error("cfg::try_to_int('%s'): unexpected characters (pos=%zu)", value, pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result < min || result > max)
|
||||
{
|
||||
if (out) cfg.error("cfg::try_to_int('%s'): out of bounds (%lld..%lld)", value, min, max);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (out) *out = result;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string<int>::format) func, const std::string& value)
|
||||
{
|
||||
for (u64 i = 0;; i++)
|
||||
{
|
||||
std::string var;
|
||||
func(var, i);
|
||||
|
||||
if (var == value)
|
||||
{
|
||||
if (out) *out = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string hex;
|
||||
fmt_class_string<u64>::format(hex, i);
|
||||
if (var == hex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
const auto val = std::stoull(value, nullptr, 0);
|
||||
|
||||
if (out) *out = val;
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> cfg::try_to_enum_list(decltype(&fmt_class_string<int>::format) func)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
||||
for (u64 i = 0;; i++)
|
||||
{
|
||||
std::string var;
|
||||
func(var, i);
|
||||
|
||||
std::string hex;
|
||||
fmt_class_string<u64>::format(hex, i);
|
||||
if (var == hex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
result.emplace_back(std::move(var));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void cfg::encode(YAML::Emitter& out, const cfg::entry_base& rhs)
|
||||
{
|
||||
switch (rhs.get_type())
|
||||
{
|
||||
case type::node:
|
||||
{
|
||||
out << YAML::BeginMap;
|
||||
for (const auto& np : static_cast<const node&>(rhs).get_nodes())
|
||||
{
|
||||
out << YAML::Key << np.first;
|
||||
out << YAML::Value; encode(out, *np.second);
|
||||
}
|
||||
|
||||
out << YAML::EndMap;
|
||||
return;
|
||||
}
|
||||
case type::set:
|
||||
{
|
||||
out << YAML::BeginSeq;
|
||||
for (const auto& str : static_cast<const set_entry&>(rhs).get_set())
|
||||
{
|
||||
out << str;
|
||||
}
|
||||
|
||||
out << YAML::EndSeq;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
out << rhs.to_string();
|
||||
}
|
||||
|
||||
void cfg::decode(const YAML::Node& data, cfg::entry_base& rhs)
|
||||
{
|
||||
switch (rhs.get_type())
|
||||
{
|
||||
case type::node:
|
||||
{
|
||||
if (data.IsScalar() || data.IsSequence())
|
||||
{
|
||||
return; // ???
|
||||
}
|
||||
|
||||
for (const auto& pair : data)
|
||||
{
|
||||
if (!pair.first.IsScalar()) continue;
|
||||
|
||||
// Find the key among existing nodes
|
||||
const auto name = pair.first.Scalar();
|
||||
const auto found = static_cast<node&>(rhs).get_nodes().find(name);
|
||||
|
||||
if (found != static_cast<node&>(rhs).get_nodes().cend())
|
||||
{
|
||||
decode(pair.second, *found->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ???
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case type::set:
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
|
||||
if (YAML::convert<decltype(values)>::decode(data, values))
|
||||
{
|
||||
rhs.from_list(std::move(values));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
std::string value;
|
||||
|
||||
if (YAML::convert<std::string>::decode(data, value))
|
||||
{
|
||||
rhs.from_string(value);
|
||||
}
|
||||
|
||||
break; // ???
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string cfg::node::to_string() const
|
||||
{
|
||||
YAML::Emitter out;
|
||||
cfg::encode(out, *this);
|
||||
|
||||
return{ out.c_str(), out.size() };
|
||||
}
|
||||
|
||||
bool cfg::node::from_string(const std::string& value)
|
||||
{
|
||||
cfg::decode(YAML::Load(value), *this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void cfg::node::from_default()
|
||||
{
|
||||
for (auto& node : m_nodes)
|
||||
{
|
||||
node.second->from_default();
|
||||
}
|
||||
}
|
||||
|
||||
void cfg::bool_entry::from_default()
|
||||
{
|
||||
value = def;
|
||||
}
|
||||
|
||||
void cfg::string_entry::from_default()
|
||||
{
|
||||
*this = def;
|
||||
}
|
||||
|
||||
void cfg::set_entry::from_default()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_set = {};
|
||||
}
|
||||
|
||||
cfg::root_node& cfg::get_root()
|
||||
{
|
||||
// Magic static
|
||||
static root_node root;
|
||||
return root;
|
||||
}
|
||||
@@ -0,0 +1,510 @@
|
||||
#pragma once
|
||||
|
||||
#include "Utilities/types.h"
|
||||
#include "Utilities/Atomic.h"
|
||||
#include "Utilities/StrFmt.h"
|
||||
|
||||
#include <initializer_list>
|
||||
#include <exception>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
namespace cfg
|
||||
{
|
||||
// Convert string to signed integer
|
||||
bool try_to_int64(s64* out, const std::string& value, s64 min, s64 max);
|
||||
|
||||
// Internal hack
|
||||
bool try_to_enum_value(u64* out, decltype(&fmt_class_string<int>::format) func, const std::string&);
|
||||
|
||||
// Internal hack
|
||||
std::vector<std::string> try_to_enum_list(decltype(&fmt_class_string<int>::format) func);
|
||||
|
||||
// Config tree entry type.
|
||||
enum class type : uint
|
||||
{
|
||||
node = 0, // cfg::node type
|
||||
boolean, // cfg::bool_entry type
|
||||
fixed_map, // cfg::map_entry type
|
||||
enumeration, // cfg::enum_entry type
|
||||
integer, // cfg::int_entry type
|
||||
string, // cfg::string_entry type
|
||||
set, // cfg::set_entry type
|
||||
};
|
||||
|
||||
// Config tree entry abstract base class
|
||||
class entry_base
|
||||
{
|
||||
const type m_type;
|
||||
|
||||
protected:
|
||||
// Ownerless entry constructor
|
||||
entry_base(type _type);
|
||||
|
||||
// Owned entry constructor
|
||||
entry_base(type _type, class node& owner, const std::string& name);
|
||||
|
||||
public:
|
||||
// Disallow copy/move constructors and assignments
|
||||
entry_base(const entry_base&) = delete;
|
||||
|
||||
// Get type
|
||||
type get_type() const { return m_type; }
|
||||
|
||||
// Access child node (must exist)
|
||||
entry_base& operator [](const std::string& name) const; entry_base& operator [](const char* name) const;
|
||||
|
||||
// Reset defaults
|
||||
virtual void from_default() = 0;
|
||||
|
||||
// Convert to string (optional)
|
||||
virtual std::string to_string() const
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
// Try to convert from string (optional)
|
||||
virtual bool from_string(const std::string&);
|
||||
|
||||
// Get string list (optional)
|
||||
virtual std::vector<std::string> to_list() const
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
// Set multiple values. Implementation-specific, optional.
|
||||
virtual bool from_list(std::vector<std::string>&&);
|
||||
};
|
||||
|
||||
// Config tree node which contains another nodes
|
||||
class node : public entry_base
|
||||
{
|
||||
std::map<std::string, entry_base*> m_nodes;
|
||||
|
||||
friend class entry_base;
|
||||
|
||||
public:
|
||||
// Root node constructor
|
||||
node()
|
||||
: entry_base(type::node)
|
||||
{
|
||||
}
|
||||
|
||||
// Registered node constructor
|
||||
node(node& owner, const std::string& name)
|
||||
: entry_base(type::node, owner, name)
|
||||
{
|
||||
}
|
||||
|
||||
// Get child nodes
|
||||
const std::map<std::string, entry_base*>& get_nodes() const
|
||||
{
|
||||
return m_nodes;
|
||||
}
|
||||
|
||||
// Serialize node
|
||||
std::string to_string() const override;
|
||||
|
||||
// Deserialize node
|
||||
bool from_string(const std::string& value) override;
|
||||
|
||||
// Set default values
|
||||
void from_default() override;
|
||||
};
|
||||
|
||||
struct bool_entry final : public entry_base
|
||||
{
|
||||
atomic_t<bool> value;
|
||||
|
||||
const bool def;
|
||||
|
||||
bool_entry(node& owner, const std::string& name, bool def = false)
|
||||
: entry_base(type::boolean, owner, name)
|
||||
, value(def)
|
||||
, def(def)
|
||||
{
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return value.load();
|
||||
}
|
||||
|
||||
bool_entry& operator =(bool value)
|
||||
{
|
||||
value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void from_default() override;
|
||||
|
||||
std::string to_string() const override
|
||||
{
|
||||
return value.load() ? "true" : "false";
|
||||
}
|
||||
|
||||
bool from_string(const std::string& value) override
|
||||
{
|
||||
if (value == "false")
|
||||
this->value = false;
|
||||
else if (value == "true")
|
||||
this->value = true;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Value node with fixed set of possible values, each maps to a value of type T.
|
||||
template<typename T>
|
||||
struct map_entry final : public entry_base
|
||||
{
|
||||
using init_type = std::initializer_list<std::pair<std::string, T>>;
|
||||
using map_type = std::unordered_map<std::string, T>;
|
||||
using list_type = std::vector<std::string>;
|
||||
using value_type = typename map_type::value_type;
|
||||
|
||||
static map_type make_map(init_type init)
|
||||
{
|
||||
map_type map(init.size());
|
||||
|
||||
for (const auto& v : init)
|
||||
{
|
||||
// Ensure elements are unique
|
||||
verify(HERE), map.emplace(v.first, v.second).second;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
static list_type make_list(init_type init)
|
||||
{
|
||||
list_type list; list.reserve(init.size());
|
||||
|
||||
for (const auto& v : init)
|
||||
{
|
||||
list.emplace_back(v.first);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public:
|
||||
const map_type map;
|
||||
const list_type list; // Element list sorted in original order
|
||||
const value_type& def; // Pointer to the default value
|
||||
|
||||
private:
|
||||
atomic_t<const value_type*> m_value;
|
||||
|
||||
public:
|
||||
map_entry(node& owner, const std::string& name, const std::string& def, init_type init)
|
||||
: entry_base(type::fixed_map, owner, name)
|
||||
, map(make_map(init))
|
||||
, list(make_list(init))
|
||||
, def(*map.find(def))
|
||||
, m_value(&this->def)
|
||||
{
|
||||
}
|
||||
|
||||
map_entry(node& owner, const std::string& name, std::size_t def_index, init_type init)
|
||||
: map_entry(owner, name, (init.begin() + (def_index < init.size() ? def_index : 0))->first, init)
|
||||
{
|
||||
}
|
||||
|
||||
map_entry(node& owner, const std::string& name, init_type init)
|
||||
: map_entry(owner, name, 0, init)
|
||||
{
|
||||
}
|
||||
|
||||
const T& get() const
|
||||
{
|
||||
return m_value.load()->second;
|
||||
}
|
||||
|
||||
void from_default() override
|
||||
{
|
||||
m_value = &def;
|
||||
}
|
||||
|
||||
std::string to_string() const override
|
||||
{
|
||||
return m_value.load()->first;
|
||||
}
|
||||
|
||||
bool from_string(const std::string& value) override
|
||||
{
|
||||
const auto found = map.find(value);
|
||||
|
||||
if (found == map.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_value = &*found;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> to_list() const override
|
||||
{
|
||||
return list;
|
||||
}
|
||||
};
|
||||
|
||||
// Value node with fixed set of possible values, each maps to an enum value of type T.
|
||||
template<typename T, bool External = false>
|
||||
class enum_entry final : public entry_base
|
||||
{
|
||||
// Value or reference
|
||||
std::conditional_t<External, atomic_t<T>&, atomic_t<T>> m_value;
|
||||
|
||||
public:
|
||||
const T def;
|
||||
|
||||
enum_entry(node& owner, const std::string& name, std::conditional_t<External, atomic_t<T>&, T> value)
|
||||
: entry_base(type::enumeration, owner, name)
|
||||
, m_value(value)
|
||||
, def(value)
|
||||
{
|
||||
}
|
||||
|
||||
operator T() const
|
||||
{
|
||||
return m_value.load();
|
||||
}
|
||||
|
||||
enum_entry& operator =(T value)
|
||||
{
|
||||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void from_default() override
|
||||
{
|
||||
m_value = def;
|
||||
}
|
||||
|
||||
std::string to_string() const override
|
||||
{
|
||||
std::string result;
|
||||
fmt_class_string<T>::format(result, fmt_unveil<T>::get(m_value));
|
||||
return result; // TODO: ???
|
||||
}
|
||||
|
||||
bool from_string(const std::string& value) override
|
||||
{
|
||||
u64 result;
|
||||
|
||||
if (try_to_enum_value(&result, &fmt_class_string<T>::format, value))
|
||||
{
|
||||
// No narrowing check, it's hard to do right there
|
||||
m_value = static_cast<T>(static_cast<std::underlying_type_t<T>>(result));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> to_list() const override
|
||||
{
|
||||
return try_to_enum_list(&fmt_class_string<T>::format);
|
||||
}
|
||||
};
|
||||
|
||||
// Signed 32/64-bit integer entry with custom Min/Max range.
|
||||
template<s64 Min, s64 Max>
|
||||
class int_entry final : public entry_base
|
||||
{
|
||||
static_assert(Min < Max, "Invalid cfg::int_entry range");
|
||||
|
||||
// Prefer 32 bit type if possible
|
||||
using int_type = std::conditional_t<Min >= INT32_MIN && Max <= INT32_MAX, s32, s64>;
|
||||
|
||||
atomic_t<int_type> m_value;
|
||||
|
||||
public:
|
||||
const int_type def;
|
||||
|
||||
int_entry(node& owner, const std::string& name, int_type def = std::min<int_type>(Max, std::max<int_type>(Min, 0)))
|
||||
: entry_base(type::integer, owner, name)
|
||||
, m_value(def)
|
||||
, def(def)
|
||||
{
|
||||
}
|
||||
|
||||
operator int_type() const
|
||||
{
|
||||
return m_value.load();
|
||||
}
|
||||
|
||||
int_entry& operator =(int_type value)
|
||||
{
|
||||
if (value < Min || value > Max)
|
||||
{
|
||||
fmt::throw_exception("Value out of the valid range: %lld" HERE, s64{ value });
|
||||
}
|
||||
|
||||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void from_default() override
|
||||
{
|
||||
m_value = def;
|
||||
}
|
||||
|
||||
std::string to_string() const override
|
||||
{
|
||||
return std::to_string(m_value.load());
|
||||
}
|
||||
|
||||
bool from_string(const std::string& value) override
|
||||
{
|
||||
s64 result;
|
||||
if (try_to_int64(&result, value, Min, Max))
|
||||
{
|
||||
m_value = static_cast<int_type>(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Alias for 32 bit int
|
||||
using int32_entry = int_entry<INT32_MIN, INT32_MAX>;
|
||||
|
||||
// Alias for 64 bit int
|
||||
using int64_entry = int_entry<INT64_MIN, INT64_MAX>;
|
||||
|
||||
// Simple string entry with mutex
|
||||
class string_entry final : public entry_base
|
||||
{
|
||||
mutable std::mutex m_mutex;
|
||||
std::string m_value;
|
||||
|
||||
public:
|
||||
const std::string def;
|
||||
|
||||
string_entry(node& owner, const std::string& name, const std::string& def = {})
|
||||
: entry_base(type::string, owner, name)
|
||||
, m_value(def)
|
||||
, def(def)
|
||||
{
|
||||
}
|
||||
|
||||
operator std::string() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return m_value;
|
||||
}
|
||||
|
||||
std::string get() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
string_entry& operator =(const std::string& value)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::size_t size() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return m_value.size();
|
||||
}
|
||||
|
||||
void from_default() override;
|
||||
|
||||
std::string to_string() const override
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return m_value;
|
||||
}
|
||||
|
||||
bool from_string(const std::string& value) override
|
||||
{
|
||||
*this = value;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Simple set entry with mutex (TODO: template for various types)
|
||||
class set_entry final : public entry_base
|
||||
{
|
||||
mutable std::mutex m_mutex;
|
||||
|
||||
std::set<std::string> m_set;
|
||||
|
||||
public:
|
||||
// Default value is empty list in current implementation
|
||||
set_entry(node& owner, const std::string& name)
|
||||
: entry_base(type::set, owner, name)
|
||||
{
|
||||
}
|
||||
|
||||
std::set<std::string> get_set() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
return m_set;
|
||||
}
|
||||
|
||||
void set_set(std::set<std::string>&& set)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_set = std::move(set);
|
||||
}
|
||||
|
||||
void from_default() override;
|
||||
|
||||
std::vector<std::string> to_list() const override
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
return{ m_set.begin(), m_set.end() };
|
||||
}
|
||||
|
||||
bool from_list(std::vector<std::string>&& list) override
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_set = { std::make_move_iterator(list.begin()), std::make_move_iterator(list.end()) };
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Root type with some predefined nodes. Don't change it, this is not mandatory for adding nodes.
|
||||
struct root_node : node
|
||||
{
|
||||
node core { *this, "Core" };
|
||||
node vfs { *this, "VFS" };
|
||||
node log { *this, "Log" };
|
||||
node video { *this, "Video" };
|
||||
node audio { *this, "Audio" };
|
||||
node io { *this, "Input/Output" };
|
||||
node sys { *this, "System" };
|
||||
node net { *this, "Net" };
|
||||
node misc { *this, "Miscellaneous" };
|
||||
};
|
||||
|
||||
// Get global configuration root instance
|
||||
extern root_node& get_root();
|
||||
|
||||
// Global configuration root instance (cached reference)
|
||||
static root_node& root = get_root();
|
||||
}
|
||||
|
||||
// Registered log channel
|
||||
#define LOG_CHANNEL(name) extern logs::channel name; namespace logs { static cfg::enum_entry<logs::level, true> name(cfg::root.log, #name, ::name.enabled); }
|
||||
+1097
-620
File diff suppressed because it is too large
Load Diff
+534
-107
@@ -1,45 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
enum class fsm : u32 // file seek mode
|
||||
{
|
||||
begin,
|
||||
cur,
|
||||
end,
|
||||
};
|
||||
#include "types.h"
|
||||
#include "bit_set.h"
|
||||
|
||||
namespace fom // file open mode
|
||||
{
|
||||
enum : u32
|
||||
{
|
||||
read = 1 << 0,
|
||||
write = 1 << 1,
|
||||
append = 1 << 2,
|
||||
create = 1 << 3,
|
||||
trunc = 1 << 4,
|
||||
excl = 1 << 5,
|
||||
};
|
||||
};
|
||||
|
||||
enum class fse : u32 // filesystem (file or dir) error
|
||||
{
|
||||
ok, // no error
|
||||
invalid_arguments,
|
||||
};
|
||||
|
||||
enum : u32 // obsolete flags
|
||||
{
|
||||
o_read = fom::read,
|
||||
o_write = fom::write,
|
||||
o_append = fom::append,
|
||||
o_create = fom::create,
|
||||
o_trunc = fom::trunc,
|
||||
o_excl = fom::excl,
|
||||
};
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace fs
|
||||
{
|
||||
thread_local extern fse g_tls_error;
|
||||
// File open mode flags
|
||||
enum class open_mode : u32
|
||||
{
|
||||
read,
|
||||
write,
|
||||
append,
|
||||
create,
|
||||
trunc,
|
||||
excl,
|
||||
|
||||
__bitset_enum_max
|
||||
};
|
||||
|
||||
constexpr auto read = +open_mode::read; // Enable reading
|
||||
constexpr auto write = +open_mode::write; // Enable writing
|
||||
constexpr auto append = +open_mode::append; // Always append to the end of the file
|
||||
constexpr auto create = +open_mode::create; // Create file if it doesn't exist
|
||||
constexpr auto trunc = +open_mode::trunc; // Clear opened file if it's not empty
|
||||
constexpr auto excl = +open_mode::excl; // Failure if the file already exists (used with `create`)
|
||||
|
||||
constexpr auto rewrite = open_mode::write + open_mode::create + open_mode::trunc;
|
||||
|
||||
// File seek mode
|
||||
enum class seek_mode : u32
|
||||
{
|
||||
seek_set,
|
||||
seek_cur,
|
||||
seek_end,
|
||||
};
|
||||
|
||||
constexpr auto seek_set = seek_mode::seek_set; // From beginning
|
||||
constexpr auto seek_cur = seek_mode::seek_cur; // From current position
|
||||
constexpr auto seek_end = seek_mode::seek_end; // From end
|
||||
|
||||
// File attributes (TODO)
|
||||
struct stat_t
|
||||
{
|
||||
bool is_directory;
|
||||
@@ -50,94 +55,516 @@ namespace fs
|
||||
s64 ctime;
|
||||
};
|
||||
|
||||
bool stat(const std::string& path, stat_t& info);
|
||||
bool exists(const std::string& path);
|
||||
bool is_file(const std::string& file);
|
||||
bool is_dir(const std::string& dir);
|
||||
bool remove_dir(const std::string& dir);
|
||||
bool create_dir(const std::string& dir);
|
||||
bool create_path(const std::string& path);
|
||||
bool rename(const std::string& from, const std::string& to);
|
||||
bool copy_file(const std::string& from, const std::string& to, bool overwrite);
|
||||
bool remove_file(const std::string& file);
|
||||
bool truncate_file(const std::string& file, u64 length);
|
||||
|
||||
struct file final
|
||||
// File handle base
|
||||
struct file_base
|
||||
{
|
||||
using handle_type = std::intptr_t;
|
||||
virtual ~file_base();
|
||||
|
||||
static const handle_type null = -1;
|
||||
|
||||
private:
|
||||
handle_type m_fd = null;
|
||||
|
||||
public:
|
||||
file() = default;
|
||||
~file();
|
||||
explicit file(const std::string& filename, u32 mode = fom::read) { open(filename, mode); }
|
||||
|
||||
file(const file&) = delete;
|
||||
file(file&&) = delete; // possibly TODO
|
||||
|
||||
file& operator =(const file&) = delete;
|
||||
file& operator =(file&&) = delete; // possibly TODO
|
||||
|
||||
operator bool() const { return m_fd != null; }
|
||||
|
||||
void import(handle_type fd) { this->~file(); m_fd = fd; }
|
||||
|
||||
bool open(const std::string& filename, u32 mode = fom::read);
|
||||
bool is_opened() const { return m_fd != null; }
|
||||
bool trunc(u64 size) const; // change file size (possibly appending zero bytes)
|
||||
bool stat(stat_t& info) const; // get file info
|
||||
bool close();
|
||||
|
||||
u64 read(void* buffer, u64 count) const;
|
||||
u64 write(const void* buffer, u64 count) const;
|
||||
u64 seek(s64 offset, fsm seek_mode = fsm::begin) const;
|
||||
u64 size() const;
|
||||
virtual stat_t stat() = 0;
|
||||
virtual bool trunc(u64 length) = 0;
|
||||
virtual u64 read(void* buffer, u64 size) = 0;
|
||||
virtual u64 write(const void* buffer, u64 size) = 0;
|
||||
virtual u64 seek(s64 offset, seek_mode whence) = 0;
|
||||
virtual u64 size() = 0;
|
||||
};
|
||||
|
||||
struct dir final
|
||||
// Directory entry (TODO)
|
||||
struct dir_entry : stat_t
|
||||
{
|
||||
#ifdef _WIN32
|
||||
using handle_type = intptr_t;
|
||||
using name_type = std::unique_ptr<wchar_t[]>;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
static const handle_type null = -1;
|
||||
#else
|
||||
using handle_type = intptr_t;
|
||||
using name_type = std::unique_ptr<char[]>;
|
||||
// Directory handle base
|
||||
struct dir_base
|
||||
{
|
||||
virtual ~dir_base();
|
||||
|
||||
static const handle_type null = 0;
|
||||
#endif
|
||||
virtual bool read(dir_entry&) = 0;
|
||||
virtual void rewind() = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
handle_type m_dd = null;
|
||||
name_type m_path;
|
||||
// Virtual device
|
||||
struct device_base
|
||||
{
|
||||
virtual ~device_base();
|
||||
|
||||
virtual bool stat(const std::string& path, stat_t& info) = 0;
|
||||
virtual bool remove_dir(const std::string& path) = 0;
|
||||
virtual bool create_dir(const std::string& path) = 0;
|
||||
virtual bool rename(const std::string& from, const std::string& to) = 0;
|
||||
virtual bool remove(const std::string& path) = 0;
|
||||
virtual bool trunc(const std::string& path, u64 length) = 0;
|
||||
virtual bool utime(const std::string& path, s64 atime, s64 mtime) = 0;
|
||||
|
||||
virtual std::unique_ptr<file_base> open(const std::string& path, bs_t<open_mode> mode) = 0;
|
||||
virtual std::unique_ptr<dir_base> open_dir(const std::string& path) = 0;
|
||||
};
|
||||
|
||||
// Get virtual device for specified path (nullptr for real path)
|
||||
std::shared_ptr<device_base> get_virtual_device(const std::string& path);
|
||||
|
||||
// Set virtual device with specified name (nullptr for deletion)
|
||||
std::shared_ptr<device_base> set_virtual_device(const std::string& root_name, const std::shared_ptr<device_base>&);
|
||||
|
||||
// Try to get parent directory (returns empty string on failure)
|
||||
std::string get_parent_dir(const std::string& path);
|
||||
|
||||
// Get file information
|
||||
bool stat(const std::string& path, stat_t& info);
|
||||
|
||||
// Check whether a file or a directory exists (not recommended, use is_file() or is_dir() instead)
|
||||
bool exists(const std::string& path);
|
||||
|
||||
// Check whether the file exists and is NOT a directory
|
||||
bool is_file(const std::string& path);
|
||||
|
||||
// Check whether the directory exists and is NOT a file
|
||||
bool is_dir(const std::string& path);
|
||||
|
||||
// Delete empty directory
|
||||
bool remove_dir(const std::string& path);
|
||||
|
||||
// Create directory
|
||||
bool create_dir(const std::string& path);
|
||||
|
||||
// Create directories
|
||||
bool create_path(const std::string& path);
|
||||
|
||||
// Rename (move) file or directory
|
||||
bool rename(const std::string& from, const std::string& to);
|
||||
|
||||
// Copy file contents
|
||||
bool copy_file(const std::string& from, const std::string& to, bool overwrite);
|
||||
|
||||
// Delete file
|
||||
bool remove_file(const std::string& path);
|
||||
|
||||
// Change file size (possibly appending zeros)
|
||||
bool truncate_file(const std::string& path, u64 length);
|
||||
|
||||
// Set file access/modification time
|
||||
bool utime(const std::string& path, s64 atime, s64 mtime);
|
||||
|
||||
class file final
|
||||
{
|
||||
std::unique_ptr<file_base> m_file;
|
||||
|
||||
[[noreturn]] void xnull() const;
|
||||
[[noreturn]] void xfail() const;
|
||||
|
||||
public:
|
||||
// Default constructor
|
||||
file() = default;
|
||||
|
||||
// Open file with specified mode
|
||||
explicit file(const std::string& path, bs_t<open_mode> mode = ::fs::read);
|
||||
|
||||
// Open memory for read
|
||||
explicit file(const void* ptr, std::size_t size);
|
||||
|
||||
// Open file with specified args (forward to constructor)
|
||||
template <typename... Args>
|
||||
bool open(Args&&... args)
|
||||
{
|
||||
*this = fs::file(std::forward<Args>(args)...);
|
||||
return m_file.operator bool();
|
||||
}
|
||||
|
||||
// Check whether the handle is valid (opened file)
|
||||
explicit operator bool() const
|
||||
{
|
||||
return m_file.operator bool();
|
||||
}
|
||||
|
||||
// Close the file explicitly
|
||||
void close()
|
||||
{
|
||||
m_file.reset();
|
||||
}
|
||||
|
||||
void reset(std::unique_ptr<file_base>&& ptr)
|
||||
{
|
||||
m_file = std::move(ptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<file_base> release()
|
||||
{
|
||||
return std::move(m_file);
|
||||
}
|
||||
|
||||
// Change file size (possibly appending zero bytes)
|
||||
bool trunc(u64 length) const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->trunc(length);
|
||||
}
|
||||
|
||||
// Get file information
|
||||
stat_t stat() const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->stat();
|
||||
}
|
||||
|
||||
// Read the data from the file and return the amount of data written in buffer
|
||||
u64 read(void* buffer, u64 count) const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->read(buffer, count);
|
||||
}
|
||||
|
||||
// Write the data to the file and return the amount of data actually written
|
||||
u64 write(const void* buffer, u64 count) const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->write(buffer, count);
|
||||
}
|
||||
|
||||
// Change current position, returns resulting position
|
||||
u64 seek(s64 offset, seek_mode whence = seek_set) const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->seek(offset, whence);
|
||||
}
|
||||
|
||||
// Get file size
|
||||
u64 size() const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->size();
|
||||
}
|
||||
|
||||
// Get current position
|
||||
u64 pos() const
|
||||
{
|
||||
if (!m_file) xnull();
|
||||
return m_file->seek(0, seek_cur);
|
||||
}
|
||||
|
||||
// Write std::string unconditionally
|
||||
const file& write(const std::string& str) const
|
||||
{
|
||||
if (write(str.data(), str.size()) != str.size()) xfail();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Write POD unconditionally
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, const file&> write(const T& data) const
|
||||
{
|
||||
if (write(std::addressof(data), sizeof(T)) != sizeof(T)) xfail();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Write POD std::vector unconditionally
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, const file&> write(const std::vector<T>& vec) const
|
||||
{
|
||||
if (write(vec.data(), vec.size() * sizeof(T)) != vec.size() * sizeof(T)) xfail();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Read std::string, size must be set by resize() method
|
||||
bool read(std::string& str) const
|
||||
{
|
||||
return read(&str[0], str.size()) == str.size();
|
||||
}
|
||||
|
||||
// Read std::string
|
||||
bool read(std::string& str, std::size_t size) const
|
||||
{
|
||||
str.resize(size);
|
||||
return read(&str[0], size) == size;
|
||||
}
|
||||
|
||||
// Read POD, sizeof(T) is used
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, bool> read(T& data) const
|
||||
{
|
||||
return read(&data, sizeof(T)) == sizeof(T);
|
||||
}
|
||||
|
||||
// Read POD std::vector, size must be set by resize() method
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, bool> read(std::vector<T>& vec) const
|
||||
{
|
||||
return read(vec.data(), sizeof(T) * vec.size()) == sizeof(T) * vec.size();
|
||||
}
|
||||
|
||||
// Read POD std::vector
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, bool> read(std::vector<T>& vec, std::size_t size) const
|
||||
{
|
||||
vec.resize(size);
|
||||
return read(vec.data(), sizeof(T) * size) == sizeof(T) * size;
|
||||
}
|
||||
|
||||
// Read POD (experimental)
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, T> read() const
|
||||
{
|
||||
T result;
|
||||
if (!read(result)) xfail();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Read full file to std::string
|
||||
std::string to_string() const
|
||||
{
|
||||
std::string result;
|
||||
result.resize(size());
|
||||
if (seek(0), !read(result)) xfail();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Read full file to std::vector
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_pod<T>::value && !std::is_pointer<T>::value, std::vector<T>> to_vector() const
|
||||
{
|
||||
std::vector<T> result;
|
||||
result.resize(size() / sizeof(T));
|
||||
if (seek(0), !read(result)) xfail();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
class dir final
|
||||
{
|
||||
std::unique_ptr<dir_base> m_dir;
|
||||
|
||||
[[noreturn]] void xnull() const;
|
||||
|
||||
public:
|
||||
dir() = default;
|
||||
~dir();
|
||||
explicit dir(const std::string& dirname) { open(dirname); }
|
||||
|
||||
dir(const dir&) = delete;
|
||||
dir(dir&&) = delete; // possibly TODO
|
||||
// Open dir handle
|
||||
explicit dir(const std::string& path)
|
||||
{
|
||||
open(path);
|
||||
}
|
||||
|
||||
dir& operator =(const dir&) = delete;
|
||||
dir& operator =(dir&&) = delete; // possibly TODO
|
||||
// Open specified directory
|
||||
bool open(const std::string& path);
|
||||
|
||||
operator bool() const { return m_path.operator bool(); }
|
||||
// Check whether the handle is valid (opened directory)
|
||||
explicit operator bool() const
|
||||
{
|
||||
return m_dir.operator bool();
|
||||
}
|
||||
|
||||
void import(handle_type dd, const std::string& path);
|
||||
// Close the directory explicitly
|
||||
void close()
|
||||
{
|
||||
m_dir.reset();
|
||||
}
|
||||
|
||||
bool open(const std::string& dirname);
|
||||
bool is_opened() const { return *this; }
|
||||
bool close();
|
||||
void reset(std::unique_ptr<dir_base>&& ptr)
|
||||
{
|
||||
m_dir = std::move(ptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<dir_base> release()
|
||||
{
|
||||
return std::move(m_dir);
|
||||
}
|
||||
|
||||
bool get_first(std::string& name, stat_t& info);
|
||||
//bool get_first(std::string& name);
|
||||
bool get_next(std::string& name, stat_t& info);
|
||||
//bool get_next(std::string& name);
|
||||
// Get next directory entry
|
||||
bool read(dir_entry& out) const
|
||||
{
|
||||
if (!m_dir) xnull();
|
||||
return m_dir->read(out);
|
||||
}
|
||||
|
||||
// Reset to the beginning
|
||||
void rewind() const
|
||||
{
|
||||
if (!m_dir) xnull();
|
||||
return m_dir->rewind();
|
||||
}
|
||||
|
||||
class iterator
|
||||
{
|
||||
dir* m_parent;
|
||||
dir_entry m_entry;
|
||||
|
||||
public:
|
||||
enum class mode
|
||||
{
|
||||
from_first,
|
||||
from_current
|
||||
};
|
||||
|
||||
iterator(dir* parent, mode mode_ = mode::from_first)
|
||||
: m_parent(parent)
|
||||
{
|
||||
if (!m_parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode_ == mode::from_first)
|
||||
{
|
||||
m_parent->rewind();
|
||||
}
|
||||
|
||||
if (!m_parent->read(m_entry))
|
||||
{
|
||||
m_parent = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
dir_entry& operator *()
|
||||
{
|
||||
return m_entry;
|
||||
}
|
||||
|
||||
iterator& operator++()
|
||||
{
|
||||
*this = { m_parent, mode::from_current };
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator !=(const iterator& rhs) const
|
||||
{
|
||||
return m_parent != rhs.m_parent;
|
||||
}
|
||||
};
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return{ m_dir ? this : nullptr };
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return{ nullptr };
|
||||
}
|
||||
};
|
||||
|
||||
// Get configuration directory
|
||||
const std::string& get_config_dir();
|
||||
|
||||
// Get data/cache directory for specified prefix and suffix
|
||||
std::string get_data_dir(const std::string& prefix, const std::string& location, const std::string& suffix);
|
||||
|
||||
// Get data/cache directory for specified prefix and path (suffix will be filename)
|
||||
std::string get_data_dir(const std::string& prefix, const std::string& path);
|
||||
|
||||
// Delete directory and all its contents recursively
|
||||
void remove_all(const std::string& path, bool remove_root = true);
|
||||
|
||||
// Get size of all files recursively
|
||||
u64 get_dir_size(const std::string& path);
|
||||
|
||||
enum class error : uint
|
||||
{
|
||||
ok = 0,
|
||||
|
||||
inval,
|
||||
noent,
|
||||
exist,
|
||||
acces,
|
||||
};
|
||||
|
||||
// Error code returned
|
||||
extern thread_local error g_tls_error;
|
||||
|
||||
template <typename T>
|
||||
struct container_stream final : file_base
|
||||
{
|
||||
// T can be a reference, but this is not recommended
|
||||
using value_type = typename std::remove_reference_t<T>::value_type;
|
||||
|
||||
T obj;
|
||||
u64 pos;
|
||||
|
||||
container_stream(T&& obj)
|
||||
: obj(std::forward<T>(obj))
|
||||
, pos(0)
|
||||
{
|
||||
}
|
||||
|
||||
~container_stream() override
|
||||
{
|
||||
}
|
||||
|
||||
stat_t stat() override
|
||||
{
|
||||
fmt::raw_error("fs::container_stream<>::stat(): not supported");
|
||||
}
|
||||
|
||||
bool trunc(u64 length) override
|
||||
{
|
||||
obj.resize(length);
|
||||
return true;
|
||||
}
|
||||
|
||||
u64 read(void* buffer, u64 size) override
|
||||
{
|
||||
const u64 end = obj.size();
|
||||
|
||||
if (pos < end)
|
||||
{
|
||||
// Get readable size
|
||||
if (const u64 max = std::min<u64>(size, end - pos))
|
||||
{
|
||||
std::copy(obj.cbegin() + pos, obj.cbegin() + pos + max, static_cast<value_type*>(buffer));
|
||||
pos = pos + max;
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 write(const void* buffer, u64 size) override
|
||||
{
|
||||
const u64 old_size = obj.size();
|
||||
|
||||
if (old_size + size < old_size)
|
||||
{
|
||||
fmt::raw_error("fs::container_stream<>::write(): overflow");
|
||||
}
|
||||
|
||||
if (pos > old_size)
|
||||
{
|
||||
// Fill gap if necessary (default-initialized)
|
||||
obj.resize(pos);
|
||||
}
|
||||
|
||||
const auto src = static_cast<const value_type*>(buffer);
|
||||
|
||||
// Overwrite existing part
|
||||
const u64 overlap = std::min<u64>(obj.size() - pos, size);
|
||||
std::copy(src, src + overlap, obj.begin() + pos);
|
||||
|
||||
// Append new data
|
||||
obj.insert(obj.end(), src + overlap, src + size);
|
||||
pos += size;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
u64 seek(s64 offset, seek_mode whence) override
|
||||
{
|
||||
return
|
||||
whence == fs::seek_set ? pos = offset :
|
||||
whence == fs::seek_cur ? pos = offset + pos :
|
||||
whence == fs::seek_end ? pos = offset + size() :
|
||||
(fmt::raw_error("fs::container_stream<>::seek(): invalid whence"), 0);
|
||||
}
|
||||
|
||||
u64 size() override
|
||||
{
|
||||
return obj.size();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
file make_stream(T&& container = T{})
|
||||
{
|
||||
file result;
|
||||
result.reset(std::make_unique<container_stream<T>>(std::forward<T>(container)));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#include "GNU.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/types.h>
|
||||
#include <sys/_types/_timespec.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach_time.h>
|
||||
#undef CPU_STATE_MAX
|
||||
|
||||
#define MT_NANO (+1.0E-9)
|
||||
#define MT_GIGA UINT64_C(1000000000)
|
||||
|
||||
// TODO create a list of timers,
|
||||
static double mt_timebase = 0.0;
|
||||
static uint64_t mt_timestart = 0;
|
||||
|
||||
// TODO be more careful in a multithreaded environement
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
kern_return_t retval = KERN_SUCCESS;
|
||||
if( clk_id == TIMER_ABSTIME)
|
||||
{
|
||||
if (!mt_timestart) { // only one timer, initilized on the first call to the TIMER
|
||||
mach_timebase_info_data_t tb = { 0 };
|
||||
mach_timebase_info(&tb);
|
||||
mt_timebase = tb.numer;
|
||||
mt_timebase /= tb.denom;
|
||||
mt_timestart = mach_absolute_time();
|
||||
}
|
||||
|
||||
double diff = (mach_absolute_time() - mt_timestart) * mt_timebase;
|
||||
tp->tv_sec = diff * MT_NANO;
|
||||
tp->tv_nsec = diff - (tp->tv_sec * MT_GIGA);
|
||||
}
|
||||
else // other clk_ids are mapped to the coresponding mach clock_service
|
||||
{
|
||||
clock_serv_t cclock;
|
||||
mach_timespec_t mts;
|
||||
|
||||
host_get_clock_service(mach_host_self(), clk_id, &cclock);
|
||||
retval = clock_get_time(cclock, &mts);
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
|
||||
tp->tv_sec = mts.tv_sec;
|
||||
tp->tv_nsec = mts.tv_nsec;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
#if defined(__GNUG__)
|
||||
|
||||
void * _aligned_malloc(size_t size, size_t alignment) {
|
||||
void *buffer;
|
||||
return (posix_memalign(&buffer, alignment, size) == 0) ? buffer : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
-329
@@ -1,329 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
#define thread_local __declspec(thread)
|
||||
#elif __APPLE__
|
||||
#define thread_local __thread
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define never_inline __declspec(noinline)
|
||||
#else
|
||||
#define never_inline __attribute__((noinline))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define safe_buffers __declspec(safebuffers)
|
||||
#else
|
||||
#define safe_buffers
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define force_inline __forceinline
|
||||
#else
|
||||
#define force_inline __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
#define alignas(x) _CRT_ALIGN(x)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUG__)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define _fpclass(x) std::fpclassify(x)
|
||||
#define _byteswap_ushort(x) __builtin_bswap16(x)
|
||||
#define _byteswap_ulong(x) __builtin_bswap32(x)
|
||||
#define _byteswap_uint64(x) __builtin_bswap64(x)
|
||||
#define INFINITE 0xFFFFFFFF
|
||||
|
||||
inline uint64_t __umulh(uint64_t a, uint64_t b)
|
||||
{
|
||||
uint64_t result;
|
||||
__asm__("mulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
|
||||
return result;
|
||||
}
|
||||
|
||||
inline int64_t __mulh(int64_t a, int64_t b)
|
||||
{
|
||||
int64_t result;
|
||||
__asm__("imulq %[b]" : "=d" (result) : [a] "a" (a), [b] "rm" (b));
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
// XXX only supports a single timer
|
||||
#define TIMER_ABSTIME -1
|
||||
/* The opengroup spec isn't clear on the mapping from REALTIME to CALENDAR
|
||||
being appropriate or not.
|
||||
http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html */
|
||||
#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h
|
||||
#define CLOCK_MONOTONIC 0 // #define SYSTEM_CLOCK 0
|
||||
|
||||
typedef int clockid_t;
|
||||
|
||||
/* the mach kernel uses struct mach_timespec, so struct timespec
|
||||
is loaded from <sys/_types/_timespec.h> for compatability */
|
||||
// struct timespec { time_t tv_sec; long tv_nsec; };
|
||||
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* __GNUG__ */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// Unsigned 128-bit integer implementation
|
||||
struct alignas(16) uint128_t
|
||||
{
|
||||
uint64_t lo, hi;
|
||||
|
||||
uint128_t() = default;
|
||||
|
||||
uint128_t(uint64_t l)
|
||||
: lo(l)
|
||||
, hi(0)
|
||||
{
|
||||
}
|
||||
|
||||
[[deprecated("Not implemented")]] inline uint128_t operator +(const uint128_t& r) const
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
inline uint128_t operator +(uint64_t r) const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = lo + r;
|
||||
value.hi = value.lo < r ? hi + 1 : hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
[[deprecated("Not implemented")]] inline uint128_t operator -(const uint128_t& r) const
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
inline uint128_t operator -(uint64_t r) const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = lo - r;
|
||||
value.hi = lo < r ? hi - 1 : hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t operator +() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t operator -() const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = ~lo + 1;
|
||||
value.hi = lo ? ~hi : ~hi + 1;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t& operator ++()
|
||||
{
|
||||
if (!++lo) ++hi;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t operator ++(int)
|
||||
{
|
||||
uint128_t value = *this;
|
||||
if (!++lo) ++hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t& operator --()
|
||||
{
|
||||
if (!lo--) hi--;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t operator --(int)
|
||||
{
|
||||
uint128_t value = *this;
|
||||
if (!lo--) hi--;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t operator ~() const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = ~lo;
|
||||
value.hi = ~hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t operator &(const uint128_t& r) const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = lo & r.lo;
|
||||
value.hi = hi & r.hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t operator |(const uint128_t& r) const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = lo | r.lo;
|
||||
value.hi = hi | r.hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint128_t operator ^(const uint128_t& r) const
|
||||
{
|
||||
uint128_t value;
|
||||
value.lo = lo ^ r.lo;
|
||||
value.hi = hi ^ r.hi;
|
||||
return value;
|
||||
}
|
||||
|
||||
[[deprecated("Not implemented")]] inline uint128_t& operator +=(const uint128_t& r)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t& operator +=(uint64_t r)
|
||||
{
|
||||
hi = (lo += r) < r ? hi + 1 : hi;
|
||||
return *this;
|
||||
}
|
||||
|
||||
[[deprecated("Not implemented")]] inline uint128_t& operator -=(const uint128_t& r)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t& operator &=(const uint128_t& r)
|
||||
{
|
||||
lo &= r.lo;
|
||||
hi &= r.hi;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t& operator |=(const uint128_t& r)
|
||||
{
|
||||
lo |= r.lo;
|
||||
hi |= r.hi;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline uint128_t& operator ^=(const uint128_t& r)
|
||||
{
|
||||
lo ^= r.lo;
|
||||
hi ^= r.hi;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
using __uint128_t = uint128_t;
|
||||
#endif
|
||||
|
||||
inline uint32_t cntlz32(uint32_t arg)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
unsigned long res;
|
||||
if (!_BitScanReverse(&res, arg))
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
return res ^ 31;
|
||||
}
|
||||
#else
|
||||
if (arg)
|
||||
{
|
||||
return __builtin_clzll((uint64_t)arg) - 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint64_t cntlz64(uint64_t arg)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
unsigned long res;
|
||||
if (!_BitScanReverse64(&res, arg))
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return res ^ 63;
|
||||
}
|
||||
#else
|
||||
if (arg)
|
||||
{
|
||||
return __builtin_clzll(arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// compare 16 packed unsigned bytes (greater than)
|
||||
inline __m128i sse_cmpgt_epu8(__m128i A, __m128i B)
|
||||
{
|
||||
// (A xor 0x80) > (B xor 0x80)
|
||||
const auto sign = _mm_set1_epi32(0x80808080);
|
||||
return _mm_cmpgt_epi8(_mm_xor_si128(A, sign), _mm_xor_si128(B, sign));
|
||||
}
|
||||
|
||||
inline __m128i sse_cmpgt_epu16(__m128i A, __m128i B)
|
||||
{
|
||||
const auto sign = _mm_set1_epi32(0x80008000);
|
||||
return _mm_cmpgt_epi16(_mm_xor_si128(A, sign), _mm_xor_si128(B, sign));
|
||||
}
|
||||
|
||||
inline __m128i sse_cmpgt_epu32(__m128i A, __m128i B)
|
||||
{
|
||||
const auto sign = _mm_set1_epi32(0x80000000);
|
||||
return _mm_cmpgt_epi32(_mm_xor_si128(A, sign), _mm_xor_si128(B, sign));
|
||||
}
|
||||
|
||||
inline __m128 sse_exp2_ps(__m128 A)
|
||||
{
|
||||
const auto x0 = _mm_max_ps(_mm_min_ps(A, _mm_set1_ps(127.4999961f)), _mm_set1_ps(-127.4999961f));
|
||||
const auto x1 = _mm_add_ps(x0, _mm_set1_ps(0.5f));
|
||||
const auto x2 = _mm_sub_epi32(_mm_cvtps_epi32(x1), _mm_and_si128(_mm_castps_si128(_mm_cmpnlt_ps(_mm_setzero_ps(), x1)), _mm_set1_epi32(1)));
|
||||
const auto x3 = _mm_sub_ps(x0, _mm_cvtepi32_ps(x2));
|
||||
const auto x4 = _mm_mul_ps(x3, x3);
|
||||
const auto x5 = _mm_mul_ps(x3, _mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(x4, _mm_set1_ps(0.023093347705f)), _mm_set1_ps(20.20206567f)), x4), _mm_set1_ps(1513.906801f)));
|
||||
const auto x6 = _mm_mul_ps(x5, _mm_rcp_ps(_mm_sub_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(233.1842117f), x4), _mm_set1_ps(4368.211667f)), x5)));
|
||||
return _mm_mul_ps(_mm_add_ps(_mm_add_ps(x6, x6), _mm_set1_ps(1.0f)), _mm_castsi128_ps(_mm_slli_epi32(_mm_add_epi32(x2, _mm_set1_epi32(127)), 23)));
|
||||
}
|
||||
|
||||
inline __m128 sse_log2_ps(__m128 A)
|
||||
{
|
||||
const auto _1 = _mm_set1_ps(1.0f);
|
||||
const auto _c = _mm_set1_ps(1.442695040f);
|
||||
const auto x0 = _mm_max_ps(A, _mm_castsi128_ps(_mm_set1_epi32(0x00800000)));
|
||||
const auto x1 = _mm_or_ps(_mm_and_ps(x0, _mm_castsi128_ps(_mm_set1_epi32(0x807fffff))), _1);
|
||||
const auto x2 = _mm_rcp_ps(_mm_add_ps(x1, _1));
|
||||
const auto x3 = _mm_mul_ps(_mm_sub_ps(x1, _1), x2);
|
||||
const auto x4 = _mm_add_ps(x3, x3);
|
||||
const auto x5 = _mm_mul_ps(x4, x4);
|
||||
const auto x6 = _mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(-0.7895802789f), x5), _mm_set1_ps(16.38666457f)), x5), _mm_set1_ps(-64.1409953f));
|
||||
const auto x7 = _mm_rcp_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(-35.67227983f), x5), _mm_set1_ps(312.0937664f)), x5), _mm_set1_ps(-769.6919436f)));
|
||||
const auto x8 = _mm_cvtepi32_ps(_mm_sub_epi32(_mm_srli_epi32(_mm_castps_si128(x0), 23), _mm_set1_epi32(127)));
|
||||
return _mm_add_ps(_mm_mul_ps(_mm_mul_ps(_mm_mul_ps(_mm_mul_ps(x5, x6), x7), x4), _c), _mm_add_ps(_mm_mul_ps(x4, _c), x8));
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#define GSL_THROW_ON_CONTRACT_VIOLATION
|
||||
|
||||
#pragma push_macro("new")
|
||||
#undef new
|
||||
#include <gsl.h>
|
||||
#pragma pop_macro("new")
|
||||
#undef Expects
|
||||
#undef Ensures
|
||||
@@ -0,0 +1,410 @@
|
||||
#ifdef LLVM_AVAILABLE
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
#include <array>
|
||||
|
||||
#include "types.h"
|
||||
#include "StrFmt.h"
|
||||
#include "File.h"
|
||||
#include "Log.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#endif
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
|
||||
#include "llvm/ExecutionEngine/JITEventListener.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "JIT.h"
|
||||
|
||||
// Global LLVM context (thread-unsafe)
|
||||
llvm::LLVMContext g_llvm_ctx;
|
||||
|
||||
// Size of virtual memory area reserved: 512 MB
|
||||
static const u64 s_memory_size = 0x20000000;
|
||||
|
||||
// Try to reserve a portion of virtual memory in the first 2 GB address space beforehand, if possible.
|
||||
static void* const s_memory = []() -> void*
|
||||
{
|
||||
#ifdef _WIN32
|
||||
for (u64 addr = 0x10000000; addr <= 0x60000000; addr += 0x1000000)
|
||||
{
|
||||
if (VirtualAlloc((void*)addr, s_memory_size, MEM_RESERVE, PAGE_NOACCESS))
|
||||
{
|
||||
return (void*)addr;
|
||||
}
|
||||
}
|
||||
|
||||
return VirtualAlloc(NULL, s_memory_size, MEM_RESERVE, PAGE_NOACCESS);
|
||||
#else
|
||||
return ::mmap((void*)0x10000000, s_memory_size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
}();
|
||||
|
||||
// Code section
|
||||
static u8* s_code_addr;
|
||||
static u64 s_code_size;
|
||||
|
||||
// EH frames
|
||||
static u8* s_unwind_info;
|
||||
static u64 s_unwind_size;
|
||||
|
||||
#ifdef _WIN32
|
||||
static std::vector<std::vector<RUNTIME_FUNCTION>> s_unwind; // .pdata
|
||||
#endif
|
||||
|
||||
// Helper class
|
||||
struct MemoryManager final : llvm::RTDyldMemoryManager
|
||||
{
|
||||
std::unordered_map<std::string, std::uintptr_t>& m_link;
|
||||
|
||||
MemoryManager(std::unordered_map<std::string, std::uintptr_t>& table)
|
||||
: m_link(table)
|
||||
{
|
||||
}
|
||||
|
||||
[[noreturn]] static void null()
|
||||
{
|
||||
fmt::throw_exception("Null function" HERE);
|
||||
}
|
||||
|
||||
virtual u64 getSymbolAddress(const std::string& name) override
|
||||
{
|
||||
const auto found = m_link.find(name);
|
||||
|
||||
if (found != m_link.end())
|
||||
{
|
||||
return found->second;
|
||||
}
|
||||
|
||||
if (u64 addr = RTDyldMemoryManager::getSymbolAddress(name))
|
||||
{
|
||||
// This may be bad if LLVM requests some built-in functions like fma.
|
||||
LOG_ERROR(GENERAL, "LLVM: Symbol requested: %s -> 0x%016llx", name, addr);
|
||||
return addr;
|
||||
}
|
||||
|
||||
// It's fine if some function is never called, for example.
|
||||
LOG_ERROR(GENERAL, "LLVM: Symbol not found: %s", name);
|
||||
return (u64)null;
|
||||
}
|
||||
|
||||
virtual u8* allocateCodeSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name) override
|
||||
{
|
||||
// Simple allocation
|
||||
const u64 next = ::align((u64)m_next + size, 4096);
|
||||
|
||||
if (next > (u64)s_memory + s_memory_size)
|
||||
{
|
||||
LOG_FATAL(GENERAL, "LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!VirtualAlloc(m_next, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE))
|
||||
#else
|
||||
if (::mprotect(m_next, size, PROT_READ | PROT_WRITE | PROT_EXEC))
|
||||
#endif
|
||||
{
|
||||
LOG_FATAL(GENERAL, "LLVM: Failed to allocate memory at %p", m_next);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
s_code_addr = (u8*)m_next;
|
||||
s_code_size = size;
|
||||
|
||||
LOG_NOTICE(GENERAL, "LLVM: Code section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x)", sec_id, sec_name.data(), m_next, size, align);
|
||||
return (u8*)std::exchange(m_next, (void*)next);
|
||||
}
|
||||
|
||||
virtual u8* allocateDataSection(std::uintptr_t size, uint align, uint sec_id, llvm::StringRef sec_name, bool is_ro) override
|
||||
{
|
||||
// Simple allocation
|
||||
const u64 next = ::align((u64)m_next + size, 4096);
|
||||
|
||||
if (next > (u64)s_memory + s_memory_size)
|
||||
{
|
||||
LOG_FATAL(GENERAL, "LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!is_ro)
|
||||
{
|
||||
LOG_ERROR(GENERAL, "LLVM: Writeable data section not supported!");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!VirtualAlloc(m_next, size, MEM_COMMIT, PAGE_READWRITE))
|
||||
#else
|
||||
if (::mprotect(m_next, size, PROT_READ | PROT_WRITE))
|
||||
#endif
|
||||
{
|
||||
LOG_FATAL(GENERAL, "LLVM: Failed to allocate memory at %p", m_next);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LOG_NOTICE(GENERAL, "LLVM: Data section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x, %s)", sec_id, sec_name.data(), m_next, size, align, is_ro ? "ro" : "rw");
|
||||
return (u8*)std::exchange(m_next, (void*)next);
|
||||
}
|
||||
|
||||
virtual bool finalizeMemory(std::string* = nullptr) override
|
||||
{
|
||||
// TODO: make only read-only sections read-only
|
||||
//#ifdef _WIN32
|
||||
// DWORD op;
|
||||
// VirtualProtect(s_memory, (u64)m_next - (u64)s_memory, PAGE_READONLY, &op);
|
||||
// VirtualProtect(s_code_addr, s_code_size, PAGE_EXECUTE_READ, &op);
|
||||
//#else
|
||||
// ::mprotect(s_memory, (u64)m_next - (u64)s_memory, PROT_READ);
|
||||
// ::mprotect(s_code_addr, s_code_size, PROT_READ | PROT_EXEC);
|
||||
//#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void registerEHFrames(u8* addr, u64 load_addr, std::size_t size) override
|
||||
{
|
||||
s_unwind_info = addr;
|
||||
s_unwind_size = size;
|
||||
|
||||
return RTDyldMemoryManager::registerEHFrames(addr, load_addr, size);
|
||||
}
|
||||
|
||||
virtual void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
|
||||
{
|
||||
LOG_ERROR(GENERAL, "deregisterEHFrames() called"); // Not expected
|
||||
|
||||
return RTDyldMemoryManager::deregisterEHFrames(addr, load_addr, size);
|
||||
}
|
||||
|
||||
~MemoryManager()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
for (auto&& unwind : s_unwind)
|
||||
{
|
||||
if (!RtlDeleteFunctionTable(unwind.data()))
|
||||
{
|
||||
LOG_FATAL(GENERAL, "RtlDeleteFunctionTable() failed! Error %u", GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
s_unwind.clear();
|
||||
|
||||
if (!VirtualFree(s_memory, 0, MEM_DECOMMIT))
|
||||
{
|
||||
LOG_FATAL(GENERAL, "VirtualFree(%p) failed! Error %u", s_memory, GetLastError());
|
||||
}
|
||||
#else
|
||||
if (!::mmap(s_memory, s_memory_size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0))
|
||||
{
|
||||
LOG_FATAL(GENERAL, "mmap(%p) failed! Error %d", s_memory, errno);
|
||||
}
|
||||
|
||||
// TODO: unregister EH frames if necessary
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
void* m_next = s_memory;
|
||||
};
|
||||
|
||||
// Helper class
|
||||
struct EventListener final : llvm::JITEventListener
|
||||
{
|
||||
std::string path;
|
||||
|
||||
virtual void NotifyObjectEmitted(const llvm::object::ObjectFile& obj, const llvm::RuntimeDyld::LoadedObjectInfo& inf) override
|
||||
{
|
||||
if (!path.empty())
|
||||
{
|
||||
const llvm::StringRef elf = obj.getData();
|
||||
fs::file(path, fs::rewrite).write(elf.data(), elf.size());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static EventListener s_listener;
|
||||
|
||||
static void dummy()
|
||||
{
|
||||
}
|
||||
|
||||
jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_linkage_info)
|
||||
: m_link(std::move(init_linkage_info))
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
m_link.emplace("__chkstk", (u64)&dummy);
|
||||
#endif
|
||||
|
||||
verify(HERE), s_memory;
|
||||
|
||||
// Initialization
|
||||
llvm::InitializeNativeTarget();
|
||||
llvm::InitializeNativeTargetAsmPrinter();
|
||||
LLVMLinkInMCJIT();
|
||||
m_cpu = llvm::sys::getHostCPUName();
|
||||
|
||||
if (m_cpu == "skylake")
|
||||
{
|
||||
m_cpu = "haswell";
|
||||
}
|
||||
|
||||
std::string result;
|
||||
|
||||
m_engine.reset(llvm::EngineBuilder(std::make_unique<llvm::Module>("", g_llvm_ctx))
|
||||
.setErrorStr(&result)
|
||||
.setMCJITMemoryManager(std::make_unique<MemoryManager>(m_link))
|
||||
.setOptLevel(llvm::CodeGenOpt::Aggressive)
|
||||
.setCodeModel((u64)s_memory <= 0x60000000 ? llvm::CodeModel::Small : llvm::CodeModel::Large) // TODO
|
||||
.setMCPU(m_cpu)
|
||||
.create());
|
||||
|
||||
if (!m_engine)
|
||||
{
|
||||
fmt::throw_exception("LLVM: Failed to create ExecutionEngine: %s", result);
|
||||
}
|
||||
|
||||
m_engine->setProcessAllSections(true); // ???
|
||||
m_engine->RegisterJITEventListener(&s_listener);
|
||||
}
|
||||
|
||||
void jit_compiler::load(std::unique_ptr<llvm::Module> module, std::unique_ptr<llvm::object::ObjectFile> object)
|
||||
{
|
||||
s_listener.path.clear();
|
||||
|
||||
auto* module_ptr = module.get();
|
||||
|
||||
m_engine->addModule(std::move(module));
|
||||
m_engine->addObjectFile(std::move(object));
|
||||
m_engine->finalizeObject();
|
||||
|
||||
m_map.clear();
|
||||
|
||||
for (auto& func : module_ptr->functions())
|
||||
{
|
||||
const std::string& name = func.getName();
|
||||
|
||||
if (!m_link.count(name))
|
||||
{
|
||||
// Register compiled function
|
||||
m_map[name] = m_engine->getFunctionAddress(name);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void jit_compiler::make(std::unique_ptr<llvm::Module> module, std::string path)
|
||||
{
|
||||
s_listener.path = std::move(path);
|
||||
|
||||
auto* module_ptr = module.get();
|
||||
|
||||
m_engine->addModule(std::move(module));
|
||||
m_engine->finalizeObject();
|
||||
|
||||
m_map.clear();
|
||||
|
||||
for (auto& func : module_ptr->functions())
|
||||
{
|
||||
if (!func.empty())
|
||||
{
|
||||
const std::string& name = func.getName();
|
||||
|
||||
// Register compiled function
|
||||
m_map[name] = m_engine->getFunctionAddress(name);
|
||||
}
|
||||
|
||||
// Delete IR to lower memory consumption
|
||||
func.deleteBody();
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void jit_compiler::init()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Register .xdata UNWIND_INFO (.pdata section is empty for some reason)
|
||||
std::set<u64> func_set;
|
||||
|
||||
for (const auto& pair : m_map)
|
||||
{
|
||||
func_set.emplace(pair.second);
|
||||
}
|
||||
|
||||
const u64 base = (u64)s_memory;
|
||||
const u8* bits = s_unwind_info;
|
||||
|
||||
std::vector<RUNTIME_FUNCTION> unwind;
|
||||
unwind.reserve(m_map.size());
|
||||
|
||||
for (const u64 addr : func_set)
|
||||
{
|
||||
// Find next function address
|
||||
const auto _next = func_set.upper_bound(addr);
|
||||
const u64 next = _next != func_set.end() ? *_next : (u64)s_code_addr + s_code_size;
|
||||
|
||||
// Generate RUNTIME_FUNCTION record
|
||||
RUNTIME_FUNCTION uw;
|
||||
uw.BeginAddress = static_cast<u32>(addr - base);
|
||||
uw.EndAddress = static_cast<u32>(next - base);
|
||||
uw.UnwindData = static_cast<u32>((u64)bits - base);
|
||||
unwind.emplace_back(uw);
|
||||
|
||||
// Parse .xdata UNWIND_INFO record
|
||||
const u8 flags = *bits++; // Version and flags
|
||||
const u8 prolog = *bits++; // Size of prolog
|
||||
const u8 count = *bits++; // Count of unwind codes
|
||||
const u8 frame = *bits++; // Frame Reg + Off
|
||||
bits += ::align(std::max<u8>(1, count), 2) * sizeof(u16); // UNWIND_CODE array
|
||||
|
||||
if (flags != 1)
|
||||
{
|
||||
// Can't happen for trivial code
|
||||
LOG_ERROR(GENERAL, "LLVM: unsupported UNWIND_INFO version/flags (0x%02x)", flags);
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_TRACE(GENERAL, "LLVM: .xdata at 0x%llx: function 0x%x..0x%x: p0x%02x, c0x%02x, f0x%02x", uw.UnwindData + base, uw.BeginAddress + base, uw.EndAddress + base, prolog, count, frame);
|
||||
}
|
||||
|
||||
if (s_unwind_info + s_unwind_size != bits)
|
||||
{
|
||||
LOG_ERROR(GENERAL, "LLVM: .xdata analysis failed! (%p != %p)", s_unwind_info + s_unwind_size, bits);
|
||||
}
|
||||
else if (!RtlAddFunctionTable(unwind.data(), (DWORD)unwind.size(), base))
|
||||
{
|
||||
LOG_ERROR(GENERAL, "RtlAddFunctionTable(%p) failed! Error %u", s_unwind_info, GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_NOTICE(GENERAL, "LLVM: UNWIND_INFO registered (%p, size=0x%llx)", s_unwind_info, s_unwind_size);
|
||||
}
|
||||
|
||||
s_unwind.emplace_back(std::move(unwind));
|
||||
#endif
|
||||
}
|
||||
|
||||
jit_compiler::~jit_compiler()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "restore_new.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#endif
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#include "define_new_memleakdetect.h"
|
||||
|
||||
extern llvm::LLVMContext g_llvm_ctx;
|
||||
|
||||
// Temporary compiler interface
|
||||
class jit_compiler final
|
||||
{
|
||||
// Execution instance
|
||||
std::unique_ptr<llvm::ExecutionEngine> m_engine;
|
||||
|
||||
// Compiled functions
|
||||
std::unordered_map<std::string, std::uintptr_t> m_map;
|
||||
|
||||
// Linkage cache
|
||||
std::unordered_map<std::string, std::uintptr_t> m_link;
|
||||
|
||||
// Arch
|
||||
std::string m_cpu;
|
||||
|
||||
// Internal
|
||||
void init();
|
||||
|
||||
public:
|
||||
jit_compiler(std::unordered_map<std::string, std::uintptr_t>);
|
||||
~jit_compiler();
|
||||
|
||||
// Compile module
|
||||
void make(std::unique_ptr<llvm::Module>, std::string);
|
||||
|
||||
// Load object
|
||||
void load(std::unique_ptr<llvm::Module>, std::unique_ptr<llvm::object::ObjectFile>);
|
||||
|
||||
// Get compiled function address
|
||||
std::uintptr_t get(const std::string& name) const
|
||||
{
|
||||
const auto found = m_map.find(name);
|
||||
|
||||
if (found != m_map.end())
|
||||
{
|
||||
return found->second;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get CPU info
|
||||
const std::string& cpu() const
|
||||
{
|
||||
return m_cpu;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
+197
-253
@@ -1,276 +1,220 @@
|
||||
#include "stdafx.h"
|
||||
#include "rPlatform.h"
|
||||
#include "Log.h"
|
||||
#include "rMsgBox.h"
|
||||
#include <iostream>
|
||||
#include <cinttypes>
|
||||
#include "Thread.h"
|
||||
#include "Log.h"
|
||||
#include "File.h"
|
||||
#include "StrFmt.h"
|
||||
|
||||
using namespace Log;
|
||||
#include "rpcs3_version.h"
|
||||
#include <string>
|
||||
|
||||
std::unique_ptr<LogManager> g_log_manager;
|
||||
|
||||
u32 LogMessage::size() const
|
||||
{
|
||||
//1 byte for NULL terminator
|
||||
return (u32)(sizeof(LogMessage::size_type) + sizeof(LogType) + sizeof(Severity) + sizeof(std::string::value_type) * mText.size() + 1);
|
||||
}
|
||||
|
||||
void LogMessage::serialize(char *output) const
|
||||
{
|
||||
LogMessage::size_type size = this->size();
|
||||
memcpy(output, &size, sizeof(LogMessage::size_type));
|
||||
output += sizeof(LogMessage::size_type);
|
||||
memcpy(output, &mType, sizeof(LogType));
|
||||
output += sizeof(LogType);
|
||||
memcpy(output, &mServerity, sizeof(Severity));
|
||||
output += sizeof(Severity);
|
||||
memcpy(output, mText.c_str(), mText.size() );
|
||||
output += sizeof(std::string::value_type)*mText.size();
|
||||
*output = '\0';
|
||||
|
||||
}
|
||||
LogMessage LogMessage::deserialize(char *input, u32* size_out)
|
||||
{
|
||||
LogMessage msg;
|
||||
LogMessage::size_type msgSize = *(reinterpret_cast<LogMessage::size_type*>(input));
|
||||
input += sizeof(LogMessage::size_type);
|
||||
msg.mType = *(reinterpret_cast<LogType*>(input));
|
||||
input += sizeof(LogType);
|
||||
msg.mServerity = *(reinterpret_cast<Severity*>(input));
|
||||
input += sizeof(Severity);
|
||||
if (msgSize > 9000)
|
||||
{
|
||||
int wtf = 6;
|
||||
}
|
||||
msg.mText.append(input, msgSize - 1 - sizeof(Severity) - sizeof(LogType));
|
||||
if (size_out){(*size_out) = msgSize;}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LogChannel::LogChannel() : LogChannel("unknown")
|
||||
{}
|
||||
|
||||
LogChannel::LogChannel(const std::string& name) :
|
||||
name(name)
|
||||
, mEnabled(true)
|
||||
, mLogLevel(Severity::Warning)
|
||||
{}
|
||||
|
||||
void LogChannel::log(const LogMessage &msg)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
for (auto &listener : mListeners)
|
||||
{
|
||||
listener->log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void LogChannel::addListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
mListeners.insert(listener);
|
||||
}
|
||||
void LogChannel::removeListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mListenerLock);
|
||||
mListeners.erase(listener);
|
||||
}
|
||||
|
||||
struct CoutListener : LogListener
|
||||
{
|
||||
void log(const LogMessage &msg) override
|
||||
{
|
||||
std::cerr << msg.mText << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
struct FileListener : LogListener
|
||||
{
|
||||
fs::file mFile;
|
||||
bool mPrependChannelName;
|
||||
|
||||
FileListener(const std::string& name = _PRGNAME_, bool prependChannel = true)
|
||||
: mFile(rPlatform::getConfigDir() + name + ".log", fom::write | fom::create | fom::trunc)
|
||||
, mPrependChannelName(prependChannel)
|
||||
{
|
||||
if (!mFile)
|
||||
{
|
||||
rMessageBox("Can't create log file! (" + name + ".log)", "Error", rICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void log(const LogMessage &msg) override
|
||||
{
|
||||
std::string text = msg.mText;
|
||||
if (mPrependChannelName)
|
||||
{
|
||||
text.insert(0, gTypeNameTable[static_cast<u32>(msg.mType)].mName);
|
||||
|
||||
if (msg.mType == Log::TTY)
|
||||
{
|
||||
text = fmt::escape(text);
|
||||
if (text[text.length() - 1] != '\n')
|
||||
{
|
||||
text += '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mFile.write(text.c_str(), text.size());
|
||||
}
|
||||
};
|
||||
|
||||
LogManager::LogManager()
|
||||
#ifdef BUFFERED_LOGGING
|
||||
: mExiting(false), mLogConsumer()
|
||||
#endif
|
||||
{
|
||||
auto it = mChannels.begin();
|
||||
std::shared_ptr<LogListener> listener(new FileListener());
|
||||
for (const LogTypeName& name : gTypeNameTable)
|
||||
{
|
||||
it->name = name.mName;
|
||||
it->addListener(listener);
|
||||
it++;
|
||||
}
|
||||
std::shared_ptr<LogListener> TTYListener(new FileListener("TTY",false));
|
||||
getChannel(TTY).addListener(TTYListener);
|
||||
#ifdef BUFFERED_LOGGING
|
||||
mLogConsumer = std::thread(&LogManager::consumeLog, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
LogManager::~LogManager()
|
||||
{
|
||||
#ifdef BUFFERED_LOGGING
|
||||
mExiting = true;
|
||||
mBufferReady.notify_all();
|
||||
mLogConsumer.join();
|
||||
}
|
||||
|
||||
void LogManager::consumeLog()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mStatusMut);
|
||||
while (!mExiting)
|
||||
{
|
||||
mBufferReady.wait(lock);
|
||||
mBuffer.lockGet();
|
||||
size_t size = mBuffer.size();
|
||||
std::vector<char> local_messages(size);
|
||||
mBuffer.popN(&local_messages.front(), size);
|
||||
mBuffer.unlockGet();
|
||||
|
||||
u32 cursor = 0;
|
||||
u32 removed = 0;
|
||||
while (cursor < size)
|
||||
{
|
||||
Log::LogMessage msg = Log::LogMessage::deserialize(local_messages.data() + cursor, &removed);
|
||||
cursor += removed;
|
||||
getChannel(msg.mType).log(msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogManager::log(LogMessage msg)
|
||||
{
|
||||
//don't do any formatting changes or filtering to the TTY output since we
|
||||
//use the raw output to do diffs with the output of a real PS3 and some
|
||||
//programs write text in single bytes to the console
|
||||
if (msg.mType != TTY)
|
||||
{
|
||||
std::string prefix;
|
||||
switch (msg.mServerity)
|
||||
{
|
||||
case Severity::Success:
|
||||
prefix = "S ";
|
||||
break;
|
||||
case Severity::Notice:
|
||||
prefix = "! ";
|
||||
break;
|
||||
case Severity::Warning:
|
||||
prefix = "W ";
|
||||
break;
|
||||
case Severity::Error:
|
||||
prefix = "E ";
|
||||
break;
|
||||
}
|
||||
if (auto thr = get_current_thread_ctrl())
|
||||
{
|
||||
prefix += "{" + thr->get_name() + "} ";
|
||||
}
|
||||
msg.mText.insert(0, prefix);
|
||||
msg.mText.append(1,'\n');
|
||||
}
|
||||
#ifdef BUFFERED_LOGGING
|
||||
size_t size = msg.size();
|
||||
std::vector<char> temp_buffer(size);
|
||||
msg.serialize(temp_buffer.data());
|
||||
mBuffer.pushRange(temp_buffer.begin(), temp_buffer.end());
|
||||
mBufferReady.notify_one();
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
mChannels[static_cast<u32>(msg.mType)].log(msg);
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
// Thread-specific log prefix provider
|
||||
thread_local std::string(*g_tls_log_prefix)() = nullptr;
|
||||
|
||||
template<>
|
||||
void fmt_class_string<logs::level>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](auto lev)
|
||||
{
|
||||
switch (lev)
|
||||
{
|
||||
case logs::level::always: return "Nothing";
|
||||
case logs::level::fatal: return "Fatal";
|
||||
case logs::level::error: return "Error";
|
||||
case logs::level::todo: return "TODO";
|
||||
case logs::level::success: return "Success";
|
||||
case logs::level::warning: return "Warning";
|
||||
case logs::level::notice: return "Notice";
|
||||
case logs::level::trace: return "Trace";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
void LogManager::addListener(std::shared_ptr<LogListener> listener)
|
||||
namespace logs
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
class file_writer
|
||||
{
|
||||
channel.addListener(listener);
|
||||
// Could be memory-mapped file
|
||||
fs::file m_file;
|
||||
|
||||
public:
|
||||
file_writer(const std::string& name);
|
||||
|
||||
virtual ~file_writer() = default;
|
||||
|
||||
// Append raw data
|
||||
void log(const char* text, std::size_t size);
|
||||
};
|
||||
|
||||
struct file_listener : public file_writer, public listener
|
||||
{
|
||||
file_listener(const std::string& name)
|
||||
: file_writer(name)
|
||||
, listener()
|
||||
{
|
||||
const std::string& start = fmt::format("\xEF\xBB\xBF" "RPCS3 v%s\n", rpcs3::version.to_string());
|
||||
file_writer::log(start.data(), start.size());
|
||||
}
|
||||
|
||||
// Encode level, current thread name, channel name and write log message
|
||||
virtual void log(u64 stamp, const message& msg, const std::string& prefix, const std::string& text) override;
|
||||
};
|
||||
|
||||
static file_listener* get_logger()
|
||||
{
|
||||
// Use magic static
|
||||
static file_listener logger("RPCS3.log");
|
||||
return &logger;
|
||||
}
|
||||
|
||||
static u64 get_stamp()
|
||||
{
|
||||
static struct time_initializer
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER freq;
|
||||
LARGE_INTEGER start;
|
||||
|
||||
time_initializer()
|
||||
{
|
||||
QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&start);
|
||||
}
|
||||
#else
|
||||
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
|
||||
#endif
|
||||
|
||||
u64 get() const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER now;
|
||||
QueryPerformanceCounter(&now);
|
||||
const LONGLONG diff = now.QuadPart - start.QuadPart;
|
||||
return diff / freq.QuadPart * 1'000'000 + diff % freq.QuadPart * 1'000'000 / freq.QuadPart;
|
||||
#else
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - start).count();
|
||||
#endif
|
||||
}
|
||||
} timebase{};
|
||||
|
||||
return timebase.get();
|
||||
}
|
||||
|
||||
channel GENERAL(nullptr, level::notice);
|
||||
channel LOADER("LDR", level::notice);
|
||||
channel MEMORY("MEM", level::notice);
|
||||
channel RSX("RSX", level::notice);
|
||||
channel HLE("HLE", level::notice);
|
||||
channel PPU("PPU", level::notice);
|
||||
channel SPU("SPU", level::notice);
|
||||
channel ARMv7("ARMv7");
|
||||
}
|
||||
|
||||
logs::listener::~listener()
|
||||
{
|
||||
}
|
||||
|
||||
void logs::listener::add(logs::listener* _new)
|
||||
{
|
||||
// Get first (main) listener
|
||||
listener* lis = get_logger();
|
||||
|
||||
// Install new listener at the end of linked list
|
||||
while (lis->m_next || !lis->m_next.compare_and_swap_test(nullptr, _new))
|
||||
{
|
||||
lis = lis->m_next;
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
||||
void logs::message::broadcast(const char* fmt, const fmt_type_info* sup, const u64* args)
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
// Get timestamp
|
||||
const u64 stamp = get_stamp();
|
||||
|
||||
std::string text; fmt::raw_append(text, fmt, sup, args);
|
||||
std::string prefix(g_tls_log_prefix ? g_tls_log_prefix() : "");
|
||||
|
||||
// Get first (main) listener
|
||||
listener* lis = get_logger();
|
||||
|
||||
// Send message to all listeners
|
||||
while (lis)
|
||||
{
|
||||
channel.removeListener(listener);
|
||||
lis->log(stamp, *this, prefix, text);
|
||||
lis = lis->m_next;
|
||||
}
|
||||
}
|
||||
|
||||
LogManager& LogManager::getInstance()
|
||||
[[noreturn]] extern void catch_all_exceptions();
|
||||
|
||||
logs::file_writer::file_writer(const std::string& name)
|
||||
{
|
||||
if (!g_log_manager)
|
||||
try
|
||||
{
|
||||
g_log_manager.reset(new LogManager());
|
||||
if (!m_file.open(fs::get_config_dir() + name, fs::rewrite + fs::append))
|
||||
{
|
||||
fmt::throw_exception("Can't create log file %s (error %s)", name, fs::g_tls_error);
|
||||
}
|
||||
}
|
||||
|
||||
return *g_log_manager;
|
||||
}
|
||||
|
||||
LogChannel &LogManager::getChannel(LogType type)
|
||||
{
|
||||
return mChannels[static_cast<u32>(type)];
|
||||
}
|
||||
|
||||
void log_message(Log::LogType type, Log::Severity sev, const char* text)
|
||||
{
|
||||
log_message(type, sev, std::string(text));
|
||||
}
|
||||
|
||||
void log_message(Log::LogType type, Log::Severity sev, std::string text)
|
||||
{
|
||||
if (g_log_manager)
|
||||
catch (...)
|
||||
{
|
||||
// another msvc bug makes this not work, uncomment this when it's fixed
|
||||
//g_log_manager->log({logType, severity, text});
|
||||
Log::LogMessage msg{ type, sev, std::move(text) };
|
||||
g_log_manager->log(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
rMessageBox(text,
|
||||
sev == Severity::Notice ? "Notice" :
|
||||
sev == Severity::Warning ? "Warning" :
|
||||
sev == Severity::Success ? "Success" :
|
||||
sev == Severity::Error ? "Error" : "Unknown",
|
||||
sev == Severity::Notice ? rICON_INFORMATION :
|
||||
sev == Severity::Warning ? rICON_EXCLAMATION :
|
||||
sev == Severity::Error ? rICON_ERROR : rICON_INFORMATION);
|
||||
catch_all_exceptions();
|
||||
}
|
||||
}
|
||||
|
||||
void logs::file_writer::log(const char* text, std::size_t size)
|
||||
{
|
||||
m_file.write(text, size);
|
||||
}
|
||||
|
||||
void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& _text)
|
||||
{
|
||||
std::string text; text.reserve(prefix.size() + _text.size() + 200);
|
||||
|
||||
// Used character: U+00B7 (Middle Dot)
|
||||
switch (msg.sev)
|
||||
{
|
||||
case level::always: text = u8"·A "; break;
|
||||
case level::fatal: text = u8"·F "; break;
|
||||
case level::error: text = u8"·E "; break;
|
||||
case level::todo: text = u8"·U "; break;
|
||||
case level::success: text = u8"·S "; break;
|
||||
case level::warning: text = u8"·W "; break;
|
||||
case level::notice: text = u8"·! "; break;
|
||||
case level::trace: text = u8"·T "; break;
|
||||
}
|
||||
|
||||
// Print miscosecond timestamp
|
||||
const u64 hours = stamp / 3600'000'000;
|
||||
const u64 mins = (stamp % 3600'000'000) / 60'000'000;
|
||||
const u64 secs = (stamp % 60'000'000) / 1'000'000;
|
||||
const u64 frac = (stamp % 1'000'000);
|
||||
fmt::append(text, "%u:%02u:%02u.%06u ", hours, mins, secs, frac);
|
||||
|
||||
if (prefix.size() > 0)
|
||||
{
|
||||
text += "{";
|
||||
text += prefix;
|
||||
text += "} ";
|
||||
}
|
||||
|
||||
if (msg.ch->name)
|
||||
{
|
||||
text += msg.ch->name;
|
||||
text += msg.sev == level::todo ? " TODO: " : ": ";
|
||||
}
|
||||
else if (msg.sev == level::todo)
|
||||
{
|
||||
text += "TODO: ";
|
||||
}
|
||||
|
||||
text += _text;
|
||||
text += '\n';
|
||||
|
||||
file_writer::log(text.data(), text.size());
|
||||
}
|
||||
|
||||
+93
-113
@@ -1,135 +1,115 @@
|
||||
#pragma once
|
||||
#include "Utilities/MTRingbuffer.h"
|
||||
|
||||
//#define BUFFERED_LOGGING 1
|
||||
#include "types.h"
|
||||
#include "Atomic.h"
|
||||
#include "StrFmt.h"
|
||||
|
||||
//first parameter is of type Log::LogType and text is of type std::string
|
||||
|
||||
#define LOG_SUCCESS(logType, text, ...) log_message(logType, Log::Severity::Success, text, ##__VA_ARGS__)
|
||||
#define LOG_NOTICE(logType, text, ...) log_message(logType, Log::Severity::Notice, text, ##__VA_ARGS__)
|
||||
#define LOG_WARNING(logType, text, ...) log_message(logType, Log::Severity::Warning, text, ##__VA_ARGS__)
|
||||
#define LOG_ERROR(logType, text, ...) log_message(logType, Log::Severity::Error, text, ##__VA_ARGS__)
|
||||
|
||||
namespace Log
|
||||
namespace logs
|
||||
{
|
||||
const unsigned int MAX_LOG_BUFFER_LENGTH = 1024*1024;
|
||||
const unsigned int gBuffSize = 1000;
|
||||
|
||||
enum LogType : u32
|
||||
enum class level : uint
|
||||
{
|
||||
GENERAL = 0,
|
||||
LOADER,
|
||||
MEMORY,
|
||||
RSX,
|
||||
HLE,
|
||||
PPU,
|
||||
SPU,
|
||||
ARMv7,
|
||||
TTY,
|
||||
always, // highest level (unused, cannot be disabled)
|
||||
fatal,
|
||||
error,
|
||||
todo,
|
||||
success,
|
||||
warning,
|
||||
notice,
|
||||
trace, // lowest level (usually disabled)
|
||||
};
|
||||
|
||||
struct channel;
|
||||
|
||||
struct LogTypeName
|
||||
// Message information (temporary data)
|
||||
struct message
|
||||
{
|
||||
LogType mType;
|
||||
std::string mName;
|
||||
const channel* ch;
|
||||
level sev;
|
||||
|
||||
// Send log message to global logger instance
|
||||
void broadcast(const char*, const fmt_type_info*, const u64*);
|
||||
};
|
||||
|
||||
//well I'd love make_array() but alas manually counting is not the end of the world
|
||||
static const std::array<LogTypeName, 9> gTypeNameTable = { {
|
||||
{ GENERAL, "G: " },
|
||||
{ LOADER, "LDR: " },
|
||||
{ MEMORY, "MEM: " },
|
||||
{ RSX, "RSX: " },
|
||||
{ HLE, "HLE: " },
|
||||
{ PPU, "PPU: " },
|
||||
{ SPU, "SPU: " },
|
||||
{ ARMv7, "ARM: " },
|
||||
{ TTY, "TTY: " }
|
||||
} };
|
||||
|
||||
enum class Severity : u32
|
||||
class listener
|
||||
{
|
||||
Notice = 0,
|
||||
Warning,
|
||||
Success,
|
||||
Error,
|
||||
// Next listener (linked list)
|
||||
atomic_t<listener*> m_next{};
|
||||
|
||||
friend struct message;
|
||||
|
||||
public:
|
||||
constexpr listener() = default;
|
||||
|
||||
virtual ~listener();
|
||||
|
||||
// Process log message
|
||||
virtual void log(u64 stamp, const message& msg, const std::string& prefix, const std::string& text) = 0;
|
||||
|
||||
// Add new listener
|
||||
static void add(listener*);
|
||||
};
|
||||
|
||||
struct LogMessage
|
||||
struct channel
|
||||
{
|
||||
using size_type = u32;
|
||||
LogType mType;
|
||||
Severity mServerity;
|
||||
std::string mText;
|
||||
// Channel prefix (added to every log message)
|
||||
const char* const name;
|
||||
|
||||
u32 size() const;
|
||||
void serialize(char *output) const;
|
||||
static LogMessage deserialize(char *input, u32* size_out=nullptr);
|
||||
// The lowest logging level enabled for this channel (used for early filtering)
|
||||
atomic_t<level> enabled;
|
||||
|
||||
// Constant initialization: name and initial log level
|
||||
constexpr channel(const char* name, level enabled = level::trace)
|
||||
: name(name)
|
||||
, enabled(enabled)
|
||||
{
|
||||
}
|
||||
|
||||
// Formatting function
|
||||
template<typename... Args>
|
||||
SAFE_BUFFERS FORCE_INLINE void format(level sev, const char* fmt, const Args&... args) const
|
||||
{
|
||||
if (UNLIKELY(sev <= enabled))
|
||||
{
|
||||
message{this, sev}.broadcast(fmt, fmt::get_type_info<fmt_unveil_t<Args>...>(), fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||
}
|
||||
}
|
||||
|
||||
#define GEN_LOG_METHOD(_sev)\
|
||||
template<typename... Args>\
|
||||
SAFE_BUFFERS void _sev(const char* fmt, const Args&... args) const\
|
||||
{\
|
||||
return format<Args...>(level::_sev, fmt, args...);\
|
||||
}
|
||||
|
||||
GEN_LOG_METHOD(fatal)
|
||||
GEN_LOG_METHOD(error)
|
||||
GEN_LOG_METHOD(todo)
|
||||
GEN_LOG_METHOD(success)
|
||||
GEN_LOG_METHOD(warning)
|
||||
GEN_LOG_METHOD(notice)
|
||||
GEN_LOG_METHOD(trace)
|
||||
|
||||
#undef GEN_LOG_METHOD
|
||||
};
|
||||
|
||||
struct LogListener
|
||||
{
|
||||
virtual ~LogListener() {};
|
||||
virtual void log(const LogMessage &msg) = 0;
|
||||
};
|
||||
/* Small set of predefined channels */
|
||||
|
||||
struct LogChannel
|
||||
{
|
||||
LogChannel();
|
||||
LogChannel(const std::string& name);
|
||||
LogChannel(LogChannel& other) = delete;
|
||||
LogChannel& operator = (LogChannel& other) = delete;
|
||||
void log(const LogMessage &msg);
|
||||
void addListener(std::shared_ptr<LogListener> listener);
|
||||
void removeListener(std::shared_ptr<LogListener> listener);
|
||||
std::string name;
|
||||
private:
|
||||
bool mEnabled;
|
||||
Severity mLogLevel;
|
||||
std::mutex mListenerLock;
|
||||
std::set<std::shared_ptr<LogListener>> mListeners;
|
||||
};
|
||||
|
||||
struct LogManager
|
||||
{
|
||||
LogManager();
|
||||
~LogManager();
|
||||
static LogManager& getInstance();
|
||||
LogChannel& getChannel(LogType type);
|
||||
void log(LogMessage msg);
|
||||
void addListener(std::shared_ptr<LogListener> listener);
|
||||
void removeListener(std::shared_ptr<LogListener> listener);
|
||||
#ifdef BUFFERED_LOGGING
|
||||
void consumeLog();
|
||||
#endif
|
||||
private:
|
||||
#ifdef BUFFERED_LOGGING
|
||||
MTRingbuffer<char, MAX_LOG_BUFFER_LENGTH> mBuffer;
|
||||
std::condition_variable mBufferReady;
|
||||
std::mutex mStatusMut;
|
||||
std::atomic<bool> mExiting;
|
||||
std::thread mLogConsumer;
|
||||
#endif
|
||||
std::array<LogChannel, std::tuple_size<decltype(gTypeNameTable)>::value> mChannels;
|
||||
//std::array<LogChannel,gTypeNameTable.size()> mChannels; //TODO: use this once Microsoft sorts their shit out
|
||||
};
|
||||
extern channel GENERAL;
|
||||
extern channel LOADER;
|
||||
extern channel MEMORY;
|
||||
extern channel RSX;
|
||||
extern channel HLE;
|
||||
extern channel PPU;
|
||||
extern channel SPU;
|
||||
extern channel ARMv7;
|
||||
}
|
||||
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::GENERAL; } } GENERAL;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::LOADER; } } LOADER;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::MEMORY; } } MEMORY;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::RSX; } } RSX;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::HLE; } } HLE;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::PPU; } } PPU;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::SPU; } } SPU;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::ARMv7; } } ARMv7;
|
||||
static struct { inline operator Log::LogType() { return Log::LogType::TTY; } } TTY;
|
||||
// Legacy:
|
||||
|
||||
void log_message(Log::LogType type, Log::Severity sev, const char* text);
|
||||
void log_message(Log::LogType type, Log::Severity sev, std::string text);
|
||||
|
||||
template<typename... Args> never_inline void log_message(Log::LogType type, Log::Severity sev, const char* fmt, Args... args)
|
||||
{
|
||||
log_message(type, sev, fmt::format(fmt, fmt::do_unveil(args)...));
|
||||
}
|
||||
#define LOG_SUCCESS(ch, fmt, ...) logs::ch.success("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_NOTICE(ch, fmt, ...) logs::ch.notice ("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_WARNING(ch, fmt, ...) logs::ch.warning("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_ERROR(ch, fmt, ...) logs::ch.error ("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_TODO(ch, fmt, ...) logs::ch.todo ("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_TRACE(ch, fmt, ...) logs::ch.trace ("" fmt, ##__VA_ARGS__)
|
||||
#define LOG_FATAL(ch, fmt, ...) logs::ch.fatal ("" fmt, ##__VA_ARGS__)
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
Show();
|
||||
}
|
||||
|
||||
force_inline void Update(const u8 thread_id, const u64 value, const wxString& msg)
|
||||
void Update(const u8 thread_id, const u64 value, const wxString& msg)
|
||||
{
|
||||
if(thread_id > m_cores) return;
|
||||
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
//Simple non-resizable FIFO Ringbuffer that can be simultaneously be read from and written to
|
||||
//if we ever get to use boost please replace this with boost::circular_buffer, there's no reason
|
||||
//why we would have to keep this amateur attempt at such a fundamental data-structure around
|
||||
template< typename T, unsigned int MAX_MTRINGBUFFER_BUFFER_SIZE>
|
||||
class MTRingbuffer{
|
||||
std::array<T, MAX_MTRINGBUFFER_BUFFER_SIZE> mBuffer;
|
||||
//this is a recursive mutex because the get methods lock it but the only
|
||||
//way to be sure that they do not block is to check the size and the only
|
||||
//way to check the size and use get atomically is to lock this mutex,
|
||||
//so it goes:
|
||||
//lock get mutex-->check size-->call get-->lock get mutex-->unlock get mutex-->return from get-->unlock get mutex
|
||||
std::recursive_mutex mMutGet;
|
||||
std::mutex mMutPut;
|
||||
|
||||
size_t mGet;
|
||||
size_t mPut;
|
||||
size_t moveGet(size_t by = 1){ return (mGet + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; }
|
||||
size_t movePut(size_t by = 1){ return (mPut + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; }
|
||||
public:
|
||||
MTRingbuffer() : mGet(0), mPut(0){}
|
||||
|
||||
//blocks until there's something to get, so check "spaceLeft()" if you want to avoid blocking
|
||||
//also lock the get mutex around the spaceLeft() check and the pop if you want to avoid racing
|
||||
T pop()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mMutGet);
|
||||
while (mGet == mPut)
|
||||
{
|
||||
//wait until there's actually something to get
|
||||
//throwing an exception might be better, blocking here is a little awkward
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
size_t ret = mGet;
|
||||
mGet = moveGet();
|
||||
return mBuffer[ret];
|
||||
}
|
||||
|
||||
//blocks if the buffer is full until there's enough room
|
||||
void push(T &putEle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutPut);
|
||||
while (movePut() == mGet)
|
||||
{
|
||||
//if this is reached a lot it's time to increase the buffer size
|
||||
//or implement dynamic re-sizing
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
mBuffer[mPut] = std::forward(putEle);
|
||||
mPut = movePut();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return mGet == mPut;
|
||||
}
|
||||
|
||||
//returns the amount of free places, this is the amount of actual free spaces-1
|
||||
//since mGet==mPut signals an empty buffer we can't actually use the last free
|
||||
//space, so we shouldn't report it as free.
|
||||
size_t spaceLeft() //apparently free() is a macro definition in msvc in some conditions
|
||||
{
|
||||
if (mGet < mPut)
|
||||
{
|
||||
return mBuffer.size() - (mPut - mGet) - 1;
|
||||
}
|
||||
else if (mGet > mPut)
|
||||
{
|
||||
return mGet - mPut - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBuffer.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
//the magic -1 is the same magic 1 that is explained in the spaceLeft() function
|
||||
return mBuffer.size() - spaceLeft() - 1;
|
||||
}
|
||||
|
||||
//takes random access iterator to T
|
||||
template<typename IteratorType>
|
||||
void pushRange(IteratorType from, IteratorType until)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutPut);
|
||||
size_t length = until - from;
|
||||
|
||||
//if whatever we're trying to store is greater than the entire buffer the following loop will be infinite
|
||||
assert(mBuffer.size() > length);
|
||||
while (spaceLeft() < length)
|
||||
{
|
||||
//if this is reached a lot it's time to increase the buffer size
|
||||
//or implement dynamic re-sizing
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
if (mPut + length <= mBuffer.size())
|
||||
{
|
||||
std::copy(from, until, mBuffer.begin() + mPut);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t tillEnd = mBuffer.size() - mPut;
|
||||
std::copy(from, from + tillEnd, mBuffer.begin() + mPut);
|
||||
std::copy(from + tillEnd, until, mBuffer.begin());
|
||||
}
|
||||
mPut = movePut(length);
|
||||
|
||||
}
|
||||
|
||||
//takes output iterator to T
|
||||
template<typename IteratorType>
|
||||
void popN(IteratorType output, size_t n)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mMutGet);
|
||||
//make sure we're not trying to retrieve more than is in
|
||||
assert(n <= size());
|
||||
peekN<IteratorType>(output, n);
|
||||
mGet = moveGet(n);
|
||||
}
|
||||
|
||||
//takes output iterator to T
|
||||
template<typename IteratorType>
|
||||
void peekN(IteratorType output, size_t n)
|
||||
{
|
||||
size_t lGet = mGet;
|
||||
if (lGet + n <= mBuffer.size())
|
||||
{
|
||||
std::copy_n(mBuffer.begin() + lGet, n, output);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto next = std::copy(mBuffer.begin() + lGet, mBuffer.end(), output);
|
||||
std::copy_n(mBuffer.begin(), n - (mBuffer.size() - lGet), next);
|
||||
}
|
||||
}
|
||||
|
||||
//well this is just asking for trouble
|
||||
//but the comment above the declaration of mMutGet explains why it's there
|
||||
//if there's a better way please remove this
|
||||
void lockGet()
|
||||
{
|
||||
mMutGet.lock();
|
||||
}
|
||||
|
||||
//well this is just asking for trouble
|
||||
//but the comment above the declaration of mMutGet explains why it's there
|
||||
//if there's a better way please remove this
|
||||
void unlockGet()
|
||||
{
|
||||
mMutGet.unlock();
|
||||
}
|
||||
};
|
||||
@@ -1,120 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Semaphore.h"
|
||||
|
||||
bool semaphore_t::try_wait()
|
||||
{
|
||||
// check m_value without interlocked op
|
||||
if (m_var.load().value == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// try to decrement m_value atomically
|
||||
const auto old = m_var.atomic_op([](sync_var_t& var)
|
||||
{
|
||||
if (var.value)
|
||||
{
|
||||
var.value--;
|
||||
}
|
||||
});
|
||||
|
||||
// recheck atomic result
|
||||
if (old.value == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool semaphore_t::try_post()
|
||||
{
|
||||
// check m_value without interlocked op
|
||||
if (m_var.load().value >= max_value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// try to increment m_value atomically
|
||||
const auto old = m_var.atomic_op([&](sync_var_t& var)
|
||||
{
|
||||
if (var.value < max_value)
|
||||
{
|
||||
var.value++;
|
||||
}
|
||||
});
|
||||
|
||||
// recheck atomic result
|
||||
if (old.value >= max_value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (old.waiters)
|
||||
{
|
||||
// notify waiting thread
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
m_cv.notify_one();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void semaphore_t::wait()
|
||||
{
|
||||
if (m_var.atomic_op([](sync_var_t& var) -> bool
|
||||
{
|
||||
if (var.value)
|
||||
{
|
||||
var.value--;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//var.waiters++;
|
||||
|
||||
return false;
|
||||
}
|
||||
}))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_var.atomic_op([](sync_var_t& var)
|
||||
{
|
||||
var.waiters++;
|
||||
});
|
||||
|
||||
while (!m_var.atomic_op([](sync_var_t& var) -> bool
|
||||
{
|
||||
if (var.value)
|
||||
{
|
||||
var.value--;
|
||||
var.waiters--;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}))
|
||||
{
|
||||
m_cv.wait(lock);
|
||||
}
|
||||
}
|
||||
|
||||
bool semaphore_t::post_and_wait()
|
||||
{
|
||||
// TODO: merge these functions? Probably has a race condition.
|
||||
if (try_wait()) return false;
|
||||
|
||||
try_post();
|
||||
wait();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
class semaphore_t
|
||||
{
|
||||
// semaphore mutex
|
||||
std::mutex m_mutex;
|
||||
|
||||
// semaphore condition variable
|
||||
std::condition_variable m_cv;
|
||||
|
||||
struct sync_var_t
|
||||
{
|
||||
u32 value; // current semaphore value
|
||||
u32 waiters; // current amount of waiters
|
||||
};
|
||||
|
||||
// current semaphore value
|
||||
atomic_t<sync_var_t> m_var;
|
||||
|
||||
public:
|
||||
// max semaphore value
|
||||
const u32 max_value;
|
||||
|
||||
semaphore_t(u32 max_value = 1, u32 value = 0)
|
||||
: m_var(sync_var_t{ value, 0 })
|
||||
, max_value(max_value)
|
||||
{
|
||||
}
|
||||
|
||||
bool try_wait();
|
||||
|
||||
bool try_post();
|
||||
|
||||
void wait();
|
||||
|
||||
bool post_and_wait();
|
||||
};
|
||||
@@ -1,152 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "SharedMutex.h"
|
||||
|
||||
static const u32 MAX_READERS = 0x7fffffff; // 2^31-1
|
||||
|
||||
inline bool shared_mutex_t::try_lock_shared()
|
||||
{
|
||||
return m_info.atomic_op([](ownership_info_t& info) -> bool
|
||||
{
|
||||
if (info.readers < MAX_READERS && !info.writers && !info.waiting_readers && !info.waiting_writers)
|
||||
{
|
||||
info.readers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void shared_mutex_t::lock_shared()
|
||||
{
|
||||
if (!try_lock_shared())
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_wrcv.wait(lock, WRAP_EXPR(m_info.atomic_op([](ownership_info_t& info) -> bool
|
||||
{
|
||||
if (info.waiting_readers < UINT16_MAX)
|
||||
{
|
||||
info.waiting_readers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})));
|
||||
|
||||
m_rcv.wait(lock, WRAP_EXPR(m_info.atomic_op([](ownership_info_t& info) -> bool
|
||||
{
|
||||
if (!info.writers && !info.waiting_writers && info.readers < MAX_READERS)
|
||||
{
|
||||
info.readers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})));
|
||||
|
||||
const auto info = m_info.atomic_op([](ownership_info_t& info)
|
||||
{
|
||||
if (!info.waiting_readers--)
|
||||
{
|
||||
throw EXCEPTION("Invalid value");
|
||||
}
|
||||
});
|
||||
|
||||
if (info.waiting_readers == UINT16_MAX)
|
||||
{
|
||||
m_wrcv.notify_one();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void shared_mutex_t::unlock_shared()
|
||||
{
|
||||
const auto info = m_info.atomic_op([](ownership_info_t& info)
|
||||
{
|
||||
if (!info.readers--)
|
||||
{
|
||||
throw EXCEPTION("Not locked");
|
||||
}
|
||||
});
|
||||
|
||||
const bool notify_writers = info.readers == 1 && info.writers;
|
||||
const bool notify_readers = info.readers == UINT32_MAX && info.waiting_readers;
|
||||
|
||||
if (notify_writers || notify_readers)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (notify_writers) m_wcv.notify_one();
|
||||
if (notify_readers) m_rcv.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
inline bool shared_mutex_t::try_lock()
|
||||
{
|
||||
return m_info.compare_and_swap_test({ 0, 0, 0, 0 }, { 0, 1, 0, 0 });
|
||||
}
|
||||
|
||||
void shared_mutex_t::lock()
|
||||
{
|
||||
if (!try_lock())
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_wwcv.wait(lock, WRAP_EXPR(m_info.atomic_op([](ownership_info_t& info) -> bool
|
||||
{
|
||||
if (info.waiting_writers < UINT16_MAX)
|
||||
{
|
||||
info.waiting_writers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})));
|
||||
|
||||
m_wcv.wait(lock, WRAP_EXPR(m_info.atomic_op([](ownership_info_t& info) -> bool
|
||||
{
|
||||
if (!info.writers)
|
||||
{
|
||||
info.writers++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})));
|
||||
|
||||
m_wcv.wait(lock, WRAP_EXPR(m_info.load().readers == 0));
|
||||
|
||||
const auto info = m_info.atomic_op([](ownership_info_t& info)
|
||||
{
|
||||
if (!info.waiting_writers--)
|
||||
{
|
||||
throw EXCEPTION("Invalid value");
|
||||
}
|
||||
});
|
||||
|
||||
if (info.waiting_writers == UINT16_MAX)
|
||||
{
|
||||
m_wwcv.notify_one();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void shared_mutex_t::unlock()
|
||||
{
|
||||
const auto info = m_info.atomic_op([](ownership_info_t& info)
|
||||
{
|
||||
if (!info.writers--)
|
||||
{
|
||||
throw EXCEPTION("Not locked");
|
||||
}
|
||||
});
|
||||
|
||||
if (info.waiting_writers || info.waiting_readers)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (info.waiting_writers) m_wcv.notify_one();
|
||||
else if (info.waiting_readers) m_rcv.notify_all();
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <shared_mutex>
|
||||
|
||||
// An attempt to create lock-free (in optimistic case) implementation similar to std::shared_mutex;
|
||||
// MSVC implementation of std::shared_timed_mutex is not lock-free and thus may be slow, and std::shared_mutex is not available.
|
||||
class shared_mutex_t
|
||||
{
|
||||
struct ownership_info_t
|
||||
{
|
||||
u32 readers : 31;
|
||||
u32 writers : 1;
|
||||
u16 waiting_readers;
|
||||
u16 waiting_writers;
|
||||
};
|
||||
|
||||
atomic_t<ownership_info_t> m_info{};
|
||||
|
||||
std::mutex m_mutex;
|
||||
|
||||
std::condition_variable m_rcv;
|
||||
std::condition_variable m_wcv;
|
||||
std::condition_variable m_wrcv;
|
||||
std::condition_variable m_wwcv;
|
||||
|
||||
public:
|
||||
shared_mutex_t() = default;
|
||||
|
||||
// Lock in shared mode
|
||||
void lock_shared();
|
||||
|
||||
// Try to lock in shared mode
|
||||
bool try_lock_shared();
|
||||
|
||||
// Unlock in shared mode
|
||||
void unlock_shared();
|
||||
|
||||
// Lock exclusively
|
||||
void lock();
|
||||
|
||||
// Try to lock exclusively
|
||||
bool try_lock();
|
||||
|
||||
// Unlock exclusively
|
||||
void unlock();
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/CPU/CPUThread.h"
|
||||
|
||||
#include "SleepQueue.h"
|
||||
|
||||
void sleep_queue_entry_t::add_entry()
|
||||
{
|
||||
m_queue.emplace_back(m_thread.shared_from_this());
|
||||
}
|
||||
|
||||
void sleep_queue_entry_t::remove_entry()
|
||||
{
|
||||
for (auto it = m_queue.begin(); it != m_queue.end(); it++)
|
||||
{
|
||||
if (it->get() == &m_thread)
|
||||
{
|
||||
m_queue.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool sleep_queue_entry_t::find() const
|
||||
{
|
||||
for (auto it = m_queue.begin(); it != m_queue.end(); it++)
|
||||
{
|
||||
if (it->get() == &m_thread)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
sleep_queue_entry_t::sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue)
|
||||
: m_thread(cpu)
|
||||
, m_queue(queue)
|
||||
{
|
||||
add_entry();
|
||||
cpu.sleep();
|
||||
}
|
||||
|
||||
sleep_queue_entry_t::sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue, const defer_sleep_t&)
|
||||
: m_thread(cpu)
|
||||
, m_queue(queue)
|
||||
{
|
||||
cpu.sleep();
|
||||
}
|
||||
|
||||
sleep_queue_entry_t::~sleep_queue_entry_t()
|
||||
{
|
||||
remove_entry();
|
||||
m_thread.awake();
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
class CPUThread;
|
||||
|
||||
using sleep_queue_t = std::deque<std::shared_ptr<CPUThread>>;
|
||||
|
||||
static struct defer_sleep_t {} const defer_sleep{};
|
||||
|
||||
// automatic object handling a thread entry in the sleep queue
|
||||
class sleep_queue_entry_t final
|
||||
{
|
||||
CPUThread& m_thread;
|
||||
sleep_queue_t& m_queue;
|
||||
|
||||
void add_entry();
|
||||
void remove_entry();
|
||||
bool find() const;
|
||||
|
||||
public:
|
||||
// add specified thread to the sleep queue
|
||||
sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue);
|
||||
|
||||
// don't add specified thread to the sleep queue
|
||||
sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue, const defer_sleep_t&);
|
||||
|
||||
// removes specified thread from the sleep queue if added
|
||||
~sleep_queue_entry_t();
|
||||
|
||||
// add thread to the sleep queue
|
||||
inline void enter()
|
||||
{
|
||||
add_entry();
|
||||
}
|
||||
|
||||
// remove thread from the sleep queue
|
||||
inline void leave()
|
||||
{
|
||||
remove_entry();
|
||||
}
|
||||
|
||||
// check whether the thread exists in the sleep queue
|
||||
inline explicit operator bool() const
|
||||
{
|
||||
return find();
|
||||
}
|
||||
};
|
||||
+322
-163
@@ -1,80 +1,297 @@
|
||||
#include "stdafx.h"
|
||||
#pragma warning(push)
|
||||
#pragma message("TODO: remove wx dependency: <wx/string.h>")
|
||||
#pragma warning(disable : 4996)
|
||||
#include <wx/string.h>
|
||||
#pragma warning(pop)
|
||||
#include "StrFmt.h"
|
||||
#include "BEType.h"
|
||||
#include "StrUtil.h"
|
||||
#include "cfmt.h"
|
||||
|
||||
std::string v128::to_hex() const
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
template <>
|
||||
void fmt_class_string<std::pair<const fmt_type_info*, u64>>::format(std::string& out, u64 arg)
|
||||
{
|
||||
return fmt::format("%016llx%016llx", _u64[1], _u64[0]);
|
||||
// Dynamic format arg
|
||||
const auto& pair = get_object(arg);
|
||||
|
||||
if (pair.first)
|
||||
{
|
||||
pair.first->fmt_string(out, pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
std::string v128::to_xyzw() const
|
||||
void fmt_class_string<const void*>::format(std::string& out, u64 arg)
|
||||
{
|
||||
return fmt::format("x: %g y: %g z: %g w: %g", _f[3], _f[2], _f[1], _f[0]);
|
||||
if (arg)
|
||||
{
|
||||
fmt::append(out, "%p", reinterpret_cast<const void*>(static_cast<std::uintptr_t>(arg)));
|
||||
}
|
||||
else
|
||||
{
|
||||
out += "(NULL)";
|
||||
}
|
||||
}
|
||||
|
||||
std::string fmt::to_hex(u64 value, size_t count)
|
||||
void fmt_class_string<const char*>::format(std::string& out, u64 arg)
|
||||
{
|
||||
assert(count - 1 < 16);
|
||||
count = std::max<u64>(count, 16 - cntlz64(value) / 4);
|
||||
|
||||
char res[16] = {};
|
||||
|
||||
for (size_t i = count - 1; ~i; i--, value /= 16)
|
||||
if (arg)
|
||||
{
|
||||
res[i] = "0123456789abcdef"[value % 16];
|
||||
out += reinterpret_cast<const char*>(static_cast<std::uintptr_t>(arg));
|
||||
}
|
||||
else
|
||||
{
|
||||
out += "(NULL)";
|
||||
}
|
||||
|
||||
return std::string(res, count);
|
||||
}
|
||||
|
||||
std::string fmt::to_udec(u64 value)
|
||||
template <>
|
||||
void fmt_class_string<std::string>::format(std::string& out, u64 arg)
|
||||
{
|
||||
char res[20] = {};
|
||||
size_t first = sizeof(res);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
res[--first] = '0';
|
||||
}
|
||||
|
||||
for (; value; value /= 10)
|
||||
{
|
||||
res[--first] = '0' + (value % 10);
|
||||
}
|
||||
|
||||
return std::string(&res[first], sizeof(res) - first);
|
||||
out += get_object(arg).c_str(); // TODO?
|
||||
}
|
||||
|
||||
std::string fmt::to_sdec(s64 svalue)
|
||||
template <>
|
||||
void fmt_class_string<std::vector<char>>::format(std::string& out, u64 arg)
|
||||
{
|
||||
const bool sign = svalue < 0;
|
||||
u64 value = sign ? -svalue : svalue;
|
||||
|
||||
char res[20] = {};
|
||||
size_t first = sizeof(res);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
res[--first] = '0';
|
||||
}
|
||||
|
||||
for (; value; value /= 10)
|
||||
{
|
||||
res[--first] = '0' + (value % 10);
|
||||
}
|
||||
|
||||
if (sign)
|
||||
{
|
||||
res[--first] = '-';
|
||||
}
|
||||
|
||||
return std::string(&res[first], sizeof(res) - first);
|
||||
const std::vector<char>& obj = get_object(arg);
|
||||
out.append(obj.cbegin(), obj.cend());
|
||||
}
|
||||
|
||||
//extern const std::string fmt::placeholder = "???";
|
||||
template <>
|
||||
void fmt_class_string<char>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#hhx", static_cast<char>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<uchar>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#hhx", static_cast<uchar>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<schar>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#hhx", static_cast<schar>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<short>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#hx", static_cast<short>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<ushort>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#hx", static_cast<ushort>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<int>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#x", static_cast<int>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<uint>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#x", static_cast<uint>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<long>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#lx", static_cast<long>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<ulong>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#lx", static_cast<ulong>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<llong>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#llx", static_cast<llong>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<ullong>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%#llx", static_cast<ullong>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<float>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%gf", static_cast<float>(reinterpret_cast<f64&>(arg)));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<double>::format(std::string& out, u64 arg)
|
||||
{
|
||||
fmt::append(out, "%g", reinterpret_cast<f64&>(arg));
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<bool>::format(std::string& out, u64 arg)
|
||||
{
|
||||
out += arg ? "true" : "false";
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<v128>::format(std::string& out, u64 arg)
|
||||
{
|
||||
const v128& vec = get_object(arg);
|
||||
fmt::append(out, "0x%016llx%016llx", vec._u64[1], vec._u64[0]);
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
void raw_error(const char* msg)
|
||||
{
|
||||
throw std::runtime_error{msg};
|
||||
}
|
||||
|
||||
void raw_verify_error(const char* msg, const fmt_type_info* sup, u64 arg)
|
||||
{
|
||||
std::string out{"Verification failed"};
|
||||
|
||||
// Print error code (may be irrelevant)
|
||||
#ifdef _WIN32
|
||||
if (DWORD error = GetLastError())
|
||||
{
|
||||
fmt::append(out, " (e=%#x)", error);
|
||||
}
|
||||
#else
|
||||
if (int error = errno)
|
||||
{
|
||||
fmt::append(out, " (e=%d)", error);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sup)
|
||||
{
|
||||
out += " (";
|
||||
sup->fmt_string(out, arg); // Print value
|
||||
out += ")";
|
||||
}
|
||||
|
||||
if (msg)
|
||||
{
|
||||
out += ": ";
|
||||
out += msg;
|
||||
}
|
||||
|
||||
throw std::runtime_error{out};
|
||||
}
|
||||
|
||||
void raw_narrow_error(const char* msg, const fmt_type_info* sup, u64 arg)
|
||||
{
|
||||
std::string out{"Narrow error"};
|
||||
|
||||
if (sup)
|
||||
{
|
||||
out += " (";
|
||||
sup->fmt_string(out, arg); // Print value
|
||||
out += ")";
|
||||
}
|
||||
|
||||
if (msg)
|
||||
{
|
||||
out += ": ";
|
||||
out += msg;
|
||||
}
|
||||
|
||||
throw std::range_error{out};
|
||||
}
|
||||
|
||||
// Hidden template
|
||||
template <typename T>
|
||||
void raw_throw_exception(const char* fmt, const fmt_type_info* sup, const u64* args)
|
||||
{
|
||||
std::string out;
|
||||
raw_append(out, fmt, sup, args);
|
||||
throw T{out};
|
||||
}
|
||||
|
||||
// Explicit instantiations (not exhaustive)
|
||||
template void raw_throw_exception<std::runtime_error>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::logic_error>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::domain_error>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::invalid_argument>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::out_of_range>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::range_error>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::overflow_error>(const char*, const fmt_type_info*, const u64*);
|
||||
template void raw_throw_exception<std::underflow_error>(const char*, const fmt_type_info*, const u64*);
|
||||
|
||||
struct cfmt_src;
|
||||
}
|
||||
|
||||
// Temporary implementation
|
||||
struct fmt::cfmt_src
|
||||
{
|
||||
const fmt_type_info* sup;
|
||||
const u64* args;
|
||||
|
||||
bool test(std::size_t index) const
|
||||
{
|
||||
if (!sup[index].fmt_string)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get(std::size_t index) const
|
||||
{
|
||||
return *reinterpret_cast<const T*>(reinterpret_cast<const u8*>(args + index));
|
||||
}
|
||||
|
||||
void skip(std::size_t extra)
|
||||
{
|
||||
++sup += extra;
|
||||
++args += extra;
|
||||
}
|
||||
|
||||
std::size_t fmt_string(std::string& out, std::size_t extra) const
|
||||
{
|
||||
const std::size_t start = out.size();
|
||||
sup[extra].fmt_string(out, args[extra]);
|
||||
return out.size() - start;
|
||||
}
|
||||
|
||||
// Returns type size (0 if unknown, pointer, unsigned, assumed max)
|
||||
std::size_t type(std::size_t extra) const
|
||||
{
|
||||
// Hack: use known function pointers to determine type
|
||||
#define TYPE(type) \
|
||||
if (sup[extra].fmt_string == &fmt_class_string<type>::format) return sizeof(type);
|
||||
|
||||
TYPE(int);
|
||||
TYPE(llong);
|
||||
TYPE(schar);
|
||||
TYPE(short);
|
||||
if (std::is_signed<char>::value) TYPE(char);
|
||||
TYPE(long);
|
||||
|
||||
#undef TYPE
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
void fmt::raw_append(std::string& out, const char* fmt, const fmt_type_info* sup, const u64* args) noexcept
|
||||
{
|
||||
cfmt_append(out, fmt, cfmt_src{sup, args});
|
||||
}
|
||||
|
||||
std::string fmt::replace_first(const std::string& src, const std::string& from, const std::string& to)
|
||||
{
|
||||
@@ -88,7 +305,7 @@ std::string fmt::replace_first(const std::string& src, const std::string& from,
|
||||
return (pos ? src.substr(0, pos) + to : to) + std::string(src.c_str() + pos + from.length());
|
||||
}
|
||||
|
||||
std::string fmt::replace_all(const std::string &src, const std::string& from, const std::string& to)
|
||||
std::string fmt::replace_all(const std::string& src, const std::string& from, const std::string& to)
|
||||
{
|
||||
std::string target = src;
|
||||
for (auto pos = target.find(from); pos != std::string::npos; pos = target.find(from, pos + 1))
|
||||
@@ -100,83 +317,6 @@ std::string fmt::replace_all(const std::string &src, const std::string& from, co
|
||||
return target;
|
||||
}
|
||||
|
||||
//TODO: move this wx Stuff somewhere else
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string fmt::ToUTF8(const wxString& right)
|
||||
{
|
||||
auto ret = std::string(((const char *)right.utf8_str()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString fmt::FromUTF8(const std::string& right)
|
||||
{
|
||||
auto ret = wxString::FromUTF8(right.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int fmt::CmpNoCase(const std::string& a, const std::string& b)
|
||||
{
|
||||
if (a.length() != b.length())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::equal(a.begin(),
|
||||
a.end(),
|
||||
b.begin(),
|
||||
[](const char& a, const char& b){return ::tolower(a) == ::tolower(b); })
|
||||
? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
void fmt::Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm)
|
||||
{
|
||||
size_t cursor = 0;
|
||||
do
|
||||
{
|
||||
cursor = str.find(searchterm, cursor);
|
||||
if (cursor != std::string::npos)
|
||||
{
|
||||
str.replace(cursor, searchterm.size(), replaceterm);
|
||||
cursor += replaceterm.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
std::vector<std::string> fmt::rSplit(const std::string& source, const std::string& delim)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
size_t cursor = 0;
|
||||
do
|
||||
{
|
||||
size_t prevcurs = cursor;
|
||||
cursor = source.find(delim, cursor);
|
||||
if (cursor != std::string::npos)
|
||||
{
|
||||
ret.push_back(source.substr(prevcurs,cursor-prevcurs));
|
||||
cursor += delim.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.push_back(source.substr(prevcurs));
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<std::string> fmt::split(const std::string& source, std::initializer_list<std::string> separators, bool is_skip_empty)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
@@ -185,7 +325,7 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
|
||||
|
||||
for (size_t cursor_end = 0; cursor_end < source.length(); ++cursor_end)
|
||||
{
|
||||
for (auto &separator : separators)
|
||||
for (auto& separator : separators)
|
||||
{
|
||||
if (strncmp(source.c_str() + cursor_end, separator.c_str(), separator.length()) == 0)
|
||||
{
|
||||
@@ -194,7 +334,7 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
|
||||
result.push_back(candidate);
|
||||
|
||||
cursor_begin = cursor_end + separator.length();
|
||||
cursor_end = cursor_begin - 1;
|
||||
cursor_end = cursor_begin - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -208,40 +348,59 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
std::string fmt::tolower(std::string source)
|
||||
std::string fmt::trim(const std::string& source, const std::string& values)
|
||||
{
|
||||
std::transform(source.begin(), source.end(), source.begin(), ::tolower);
|
||||
std::size_t begin = source.find_first_not_of(values);
|
||||
|
||||
return source;
|
||||
if (begin == source.npos)
|
||||
return {};
|
||||
|
||||
return source.substr(begin, source.find_last_not_of(values) + 1);
|
||||
}
|
||||
|
||||
std::string fmt::toupper(std::string source)
|
||||
std::string fmt::to_upper(const std::string& string)
|
||||
{
|
||||
std::transform(source.begin(), source.end(), source.begin(), ::toupper);
|
||||
|
||||
return source;
|
||||
std::string result;
|
||||
result.resize(string.size());
|
||||
std::transform(string.begin(), string.end(), result.begin(), ::toupper);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string fmt::escape(std::string source)
|
||||
bool fmt::match(const std::string& source, const std::string& mask)
|
||||
{
|
||||
const std::pair<std::string, std::string> escape_list[] =
|
||||
{
|
||||
{ "\\", "\\\\" },
|
||||
{ "\a", "\\a" },
|
||||
{ "\b", "\\b" },
|
||||
{ "\f", "\\f" },
|
||||
{ "\n", "\\n\n" },
|
||||
{ "\r", "\\r" },
|
||||
{ "\t", "\\t" },
|
||||
{ "\v", "\\v" },
|
||||
};
|
||||
std::size_t source_position = 0, mask_position = 0;
|
||||
|
||||
source = fmt::replace_all(source, escape_list);
|
||||
|
||||
for (char c = 0; c < 32; c++)
|
||||
for (; source_position < source.size() && mask_position < mask.size(); ++mask_position, ++source_position)
|
||||
{
|
||||
if (c != '\n') source = fmt::replace_all(source, std::string(1, c), fmt::format("\\x%02X", c));
|
||||
switch (mask[mask_position])
|
||||
{
|
||||
case '?': break;
|
||||
|
||||
case '*':
|
||||
for (std::size_t test_source_position = source_position; test_source_position < source.size(); ++test_source_position)
|
||||
{
|
||||
if (match(source.substr(test_source_position), mask.substr(mask_position + 1)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
if (source[source_position] != mask[mask_position])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
if (source_position != source.size())
|
||||
return false;
|
||||
|
||||
if (mask_position != mask.size())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+230
-319
@@ -1,354 +1,265 @@
|
||||
#pragma once
|
||||
|
||||
class wxString;
|
||||
#include "types.h"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
//struct empty_t{};
|
||||
template <typename... Args>
|
||||
static std::string format(const char*, const Args&...);
|
||||
}
|
||||
|
||||
//extern const std::string placeholder;
|
||||
template <typename T, typename>
|
||||
struct fmt_unveil
|
||||
{
|
||||
static_assert(sizeof(T) > 0, "fmt_unveil<>: cannot pass forward-declared object");
|
||||
|
||||
template <typename T>
|
||||
std::string AfterLast(const std::string& source, T searchstr)
|
||||
using type = T;
|
||||
|
||||
static inline u64 get(const T& arg)
|
||||
{
|
||||
size_t search_pos = source.rfind(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(search_pos);
|
||||
return reinterpret_cast<std::uintptr_t>(&arg);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string BeforeLast(const std::string& source, T searchstr)
|
||||
// Temporary value container (can possibly be created by other fmt_unveil<> specializations)
|
||||
struct u64_wrapper
|
||||
{
|
||||
size_t search_pos = source.rfind(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(0, search_pos);
|
||||
}
|
||||
T arg;
|
||||
|
||||
template <typename T>
|
||||
std::string AfterFirst(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.find(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(search_pos);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string BeforeFirst(const std::string& source, T searchstr)
|
||||
{
|
||||
size_t search_pos = source.find(searchstr);
|
||||
search_pos = search_pos == std::string::npos ? 0 : search_pos;
|
||||
return source.substr(0, search_pos);
|
||||
}
|
||||
|
||||
// write `fmt` from `pos` to the first occurence of `fmt::placeholder` to
|
||||
// the stream `os`. Then write `arg` to to the stream. If there's no
|
||||
// `fmt::placeholder` after `pos` everything in `fmt` after pos is written
|
||||
// to `os`. Then `arg` is written to `os` after appending a space character
|
||||
//template<typename T>
|
||||
//empty_t write(const std::string &fmt, std::ostream &os, std::string::size_type &pos, T &&arg)
|
||||
//{
|
||||
// std::string::size_type ins = fmt.find(placeholder, pos);
|
||||
|
||||
// if (ins == std::string::npos)
|
||||
// {
|
||||
// os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
// os << ' ' << arg;
|
||||
|
||||
// pos = fmt.size();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// os.write(fmt.data() + pos, ins - pos);
|
||||
// os << arg;
|
||||
|
||||
// pos = ins + placeholder.size();
|
||||
// }
|
||||
// return{};
|
||||
//}
|
||||
|
||||
// typesafe version of a sprintf-like function. Returns the printed to
|
||||
// string. To mark positions where the arguments are supposed to be
|
||||
// inserted use `fmt::placeholder`. If there's not enough placeholders
|
||||
// the rest of the arguments are appended at the end, seperated by spaces
|
||||
//template<typename ... Args>
|
||||
//std::string SFormat(const std::string &fmt, Args&& ... parameters)
|
||||
//{
|
||||
// std::ostringstream os;
|
||||
// std::string::size_type pos = 0;
|
||||
// std::initializer_list<empty_t> { write(fmt, os, pos, parameters)... };
|
||||
|
||||
// if (!fmt.empty())
|
||||
// {
|
||||
// os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
// }
|
||||
|
||||
// std::string result = os.str();
|
||||
// return result;
|
||||
//}
|
||||
|
||||
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
|
||||
std::string replace_all(const std::string &src, const std::string& from, const std::string& to);
|
||||
|
||||
template<size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::string>(&list)[list_size])
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
// Allow implicit conversion
|
||||
operator u64() const
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
return reinterpret_cast<std::uintptr_t>(&arg);
|
||||
}
|
||||
};
|
||||
|
||||
// This overload resolution takes the precedence
|
||||
static inline u64_wrapper get(T&& arg)
|
||||
{
|
||||
return u64_wrapper{std::move(arg)};
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_integral<T>::value && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
static inline u64 get(T arg)
|
||||
{
|
||||
return static_cast<T>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_floating_point<T>::value && sizeof(T) <= 8 && alignof(T) <= 8>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
// Convert FP to f64 and reinterpret (TODO?)
|
||||
static inline u64 get(const f64 arg)
|
||||
{
|
||||
return *reinterpret_cast<const u64*>(reinterpret_cast<const u8*>(&arg));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T, std::enable_if_t<std::is_enum<T>::value>>
|
||||
{
|
||||
using type = T;
|
||||
|
||||
static inline u64 get(T arg)
|
||||
{
|
||||
return static_cast<std::underlying_type_t<T>>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_unveil<T*, void>
|
||||
{
|
||||
using type = const T*;
|
||||
|
||||
static inline u64 get(const T* arg)
|
||||
{
|
||||
return reinterpret_cast<std::uintptr_t>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct fmt_unveil<T[N], void>
|
||||
{
|
||||
using type = const T*;
|
||||
|
||||
static inline u64 get(const T* arg)
|
||||
{
|
||||
return reinterpret_cast<std::uintptr_t>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_unveil<b8, void>
|
||||
{
|
||||
using type = bool;
|
||||
|
||||
static inline u64 get(const b8& value)
|
||||
{
|
||||
return fmt_unveil<bool>::get(value);
|
||||
}
|
||||
};
|
||||
|
||||
// String type format provider, also type classifier (format() called if an argument is formatted as "%s")
|
||||
template <typename T, typename = void>
|
||||
struct fmt_class_string
|
||||
{
|
||||
// Formatting function (must be explicitly specialized)
|
||||
static void format(std::string& out, u64 arg);
|
||||
|
||||
// Helper typedef (visible in format())
|
||||
using type = T;
|
||||
|
||||
// Helper function (converts arg to object reference)
|
||||
static SAFE_BUFFERS FORCE_INLINE const T& get_object(u64 arg)
|
||||
{
|
||||
return *reinterpret_cast<const T*>(static_cast<std::uintptr_t>(arg));
|
||||
}
|
||||
|
||||
// Helper function (safely converts arg to enum value)
|
||||
static SAFE_BUFFERS FORCE_INLINE void format_enum(std::string& out, u64 arg, const char* (*get)(T value))
|
||||
{
|
||||
const auto value = static_cast<std::underlying_type_t<T>>(arg);
|
||||
|
||||
// Check narrowing
|
||||
if (static_cast<u64>(value) == arg)
|
||||
{
|
||||
if (const char* str = get(static_cast<T>(value)))
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
out += str;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
// Fallback to underlying type formatting
|
||||
fmt_class_string<std::underlying_type_t<T>>::format(out, static_cast<u64>(value));
|
||||
}
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
// Helper function (bitset formatting)
|
||||
static SAFE_BUFFERS FORCE_INLINE void format_bitset(std::string& out, u64 arg, const char* prefix, const char* delim, const char* suffix, void (*fmt)(std::string&, u64))
|
||||
{
|
||||
// Start from raw value
|
||||
fmt_class_string<u64>::format(out, arg);
|
||||
|
||||
out += prefix;
|
||||
|
||||
for (u64 i = 0; i < 63; i++)
|
||||
{
|
||||
const u64 mask = 1ull << i;
|
||||
|
||||
if (arg & mask)
|
||||
{
|
||||
fmt(out, i);
|
||||
|
||||
if (arg >> (i + 1))
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second : list[i].second) + src.substr(pos + comp_length);
|
||||
pos += list[i].second.length() - 1;
|
||||
break;
|
||||
out += delim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
if (arg & (1ull << 63))
|
||||
{
|
||||
fmt(out, 63);
|
||||
}
|
||||
|
||||
out += suffix;
|
||||
}
|
||||
|
||||
template<size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::function<std::string()>>(&list)[list_size])
|
||||
// Helper constant (may be used in format_enum as lambda return value)
|
||||
static constexpr const char* unknown = nullptr;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const void*, void>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct fmt_class_string<T*, void> : fmt_class_string<const void*, void>
|
||||
{
|
||||
// Classify all pointers as const void*
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<const char*, void>
|
||||
{
|
||||
static void format(std::string& out, u64 arg);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt_class_string<char*, void> : fmt_class_string<const char*>
|
||||
{
|
||||
// Classify char* as const char*
|
||||
};
|
||||
|
||||
struct fmt_type_info
|
||||
{
|
||||
decltype(&fmt_class_string<int>::format) fmt_string;
|
||||
|
||||
template <typename T>
|
||||
static constexpr fmt_type_info make()
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
return fmt_type_info
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second() : list[i].second()) + src.substr(pos + comp_length);
|
||||
pos += list[i].second().length() - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
&fmt_class_string<T>::format,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
std::string to_hex(u64 value, size_t count = 1);
|
||||
std::string to_udec(u64 value);
|
||||
std::string to_sdec(s64 value);
|
||||
// Argument array type (each element generated via fmt_unveil<>)
|
||||
template <typename... Args>
|
||||
using fmt_args_t = const u64(&&)[sizeof...(Args) + 1];
|
||||
|
||||
template<typename T, bool is_enum = std::is_enum<T>::value> struct unveil
|
||||
namespace fmt
|
||||
{
|
||||
template <typename... Args>
|
||||
SAFE_BUFFERS FORCE_INLINE const fmt_type_info* get_type_info()
|
||||
{
|
||||
using result_type = T;
|
||||
|
||||
force_inline static result_type get_value(const T& arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct unveil<char*, false>
|
||||
{
|
||||
using result_type = const char*;
|
||||
|
||||
force_inline static result_type get_value(const char* arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
|
||||
template<std::size_t N> struct unveil<const char[N], false>
|
||||
{
|
||||
using result_type = const char*;
|
||||
|
||||
force_inline static result_type get_value(const char(&arg)[N])
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct unveil<std::string, false>
|
||||
{
|
||||
using result_type = const char*;
|
||||
|
||||
force_inline static result_type get_value(const std::string& arg)
|
||||
{
|
||||
return arg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct unveil<T, true>
|
||||
{
|
||||
using result_type = std::underlying_type_t<T>;
|
||||
|
||||
force_inline static result_type get_value(const T& arg)
|
||||
{
|
||||
return static_cast<result_type>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, bool Se> struct unveil<se_t<T, Se>, false>
|
||||
{
|
||||
using result_type = typename unveil<T>::result_type;
|
||||
|
||||
force_inline static result_type get_value(const se_t<T, Se>& arg)
|
||||
{
|
||||
return unveil<T>::get_value(arg);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
force_inline typename unveil<T>::result_type do_unveil(const T& arg)
|
||||
{
|
||||
return unveil<T>::get_value(arg);
|
||||
}
|
||||
|
||||
// Formatting function with special functionality:
|
||||
//
|
||||
// std::string is forced to .c_str()
|
||||
// be_t<> is forced to .value() (fmt::do_unveil reverts byte order automatically)
|
||||
//
|
||||
// External specializations for fmt::do_unveil (can be found in another headers):
|
||||
// vm::ptr, vm::bptr, ... (fmt::do_unveil) (vm_ptr.h) (with appropriate address type, using .addr() can be avoided)
|
||||
// vm::ref, vm::bref, ... (fmt::do_unveil) (vm_ref.h)
|
||||
//
|
||||
template<typename... Args> safe_buffers std::string format(const char* fmt, Args... args)
|
||||
{
|
||||
// fixed stack buffer for the first attempt
|
||||
std::array<char, 4096> fixed_buf;
|
||||
|
||||
// possibly dynamically allocated buffer for the second attempt
|
||||
std::unique_ptr<char[]> buf;
|
||||
|
||||
// pointer to the current buffer
|
||||
char* buf_addr = fixed_buf.data();
|
||||
|
||||
for (std::size_t buf_size = fixed_buf.size();;)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
const std::size_t len = std::snprintf(buf_addr, buf_size, fmt, do_unveil(args)...);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (len > INT_MAX)
|
||||
{
|
||||
throw std::runtime_error("std::snprintf() failed");
|
||||
}
|
||||
|
||||
if (len < buf_size)
|
||||
{
|
||||
return{ buf_addr, len };
|
||||
}
|
||||
|
||||
buf.reset(buf_addr = new char[buf_size = len + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
struct exception : public std::exception
|
||||
{
|
||||
std::unique_ptr<char[]> message;
|
||||
|
||||
template<typename... Args> never_inline safe_buffers exception(const char* file, int line, const char* func, const char* text, Args... args) noexcept
|
||||
{
|
||||
const std::string data = format(text, args...) + format("\n(in file %s:%d, in function %s)", file, line, func);
|
||||
|
||||
message.reset(new char[data.size() + 1]);
|
||||
|
||||
std::memcpy(message.get(), data.c_str(), data.size() + 1);
|
||||
}
|
||||
|
||||
exception(const exception& other) noexcept
|
||||
{
|
||||
const std::size_t size = std::strlen(other.message.get());
|
||||
|
||||
message.reset(new char[size + 1]);
|
||||
|
||||
std::memcpy(message.get(), other.message.get(), size + 1);
|
||||
}
|
||||
|
||||
virtual const char* what() const noexcept override
|
||||
{
|
||||
return message.get();
|
||||
}
|
||||
};
|
||||
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string ToUTF8(const wxString& right);
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString FromUTF8(const std::string& right);
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int CmpNoCase(const std::string& a, const std::string& b);
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with Replace from wxString
|
||||
void Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm);
|
||||
|
||||
std::vector<std::string> rSplit(const std::string& source, const std::string& delim);
|
||||
|
||||
std::vector<std::string> split(const std::string& source, std::initializer_list<std::string> separators, bool is_skip_empty = true);
|
||||
|
||||
template<typename T>
|
||||
std::string merge(const T& source, const std::string& separator)
|
||||
{
|
||||
if (!source.size())
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
std::string result;
|
||||
|
||||
auto it = source.begin();
|
||||
auto end = source.end();
|
||||
for (--end; it != end; ++it)
|
||||
{
|
||||
result += *it + separator;
|
||||
}
|
||||
|
||||
return result + source.back();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::string merge(std::initializer_list<T> sources, const std::string& separator)
|
||||
{
|
||||
if (!sources.size())
|
||||
{
|
||||
return{};
|
||||
}
|
||||
|
||||
std::string result;
|
||||
bool first = true;
|
||||
|
||||
for (auto &v : sources)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
result = fmt::merge(v, separator);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += separator + fmt::merge(v, separator);
|
||||
}
|
||||
}
|
||||
// Constantly initialized null-terminated list of type-specific information
|
||||
static constexpr fmt_type_info result[sizeof...(Args) + 1]{fmt_type_info::make<Args>()...};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string tolower(std::string source);
|
||||
std::string toupper(std::string source);
|
||||
std::string escape(std::string source);
|
||||
// Internal formatting function
|
||||
void raw_append(std::string& out, const char*, const fmt_type_info*, const u64*) noexcept;
|
||||
|
||||
// Formatting function
|
||||
template <typename... Args>
|
||||
SAFE_BUFFERS FORCE_INLINE void append(std::string& out, const char* fmt, const Args&... args)
|
||||
{
|
||||
raw_append(out, fmt, fmt::get_type_info<fmt_unveil_t<Args>...>(), fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||
}
|
||||
|
||||
// Formatting function
|
||||
template <typename... Args>
|
||||
SAFE_BUFFERS FORCE_INLINE std::string format(const char* fmt, const Args&... args)
|
||||
{
|
||||
std::string result;
|
||||
append<Args...>(result, fmt, args...);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Internal exception message formatting template, must be explicitly specialized or instantiated in cpp to minimize code bloat
|
||||
template <typename T>
|
||||
[[noreturn]] void raw_throw_exception(const char*, const fmt_type_info*, const u64*);
|
||||
|
||||
// Throw exception with formatting
|
||||
template <typename T = std::runtime_error, typename... Args>
|
||||
[[noreturn]] SAFE_BUFFERS FORCE_INLINE void throw_exception(const char* fmt, const Args&... args)
|
||||
{
|
||||
raw_throw_exception<T>(fmt, fmt::get_type_info<fmt_unveil_t<Args>...>(), fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
// Copy null-terminated string from std::string to char array with truncation
|
||||
template <std::size_t N>
|
||||
inline void strcpy_trunc(char (&dst)[N], const std::string& src)
|
||||
{
|
||||
const std::size_t count = src.size() >= N ? N - 1 : src.size();
|
||||
std::memcpy(dst, src.c_str(), count);
|
||||
dst[count] = '\0';
|
||||
}
|
||||
|
||||
// Copy null-terminated string from char array to another char array with truncation
|
||||
template <std::size_t N, std::size_t N2>
|
||||
inline void strcpy_trunc(char (&dst)[N], const char (&src)[N2])
|
||||
{
|
||||
const std::size_t count = N2 >= N ? N - 1 : N2;
|
||||
std::memcpy(dst, src, count);
|
||||
dst[count] = '\0';
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
|
||||
std::string replace_all(const std::string& src, const std::string& from, const std::string& to);
|
||||
|
||||
template <size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::string> (&list)[list_size])
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second : list[i].second) + src.substr(pos + comp_length);
|
||||
pos += list[i].second.length() - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
template <size_t list_size>
|
||||
std::string replace_all(std::string src, const std::pair<std::string, std::function<std::string()>> (&list)[list_size])
|
||||
{
|
||||
for (size_t pos = 0; pos < src.length(); ++pos)
|
||||
{
|
||||
for (size_t i = 0; i < list_size; ++i)
|
||||
{
|
||||
const size_t comp_length = list[i].first.length();
|
||||
|
||||
if (src.length() - pos < comp_length)
|
||||
continue;
|
||||
|
||||
if (src.substr(pos, comp_length) == list[i].first)
|
||||
{
|
||||
src = (pos ? src.substr(0, pos) + list[i].second() : list[i].second()) + src.substr(pos + comp_length);
|
||||
pos += list[i].second().length() - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string& source, std::initializer_list<std::string> separators, bool is_skip_empty = true);
|
||||
std::string trim(const std::string& source, const std::string& values = " \t");
|
||||
|
||||
template <typename T>
|
||||
std::string merge(const T& source, const std::string& separator)
|
||||
{
|
||||
if (!source.size())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string result;
|
||||
|
||||
auto it = source.begin();
|
||||
auto end = source.end();
|
||||
for (--end; it != end; ++it)
|
||||
{
|
||||
result += *it + separator;
|
||||
}
|
||||
|
||||
return result + source.back();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string merge(std::initializer_list<T> sources, const std::string& separator)
|
||||
{
|
||||
if (!sources.size())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string result;
|
||||
bool first = true;
|
||||
|
||||
for (auto& v : sources)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
result = fmt::merge(v, separator);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += separator + fmt::merge(v, separator);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string to_upper(const std::string& string);
|
||||
|
||||
bool match(const std::string& source, const std::string& mask);
|
||||
}
|
||||
+911
-551
File diff suppressed because it is too large
Load Diff
+261
-389
@@ -1,445 +1,317 @@
|
||||
#pragma once
|
||||
|
||||
const class thread_ctrl_t* get_current_thread_ctrl();
|
||||
#include "types.h"
|
||||
#include "Atomic.h"
|
||||
|
||||
// named thread control class
|
||||
class thread_ctrl_t final
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "sema.h"
|
||||
#include "cond.h"
|
||||
|
||||
// Will report exception and call std::abort() if put in catch(...)
|
||||
[[noreturn]] void catch_all_exceptions();
|
||||
|
||||
// Simple list of void() functors
|
||||
class task_stack
|
||||
{
|
||||
friend class named_thread_t;
|
||||
struct task_base
|
||||
{
|
||||
std::unique_ptr<task_base> next;
|
||||
|
||||
template<typename T> friend void current_thread_register_atexit(T);
|
||||
virtual ~task_base();
|
||||
|
||||
// thread handler
|
||||
std::thread m_thread;
|
||||
virtual void invoke()
|
||||
{
|
||||
if (next)
|
||||
{
|
||||
next->invoke();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// name getter
|
||||
const std::function<std::string()> m_name;
|
||||
template <typename F>
|
||||
struct task_type final : task_base
|
||||
{
|
||||
std::remove_reference_t<F> func;
|
||||
|
||||
// functions executed at thread exit (temporarily)
|
||||
std::vector<std::function<void()>> m_atexit;
|
||||
task_type(F&& func)
|
||||
: func(std::forward<F>(func))
|
||||
{
|
||||
}
|
||||
|
||||
void invoke() final override
|
||||
{
|
||||
func();
|
||||
task_base::invoke();
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<task_base> m_stack;
|
||||
|
||||
public:
|
||||
thread_ctrl_t(std::function<std::string()> name)
|
||||
: m_name(std::move(name))
|
||||
task_stack() = default;
|
||||
|
||||
template <typename F>
|
||||
task_stack(F&& func)
|
||||
: m_stack(new task_type<F>(std::forward<F>(func)))
|
||||
{
|
||||
}
|
||||
|
||||
// get thread name
|
||||
std::string get_name() const;
|
||||
void push(task_stack stack)
|
||||
{
|
||||
auto _top = stack.m_stack.release();
|
||||
auto _next = m_stack.release();
|
||||
m_stack.reset(_top);
|
||||
while (UNLIKELY(_top->next)) _top = _top->next.get();
|
||||
_top->next.reset(_next);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_stack.reset();
|
||||
}
|
||||
|
||||
void invoke() const
|
||||
{
|
||||
if (m_stack)
|
||||
{
|
||||
m_stack->invoke();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// register function at thread exit (temporarily)
|
||||
template<typename T> void current_thread_register_atexit(T func)
|
||||
// Thread control class
|
||||
class thread_ctrl final
|
||||
{
|
||||
extern thread_local thread_ctrl_t* g_tls_this_thread;
|
||||
// Current thread
|
||||
static thread_local thread_ctrl* g_tls_this_thread;
|
||||
|
||||
g_tls_this_thread->m_atexit.emplace_back(func);
|
||||
}
|
||||
// Self pointer
|
||||
std::shared_ptr<thread_ctrl> m_self;
|
||||
|
||||
class named_thread_t
|
||||
{
|
||||
// pointer to managed resource (shared with actual thread)
|
||||
std::shared_ptr<thread_ctrl_t> m_thread;
|
||||
// Thread handle (platform-specific)
|
||||
atomic_t<std::uintptr_t> m_thread{0};
|
||||
|
||||
// Thread mutex
|
||||
mutable semaphore<> m_mutex;
|
||||
|
||||
// Thread condition variable
|
||||
cond_variable m_cond;
|
||||
|
||||
// Thread flags
|
||||
atomic_t<u32> m_signal{0};
|
||||
|
||||
// Thread joining condition variable
|
||||
cond_variable m_jcv;
|
||||
|
||||
// Remotely set or caught exception
|
||||
std::exception_ptr m_exception;
|
||||
|
||||
// Thread initial task or atexit task
|
||||
task_stack m_task;
|
||||
|
||||
// Fixed name
|
||||
std::string m_name;
|
||||
|
||||
// Start thread
|
||||
static void start(const std::shared_ptr<thread_ctrl>&, task_stack);
|
||||
|
||||
// Called at the thread start
|
||||
void initialize();
|
||||
|
||||
// Called at the thread end
|
||||
void finalize(std::exception_ptr) noexcept;
|
||||
|
||||
// Add task (atexit)
|
||||
static void _push(task_stack);
|
||||
|
||||
// Internal waiting function, may throw. Infinite value is -1.
|
||||
static bool _wait_for(u64 usec);
|
||||
|
||||
// Internal throwing function. Mutex must be locked and will be unlocked.
|
||||
[[noreturn]] void _throw();
|
||||
|
||||
// Internal notification function
|
||||
void _notify(cond_variable thread_ctrl::*);
|
||||
|
||||
public:
|
||||
// thread mutex for external use
|
||||
std::mutex mutex;
|
||||
thread_ctrl(std::string&& name);
|
||||
|
||||
// thread condition variable for external use
|
||||
std::condition_variable cv;
|
||||
thread_ctrl(const thread_ctrl&) = delete;
|
||||
|
||||
public:
|
||||
// initialize in empty state
|
||||
named_thread_t() = default;
|
||||
~thread_ctrl();
|
||||
|
||||
// create named thread
|
||||
named_thread_t(std::function<std::string()> name, std::function<void()> func);
|
||||
// Get thread name
|
||||
const std::string& get_name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
// destructor, will terminate if thread is neither joined nor detached
|
||||
virtual ~named_thread_t();
|
||||
// Get exception
|
||||
std::exception_ptr get_exception() const;
|
||||
|
||||
named_thread_t(const named_thread_t&) = delete;
|
||||
// Set exception
|
||||
void set_exception(std::exception_ptr ptr);
|
||||
|
||||
named_thread_t& operator =(const named_thread_t&) = delete;
|
||||
|
||||
public:
|
||||
// get thread name
|
||||
std::string get_name() const;
|
||||
|
||||
// create named thread (current state must be empty)
|
||||
void start(std::function<std::string()> name, std::function<void()> func);
|
||||
|
||||
// detach thread -> empty state
|
||||
void detach();
|
||||
|
||||
// join thread -> empty state
|
||||
// Get thread result (may throw, simultaneous joining allowed)
|
||||
void join();
|
||||
|
||||
// check if not empty
|
||||
bool joinable() const { return m_thread.operator bool(); }
|
||||
// Notify the thread
|
||||
void notify();
|
||||
|
||||
// check whether it is the current running thread
|
||||
bool is_current() const;
|
||||
// Wait once with timeout. Abortable, may throw. May spuriously return false.
|
||||
static inline bool wait_for(u64 usec)
|
||||
{
|
||||
return _wait_for(usec);
|
||||
}
|
||||
|
||||
// get internal thread pointer
|
||||
const thread_ctrl_t* get_thread_ctrl() const { return m_thread.get(); }
|
||||
// Wait. Abortable, may throw.
|
||||
static inline void wait()
|
||||
{
|
||||
_wait_for(-1);
|
||||
}
|
||||
|
||||
// Wait until pred(). Abortable, may throw.
|
||||
template<typename F, typename RT = std::result_of_t<F()>>
|
||||
static inline RT wait(F&& pred)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (RT result = pred())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
_wait_for(-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait eternally until aborted.
|
||||
[[noreturn]] static inline void eternalize()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
_wait_for(-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Test exception (may throw).
|
||||
static void test();
|
||||
|
||||
// Get current thread (may be nullptr)
|
||||
static thread_ctrl* get_current()
|
||||
{
|
||||
return g_tls_this_thread;
|
||||
}
|
||||
|
||||
// Register function at thread exit (for the current thread)
|
||||
template<typename F>
|
||||
static inline void atexit(F&& func)
|
||||
{
|
||||
_push(std::forward<F>(func));
|
||||
}
|
||||
|
||||
// Create detached named thread
|
||||
template<typename N, typename F>
|
||||
static inline void spawn(N&& name, F&& func)
|
||||
{
|
||||
auto out = std::make_shared<thread_ctrl>(std::forward<N>(name));
|
||||
|
||||
thread_ctrl::start(out, std::forward<F>(func));
|
||||
}
|
||||
|
||||
// Named thread factory
|
||||
template<typename N, typename F>
|
||||
static inline void spawn(std::shared_ptr<thread_ctrl>& out, N&& name, F&& func)
|
||||
{
|
||||
out = std::make_shared<thread_ctrl>(std::forward<N>(name));
|
||||
|
||||
thread_ctrl::start(out, std::forward<F>(func));
|
||||
}
|
||||
};
|
||||
|
||||
class autojoin_thread_t final : private named_thread_t
|
||||
class named_thread
|
||||
{
|
||||
public:
|
||||
using named_thread_t::mutex;
|
||||
using named_thread_t::cv;
|
||||
// Pointer to managed resource (shared with actual thread)
|
||||
std::shared_ptr<thread_ctrl> m_thread;
|
||||
|
||||
public:
|
||||
autojoin_thread_t() = delete;
|
||||
named_thread();
|
||||
|
||||
autojoin_thread_t(std::function<std::string()> name, std::function<void()> func)
|
||||
virtual ~named_thread();
|
||||
|
||||
// Deleted copy/move constructors + copy/move operators
|
||||
named_thread(const named_thread&) = delete;
|
||||
|
||||
// Get thread name
|
||||
virtual std::string get_name() const;
|
||||
|
||||
protected:
|
||||
// Start thread (cannot be called from the constructor: should throw in such case)
|
||||
void start_thread(const std::shared_ptr<void>& _this);
|
||||
|
||||
// Thread task (called in the thread)
|
||||
virtual void on_task() = 0;
|
||||
|
||||
// Thread finalization (called after on_task)
|
||||
virtual void on_exit() {}
|
||||
|
||||
public:
|
||||
// ID initialization
|
||||
virtual void on_init(const std::shared_ptr<void>& _this)
|
||||
{
|
||||
start(std::move(name), std::move(func));
|
||||
return start_thread(_this);
|
||||
}
|
||||
|
||||
virtual ~autojoin_thread_t() override
|
||||
// ID finalization
|
||||
virtual void on_stop()
|
||||
{
|
||||
join();
|
||||
m_thread->join();
|
||||
}
|
||||
|
||||
using named_thread_t::is_current;
|
||||
// Access thread_ctrl
|
||||
thread_ctrl* get() const
|
||||
{
|
||||
return m_thread.get();
|
||||
}
|
||||
|
||||
void join() const
|
||||
{
|
||||
return m_thread->join();
|
||||
}
|
||||
|
||||
void notify() const
|
||||
{
|
||||
return m_thread->notify();
|
||||
}
|
||||
};
|
||||
|
||||
extern const std::function<bool()> SQUEUE_ALWAYS_EXIT;
|
||||
extern const std::function<bool()> SQUEUE_NEVER_EXIT;
|
||||
|
||||
bool squeue_test_exit();
|
||||
|
||||
template<typename T, u32 sq_size = 256>
|
||||
class squeue_t
|
||||
// Wrapper for named thread, joins automatically in the destructor, can only be used in function scope
|
||||
class scope_thread final
|
||||
{
|
||||
struct squeue_sync_var_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 position : 31;
|
||||
u32 pop_lock : 1;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 count : 31;
|
||||
u32 push_lock : 1;
|
||||
};
|
||||
};
|
||||
|
||||
atomic_t<squeue_sync_var_t> m_sync;
|
||||
|
||||
mutable std::mutex m_rcv_mutex;
|
||||
mutable std::mutex m_wcv_mutex;
|
||||
mutable std::condition_variable m_rcv;
|
||||
mutable std::condition_variable m_wcv;
|
||||
|
||||
T m_data[sq_size];
|
||||
|
||||
enum squeue_sync_var_result : u32
|
||||
{
|
||||
SQSVR_OK = 0,
|
||||
SQSVR_LOCKED = 1,
|
||||
SQSVR_FAILED = 2,
|
||||
};
|
||||
std::shared_ptr<thread_ctrl> m_thread;
|
||||
|
||||
public:
|
||||
squeue_t()
|
||||
: m_sync(squeue_sync_var_t{})
|
||||
template<typename N, typename F>
|
||||
scope_thread(N&& name, F&& func)
|
||||
{
|
||||
thread_ctrl::spawn(m_thread, std::forward<N>(name), std::forward<F>(func));
|
||||
}
|
||||
|
||||
u32 get_max_size() const
|
||||
// Deleted copy/move constructors + copy/move operators
|
||||
scope_thread(const scope_thread&) = delete;
|
||||
|
||||
// Destructor with exceptions allowed
|
||||
~scope_thread() noexcept(false)
|
||||
{
|
||||
return sq_size;
|
||||
m_thread->join();
|
||||
}
|
||||
|
||||
bool is_full() const
|
||||
// Access thread_ctrl
|
||||
thread_ctrl* get() const
|
||||
{
|
||||
return m_sync.load().count == sq_size;
|
||||
}
|
||||
|
||||
bool push(const T& data, const std::function<bool()>& test_exit)
|
||||
{
|
||||
u32 pos = 0;
|
||||
|
||||
while (u32 res = m_sync.atomic_op([&pos](squeue_sync_var_t& sync) -> u32
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
|
||||
if (sync.push_lock)
|
||||
{
|
||||
return SQSVR_LOCKED;
|
||||
}
|
||||
if (sync.count == sq_size)
|
||||
{
|
||||
return SQSVR_FAILED;
|
||||
}
|
||||
|
||||
sync.push_lock = 1;
|
||||
pos = sync.position + sync.count;
|
||||
return SQSVR_OK;
|
||||
}))
|
||||
{
|
||||
if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> wcv_lock(m_wcv_mutex);
|
||||
m_wcv.wait_for(wcv_lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
m_data[pos >= sq_size ? pos - sq_size : pos] = data;
|
||||
|
||||
m_sync.atomic_op([](squeue_sync_var_t& sync)
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
assert(sync.push_lock);
|
||||
sync.push_lock = 0;
|
||||
sync.count++;
|
||||
});
|
||||
|
||||
m_rcv.notify_one();
|
||||
m_wcv.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push(const T& data, const volatile bool* do_exit)
|
||||
{
|
||||
return push(data, [do_exit](){ return do_exit && *do_exit; });
|
||||
}
|
||||
|
||||
force_inline bool push(const T& data)
|
||||
{
|
||||
return push(data, SQUEUE_NEVER_EXIT);
|
||||
}
|
||||
|
||||
force_inline bool try_push(const T& data)
|
||||
{
|
||||
return push(data, SQUEUE_ALWAYS_EXIT);
|
||||
}
|
||||
|
||||
bool pop(T& data, const std::function<bool()>& test_exit)
|
||||
{
|
||||
u32 pos = 0;
|
||||
|
||||
while (u32 res = m_sync.atomic_op([&pos](squeue_sync_var_t& sync) -> u32
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
|
||||
if (!sync.count)
|
||||
{
|
||||
return SQSVR_FAILED;
|
||||
}
|
||||
if (sync.pop_lock)
|
||||
{
|
||||
return SQSVR_LOCKED;
|
||||
}
|
||||
|
||||
sync.pop_lock = 1;
|
||||
pos = sync.position;
|
||||
return SQSVR_OK;
|
||||
}))
|
||||
{
|
||||
if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> rcv_lock(m_rcv_mutex);
|
||||
m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
data = m_data[pos];
|
||||
|
||||
m_sync.atomic_op([](squeue_sync_var_t& sync)
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
assert(sync.pop_lock);
|
||||
sync.pop_lock = 0;
|
||||
sync.position++;
|
||||
sync.count--;
|
||||
if (sync.position == sq_size)
|
||||
{
|
||||
sync.position = 0;
|
||||
}
|
||||
});
|
||||
|
||||
m_rcv.notify_one();
|
||||
m_wcv.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pop(T& data, const volatile bool* do_exit)
|
||||
{
|
||||
return pop(data, [do_exit](){ return do_exit && *do_exit; });
|
||||
}
|
||||
|
||||
force_inline bool pop(T& data)
|
||||
{
|
||||
return pop(data, SQUEUE_NEVER_EXIT);
|
||||
}
|
||||
|
||||
force_inline bool try_pop(T& data)
|
||||
{
|
||||
return pop(data, SQUEUE_ALWAYS_EXIT);
|
||||
}
|
||||
|
||||
bool peek(T& data, u32 start_pos, const std::function<bool()>& test_exit)
|
||||
{
|
||||
assert(start_pos < sq_size);
|
||||
u32 pos = 0;
|
||||
|
||||
while (u32 res = m_sync.atomic_op([&pos, start_pos](squeue_sync_var_t& sync) -> u32
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
|
||||
if (sync.count <= start_pos)
|
||||
{
|
||||
return SQSVR_FAILED;
|
||||
}
|
||||
if (sync.pop_lock)
|
||||
{
|
||||
return SQSVR_LOCKED;
|
||||
}
|
||||
|
||||
sync.pop_lock = 1;
|
||||
pos = sync.position + start_pos;
|
||||
return SQSVR_OK;
|
||||
}))
|
||||
{
|
||||
if (res == SQSVR_FAILED && (test_exit() || squeue_test_exit()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> rcv_lock(m_rcv_mutex);
|
||||
m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
data = m_data[pos >= sq_size ? pos - sq_size : pos];
|
||||
|
||||
m_sync.atomic_op([](squeue_sync_var_t& sync)
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
assert(sync.pop_lock);
|
||||
sync.pop_lock = 0;
|
||||
});
|
||||
|
||||
m_rcv.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool peek(T& data, u32 start_pos, const volatile bool* do_exit)
|
||||
{
|
||||
return peek(data, start_pos, [do_exit](){ return do_exit && *do_exit; });
|
||||
}
|
||||
|
||||
force_inline bool peek(T& data, u32 start_pos = 0)
|
||||
{
|
||||
return peek(data, start_pos, SQUEUE_NEVER_EXIT);
|
||||
}
|
||||
|
||||
force_inline bool try_peek(T& data, u32 start_pos = 0)
|
||||
{
|
||||
return peek(data, start_pos, SQUEUE_ALWAYS_EXIT);
|
||||
}
|
||||
|
||||
class squeue_data_t
|
||||
{
|
||||
T* const m_data;
|
||||
const u32 m_pos;
|
||||
const u32 m_count;
|
||||
|
||||
squeue_data_t(T* data, u32 pos, u32 count)
|
||||
: m_data(data)
|
||||
, m_pos(pos)
|
||||
, m_count(count)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
T& operator [] (u32 index)
|
||||
{
|
||||
assert(index < m_count);
|
||||
index += m_pos;
|
||||
index = index < sq_size ? index : index - sq_size;
|
||||
return m_data[index];
|
||||
}
|
||||
};
|
||||
|
||||
void process(void(*proc)(squeue_data_t data))
|
||||
{
|
||||
u32 pos, count;
|
||||
|
||||
while (m_sync.atomic_op([&pos, &count](squeue_sync_var_t& sync) -> u32
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
|
||||
if (sync.pop_lock || sync.push_lock)
|
||||
{
|
||||
return SQSVR_LOCKED;
|
||||
}
|
||||
|
||||
pos = sync.position;
|
||||
count = sync.count;
|
||||
sync.pop_lock = 1;
|
||||
sync.push_lock = 1;
|
||||
return SQSVR_OK;
|
||||
}))
|
||||
{
|
||||
std::unique_lock<std::mutex> rcv_lock(m_rcv_mutex);
|
||||
m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
proc(squeue_data_t(m_data, pos, count));
|
||||
|
||||
m_sync.atomic_op([](squeue_sync_var_t& sync)
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
assert(sync.pop_lock && sync.push_lock);
|
||||
sync.pop_lock = 0;
|
||||
sync.push_lock = 0;
|
||||
});
|
||||
|
||||
m_wcv.notify_one();
|
||||
m_rcv.notify_one();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
while (m_sync.atomic_op([](squeue_sync_var_t& sync) -> u32
|
||||
{
|
||||
assert(sync.count <= sq_size);
|
||||
assert(sync.position < sq_size);
|
||||
|
||||
if (sync.pop_lock || sync.push_lock)
|
||||
{
|
||||
return SQSVR_LOCKED;
|
||||
}
|
||||
|
||||
sync.pop_lock = 1;
|
||||
sync.push_lock = 1;
|
||||
return SQSVR_OK;
|
||||
}))
|
||||
{
|
||||
std::unique_lock<std::mutex> rcv_lock(m_rcv_mutex);
|
||||
m_rcv.wait_for(rcv_lock, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
m_sync.exchange({});
|
||||
m_wcv.notify_one();
|
||||
m_rcv.notify_one();
|
||||
return m_thread.get();
|
||||
}
|
||||
};
|
||||
|
||||
+6
-6
@@ -6,8 +6,8 @@ class Timer
|
||||
{
|
||||
private:
|
||||
bool m_stopped;
|
||||
std::chrono::high_resolution_clock::time_point m_start;
|
||||
std::chrono::high_resolution_clock::time_point m_end;
|
||||
std::chrono::steady_clock::time_point m_start;
|
||||
std::chrono::steady_clock::time_point m_end;
|
||||
|
||||
public:
|
||||
Timer() : m_stopped(false)
|
||||
@@ -17,13 +17,13 @@ public:
|
||||
void Start()
|
||||
{
|
||||
m_stopped = false;
|
||||
m_start = std::chrono::high_resolution_clock::now();
|
||||
m_start = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
void Stop()
|
||||
{
|
||||
m_stopped = true;
|
||||
m_end = std::chrono::high_resolution_clock::now();
|
||||
m_end = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
double GetElapsedTimeInSec() const
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
|
||||
u64 GetElapsedTimeInMicroSec() const
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
|
||||
std::chrono::steady_clock::time_point now = m_stopped ? m_end : std::chrono::steady_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count();
|
||||
}
|
||||
|
||||
u64 GetElapsedTimeInNanoSec() const
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
|
||||
std::chrono::steady_clock::time_point now = m_stopped ? m_end : std::chrono::steady_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(now - m_start).count();
|
||||
}
|
||||
|
||||
+11
-10
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "VirtualMemory.h"
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
@@ -12,30 +13,30 @@
|
||||
|
||||
namespace memory_helper
|
||||
{
|
||||
void* reserve_memory(size_t size)
|
||||
void* reserve_memory(std::size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
|
||||
return verify("reserve_memory" HERE, VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS));
|
||||
#else
|
||||
return mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
return verify("reserve_memory" HERE, ::mmap(nullptr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
void commit_page_memory(void* pointer, size_t page_size)
|
||||
void commit_page_memory(void* pointer, std::size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
VirtualAlloc((u8*)pointer, page_size, MEM_COMMIT, PAGE_READWRITE);
|
||||
verify(HERE), VirtualAlloc(pointer, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
#else
|
||||
mprotect((u8*)pointer, page_size, PROT_READ | PROT_WRITE);
|
||||
verify(HERE), ::mprotect((void*)((u64)pointer & -4096), ::align(size, 4096), PROT_READ | PROT_WRITE) != -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void free_reserved_memory(void* pointer, size_t size)
|
||||
void free_reserved_memory(void* pointer, std::size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
VirtualFree(pointer, 0, MEM_RELEASE);
|
||||
verify(HERE), VirtualFree(pointer, 0, MEM_DECOMMIT);
|
||||
#else
|
||||
munmap(pointer, size);
|
||||
verify(HERE), ::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
namespace memory_helper
|
||||
{
|
||||
/**
|
||||
* Reserve size bytes of virtual memory and returns it.
|
||||
* Reserve `size` bytes of virtual memory and returns it.
|
||||
* The memory should be commited before usage.
|
||||
*/
|
||||
void* reserve_memory(size_t size);
|
||||
void* reserve_memory(std::size_t size);
|
||||
|
||||
/**
|
||||
* Commit page_size bytes of virtual memory starting at pointer.
|
||||
* Commit `size` bytes of virtual memory starting at pointer.
|
||||
* That is, bake reserved memory with physical memory.
|
||||
* pointer should belong to a range of reserved memory.
|
||||
*/
|
||||
void commit_page_memory(void* pointer, size_t page_size);
|
||||
void commit_page_memory(void* pointer, std::size_t size);
|
||||
|
||||
/**
|
||||
* Free memory alloced via reserve_memory.
|
||||
* Decommit all memory committed via commit_page_memory.
|
||||
*/
|
||||
void free_reserved_memory(void* pointer, size_t size);
|
||||
}
|
||||
void free_reserved_memory(void* pointer, std::size_t size);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user