mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-09-03 00:50:00 +02:00
Compare commits
544
Commits
ff1a0bb4cb
..
v2.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ff55ee0e7 | ||
|
|
cd9d2dde95 | ||
|
|
56bbc2204e | ||
|
|
04294418b7 | ||
|
|
eeb563d2c2 | ||
|
|
f18fa55b59 | ||
|
|
49dd56ba8f | ||
|
|
1934e4a478 | ||
|
|
3e5f370281 | ||
|
|
b156368f9c | ||
|
|
082f9907b0 | ||
|
|
430fa0af9e | ||
|
|
99d20ca740 | ||
|
|
8470080236 | ||
|
|
a226e4d746 | ||
|
|
f478c44599 | ||
|
|
be01670919 | ||
|
|
b06150f322 | ||
|
|
6cd0aaa42b | ||
|
|
87e2c2002d | ||
|
|
52a18af142 | ||
|
|
f8dc9613d6 | ||
|
|
07f521d3d5 | ||
|
|
d2a8ac46f6 | ||
|
|
f73fa1b02d | ||
|
|
2030534cf2 | ||
|
|
712ac4be64 | ||
|
|
809bea2fca | ||
|
|
285bcda21f | ||
|
|
c9870faaf1 | ||
|
|
c6490c979c | ||
|
|
427e5aa099 | ||
|
|
55f1df2ec7 | ||
|
|
273255ecfe | ||
|
|
f9ef8fc790 | ||
|
|
54b45824b3 | ||
|
|
aa345c7e38 | ||
|
|
9874c1fd5b | ||
|
|
1da9fd767d | ||
|
|
c6fefe2ffa | ||
|
|
c60c176a54 | ||
|
|
cd906ca117 | ||
|
|
f6708058b3 | ||
|
|
f07131686f | ||
|
|
036fa0e7b6 | ||
|
|
b6edf442a2 | ||
|
|
b6660b99d6 | ||
|
|
ffff4722b7 | ||
|
|
8f4dc6e3b5 | ||
|
|
6de8d3a4fd | ||
|
|
24d9b4b6c9 | ||
|
|
905859acba | ||
|
|
213a8f6a6d | ||
|
|
42e62ac3eb | ||
|
|
30328b1732 | ||
|
|
335c797c12 | ||
|
|
d3808cde1a | ||
|
|
9183e7c1e8 | ||
|
|
17ae77d11a | ||
|
|
d379e5a9fe | ||
|
|
7d407fc6d1 | ||
|
|
47f6bc73e9 | ||
|
|
4987a8ca6e | ||
|
|
ab4d67d764 | ||
|
|
11ccc041d2 | ||
|
|
323b16f107 | ||
|
|
0622684e40 | ||
|
|
f5333882c6 | ||
|
|
5d4d97e05d | ||
|
|
5a04ad7781 | ||
|
|
e1add20315 | ||
|
|
9bb95be679 | ||
|
|
97ea5e3acf | ||
|
|
841d140c69 | ||
|
|
fc74873bc6 | ||
|
|
37ea1b1cd4 | ||
|
|
1bf92b3b26 | ||
|
|
cda4faa103 | ||
|
|
5529bbd2e1 | ||
|
|
ec2c444051 | ||
|
|
56fec8d1ff | ||
|
|
e29f5e7edd | ||
|
|
17fcb85adc | ||
|
|
b8966d5907 | ||
|
|
50edf78e7d | ||
|
|
89b1ae475f | ||
|
|
44484798e8 | ||
|
|
8cf08d3490 | ||
|
|
c85a30e669 | ||
|
|
f401b3694a | ||
|
|
f27e5ef043 | ||
|
|
35b7408eab | ||
|
|
71d1c20a27 | ||
|
|
8d879fb5bc | ||
|
|
d1a5bceb03 | ||
|
|
5bd66fd362 | ||
|
|
142ea2d39f | ||
|
|
21964fc628 | ||
|
|
af70e2e354 | ||
|
|
77f1a2d8f8 | ||
|
|
fc404a4d22 | ||
|
|
601c2435f1 | ||
|
|
ea950a1901 | ||
|
|
524da32c65 | ||
|
|
3153941573 | ||
|
|
51427dce86 | ||
|
|
245d556105 | ||
|
|
df05148d22 | ||
|
|
f7ddf3cccb | ||
|
|
77240013a4 | ||
|
|
1721632a75 | ||
|
|
d3bf2505f6 | ||
|
|
c6d6c821a9 | ||
|
|
d4bd8b62c5 | ||
|
|
fc6aeab678 | ||
|
|
53bb936453 | ||
|
|
a7fdb5838d | ||
|
|
ef61b7943e | ||
|
|
185a2b700c | ||
|
|
da85343e32 | ||
|
|
d8a6676063 | ||
|
|
47d0cfb20b | ||
|
|
92c8014af1 | ||
|
|
101b8dac7b | ||
|
|
cfb41b7b27 | ||
|
|
aa26e528c4 | ||
|
|
e7cb78557f | ||
|
|
05d07e5b72 | ||
|
|
8f757cab08 | ||
|
|
c7484b771f | ||
|
|
418feba7d3 | ||
|
|
0c35f2702e | ||
|
|
226430f01e | ||
|
|
ae3be69081 | ||
|
|
307270532f | ||
|
|
04f9cb1d95 | ||
|
|
59455495b6 | ||
|
|
c45a76a5bf | ||
|
|
632117a3a3 | ||
|
|
0ea0cde668 | ||
|
|
74dd8a01e2 | ||
|
|
09561328ed | ||
|
|
baa0ab0a2c | ||
|
|
fd56e83c7b | ||
|
|
ea2ee83a3e | ||
|
|
5be3c86de4 | ||
|
|
ae02055e18 | ||
|
|
74e2d04b7b | ||
|
|
6ad95ca4c4 | ||
|
|
f08b1f6c8a | ||
|
|
4d640ed70c | ||
|
|
85ada83d57 | ||
|
|
c9ca2187b3 | ||
|
|
6a0f4fd8dc | ||
|
|
cf773b586e | ||
|
|
c718915927 | ||
|
|
0b3ca8ec0c | ||
|
|
3f065bc77e | ||
|
|
8dd6def84d | ||
|
|
4e1ae347a8 | ||
|
|
4ed84d43c1 | ||
|
|
48801d1070 | ||
|
|
e9a8a0cb84 | ||
|
|
83432cb356 | ||
|
|
527a88ebaa | ||
|
|
7079e1e42d | ||
|
|
7243c67c3e | ||
|
|
94873df8fe | ||
|
|
25b605d7d9 | ||
|
|
f743fc717f | ||
|
|
8191191fff | ||
|
|
9631305e35 | ||
|
|
14b42a7c9e | ||
|
|
f50dd2d946 | ||
|
|
3dd68f9942 | ||
|
|
ffe5704673 | ||
|
|
20ec13d2b9 | ||
|
|
77bfe4ff11 | ||
|
|
33d2b98c55 | ||
|
|
1adce43d9f | ||
|
|
466050ee7a | ||
|
|
6bc505de13 | ||
|
|
d70d748877 | ||
|
|
6eaf871d45 | ||
|
|
0a84ea6a18 | ||
|
|
1b996af83f | ||
|
|
b7d554553b | ||
|
|
d5eeef9559 | ||
|
|
5cda85d16c | ||
|
|
9318456afb | ||
|
|
40fe100ecc | ||
|
|
c1bfc0f27d | ||
|
|
5a09ebb179 | ||
|
|
8370ae8324 | ||
|
|
a4fcbf187b | ||
|
|
b15aa648e2 | ||
|
|
9a88a8502e | ||
|
|
34a46d643a | ||
|
|
7ecee717f8 | ||
|
|
359be83f49 | ||
|
|
8c8c96bf30 | ||
|
|
e30a243452 | ||
|
|
f8e1cd4a66 | ||
|
|
d5512b72fa | ||
|
|
86f3d545ee | ||
|
|
9149f42b95 | ||
|
|
7aea6682f2 | ||
|
|
d0ca0e4ab7 | ||
|
|
f6dfed48dd | ||
|
|
5a69dff9d7 | ||
|
|
b7e2164f91 | ||
|
|
37e9410d12 | ||
|
|
273858ec8f | ||
|
|
8f088eb76d | ||
|
|
a7433a6570 | ||
|
|
3ab445e780 | ||
|
|
dd554cce2a | ||
|
|
a182b53d7f | ||
|
|
a5f85a8a4c | ||
|
|
edb44070a9 | ||
|
|
be19b71c55 | ||
|
|
ae6a86800e | ||
|
|
b85e0444cb | ||
|
|
f8a856db1c | ||
|
|
fc33d33508 | ||
|
|
14698594d8 | ||
|
|
024f3fefc3 | ||
|
|
33872806a1 | ||
|
|
3b4a1de9f3 | ||
|
|
5af4c82c1b | ||
|
|
e26af9ae1b | ||
|
|
8c41eefadb | ||
|
|
25d86eccee | ||
|
|
2393261cb0 | ||
|
|
d9d165f17e | ||
|
|
f446c82780 | ||
|
|
810417a251 | ||
|
|
cc507ea4cf | ||
|
|
0e04356ea7 | ||
|
|
b5983ac24b | ||
|
|
abc213c808 | ||
|
|
86671b8919 | ||
|
|
982e3e6827 | ||
|
|
e2ea602372 | ||
|
|
7f80671be8 | ||
|
|
42fc7d9a86 | ||
|
|
60d3df7969 | ||
|
|
be52578d37 | ||
|
|
57c5ae5415 | ||
|
|
c6d6e409f1 | ||
|
|
c0dfcd9244 | ||
|
|
689608b3fe | ||
|
|
04330a10ac | ||
|
|
a456ad15ce | ||
|
|
e621bb53d4 | ||
|
|
420ba21b4d | ||
|
|
f3de55d6e9 | ||
|
|
bc1e0fbba9 | ||
|
|
80c0146ecd | ||
|
|
dbe3bb3cb3 | ||
|
|
83ecc6e498 | ||
|
|
8b2965f6dd | ||
|
|
6c31d3347a | ||
|
|
7f8ec481f1 | ||
|
|
25bb57a973 | ||
|
|
39365f52a2 | ||
|
|
fafc94248d | ||
|
|
edeaff793a | ||
|
|
2d5758419f | ||
|
|
ba063dae3b | ||
|
|
e018cad851 | ||
|
|
9ee8041710 | ||
|
|
1b50e123c5 | ||
|
|
77563b8449 | ||
|
|
d0923320a3 | ||
|
|
d8cab7aa47 | ||
|
|
fcf4d3d030 | ||
|
|
05362905f7 | ||
|
|
6866f2240e | ||
|
|
1903104247 | ||
|
|
04db0a7441 | ||
|
|
91cbb15b66 | ||
|
|
eeded8c8bc | ||
|
|
58e687c952 | ||
|
|
a0b536483a | ||
|
|
de1e8ed563 | ||
|
|
a832c3ca40 | ||
|
|
575ee21c7a | ||
|
|
071bc4596b | ||
|
|
178690cff3 | ||
|
|
1d566f74e3 | ||
|
|
eaa1b9afd0 | ||
|
|
a2d40ce844 | ||
|
|
4dcdcde7d5 | ||
|
|
8805f91bfd | ||
|
|
b5ca757189 | ||
|
|
c2d27c8434 | ||
|
|
5f55dd9b9a | ||
|
|
f044b9ab45 | ||
|
|
8c6ad92f37 | ||
|
|
34bdb740c2 | ||
|
|
c485f039fb | ||
|
|
3c60e76094 | ||
|
|
39650b5c96 | ||
|
|
0f16255240 | ||
|
|
91661fd206 | ||
|
|
6648bd427f | ||
|
|
aa2d0be63f | ||
|
|
2b557d5be7 | ||
|
|
36fae5c7d1 | ||
|
|
68570910e3 | ||
|
|
697a5e7147 | ||
|
|
31073c116c | ||
|
|
c6a024d911 | ||
|
|
66a1b44224 | ||
|
|
f5c581d89c | ||
|
|
765a04d9b5 | ||
|
|
ac054830b9 | ||
|
|
ccbd7561f4 | ||
|
|
2859725257 | ||
|
|
f18cce29b3 | ||
|
|
d9a7f337ba | ||
|
|
f8e619ad94 | ||
|
|
ea6450b308 | ||
|
|
6df9c284b8 | ||
|
|
d6b3f5dcc2 | ||
|
|
826740906f | ||
|
|
2c1f5181bf | ||
|
|
e728926521 | ||
|
|
04af533469 | ||
|
|
53048bd82a | ||
|
|
d0a19c5312 | ||
|
|
6e284fb9bc | ||
|
|
ea87c32051 | ||
|
|
d73ade4a85 | ||
|
|
67bfc73066 | ||
|
|
8b44a3aa6e | ||
|
|
36f9fdd53b | ||
|
|
9c43069e5f | ||
|
|
0b6e1717d9 | ||
|
|
41f7b4ef4c | ||
|
|
418791930c | ||
|
|
0690ecacd8 | ||
|
|
36f7efb679 | ||
|
|
a52e33e697 | ||
|
|
086c5402f5 | ||
|
|
dd1bd43360 | ||
|
|
d515ca5333 | ||
|
|
eeb4695d6c | ||
|
|
e94d3fd70f | ||
|
|
e76f084625 | ||
|
|
6e1fcb381a | ||
|
|
52c309a288 | ||
|
|
9ad28d7cf2 | ||
|
|
5f21f0bcf9 | ||
|
|
066eec2cf3 | ||
|
|
03e21227fa | ||
|
|
6f05728906 | ||
|
|
5edc36393a | ||
|
|
af29fc7b39 | ||
|
|
9795988e14 | ||
|
|
4087fca980 | ||
|
|
f3efb72a21 | ||
|
|
fc97445875 | ||
|
|
5babfde870 | ||
|
|
04ffce60cd | ||
|
|
9aaa26ddf5 | ||
|
|
df12d08ad3 | ||
|
|
064f660852 | ||
|
|
bf6389f9a7 | ||
|
|
cae3db0ebf | ||
|
|
79b01a5007 | ||
|
|
91927126f2 | ||
|
|
6fb8932ba9 | ||
|
|
536cf4c420 | ||
|
|
1b49794be6 | ||
|
|
25f73a6967 | ||
|
|
b7424e7f92 | ||
|
|
0b4b32b5ac | ||
|
|
1922b409dd | ||
|
|
80e938c019 | ||
|
|
68d2c63694 | ||
|
|
1386fe64cb | ||
|
|
7fd0ccff94 | ||
|
|
b28b144edb | ||
|
|
8e33b2fa30 | ||
|
|
cebadef063 | ||
|
|
57b27adf1a | ||
|
|
d08a97f55c | ||
|
|
c7ad6650d9 | ||
|
|
ac91253f51 | ||
|
|
3d939675e4 | ||
|
|
11b1bd147d | ||
|
|
c013237219 | ||
|
|
8039638885 | ||
|
|
d56b224d42 | ||
|
|
6ccf2a10d7 | ||
|
|
cfd1aab9e3 | ||
|
|
c5752f773e | ||
|
|
f398126e08 | ||
|
|
6c0d8829a5 | ||
|
|
cf3f16d832 | ||
|
|
b60ae54e34 | ||
|
|
7786b07eb8 | ||
|
|
90b1dac0f5 | ||
|
|
3c52fd05f3 | ||
|
|
843d7f0fe2 | ||
|
|
ea2014819d | ||
|
|
e458ef6401 | ||
|
|
0494ff14da | ||
|
|
c2c2dece61 | ||
|
|
401e6d13f3 | ||
|
|
2e5346a0ff | ||
|
|
ce5157a299 | ||
|
|
b5ce2347f6 | ||
|
|
9e0a0df5ca | ||
|
|
8f6f50c37f | ||
|
|
c36de40f4a | ||
|
|
52ca0c0d1b | ||
|
|
651a05c4bc | ||
|
|
1cfb8745e2 | ||
|
|
b3f3a01ee6 | ||
|
|
4acd240737 | ||
|
|
b79b8da031 | ||
|
|
bc7ef4484f | ||
|
|
9db5515fb5 | ||
|
|
387a1f5632 | ||
|
|
0babc2235f | ||
|
|
1a9a6ec6f8 | ||
|
|
d59d9f285a | ||
|
|
d16af1c4a8 | ||
|
|
5dcc2045d6 | ||
|
|
19ce912afe | ||
|
|
890e301b78 | ||
|
|
218a97e4ec | ||
|
|
74e5e35f5a | ||
|
|
e6298b1dc3 | ||
|
|
df860a5a64 | ||
|
|
b22064035a | ||
|
|
197c71021b | ||
|
|
d5fa70d7ab | ||
|
|
fd8e98f1ce | ||
|
|
0e10e5f8e1 | ||
|
|
689c9b3ed4 | ||
|
|
ecd43dedc5 | ||
|
|
dea507ec0e | ||
|
|
39501f2940 | ||
|
|
372f818da4 | ||
|
|
1651f9ba97 | ||
|
|
c7e09f1d8c | ||
|
|
82529d6dc9 | ||
|
|
4e30bd02bf | ||
|
|
f8c2abb20b | ||
|
|
880ac98ca9 | ||
|
|
49c211cebc | ||
|
|
38768c85c9 | ||
|
|
c7433ec419 | ||
|
|
d6b6dd955c | ||
|
|
c125dde951 | ||
|
|
9934b34bba | ||
|
|
3e3f20513f | ||
|
|
c93d7854d0 | ||
|
|
9fdb514541 | ||
|
|
35f5f41258 | ||
|
|
f6201014aa | ||
|
|
c583f1abc8 | ||
|
|
f7cf64cbb9 | ||
|
|
b882771a18 | ||
|
|
39aa8009a4 | ||
|
|
5dce6a2c8e | ||
|
|
52929e215c | ||
|
|
ad60a17da9 | ||
|
|
d29cd56044 | ||
|
|
d6795f97ef | ||
|
|
2fa7e2d4a9 | ||
|
|
85c43dabf4 | ||
|
|
e6ed390e84 | ||
|
|
6cd3422337 | ||
|
|
c0f539b57f | ||
|
|
497879a0bc | ||
|
|
5b43b47f90 | ||
|
|
ab4ebc34d5 | ||
|
|
587e71b940 | ||
|
|
11073a2cbc | ||
|
|
c1898fb8dd | ||
|
|
453ee0850b | ||
|
|
3dd055b406 | ||
|
|
08cbbfa836 | ||
|
|
ce7e3ac88d | ||
|
|
cc810368aa | ||
|
|
ec757ab292 | ||
|
|
fc9fa1a980 | ||
|
|
469716e72b | ||
|
|
254f80b442 | ||
|
|
4d19598ac2 | ||
|
|
774f7c41b0 | ||
|
|
4f8dbc794c | ||
|
|
281bf2dcd2 | ||
|
|
a7ac7b2318 | ||
|
|
3b0442df7e | ||
|
|
6e92a3c32b | ||
|
|
aadfb7449c | ||
|
|
c1f3e49975 | ||
|
|
e39dc7ee7e | ||
|
|
a6b72fbc6f | ||
|
|
5847172049 | ||
|
|
e98bd490b2 | ||
|
|
31e08416e0 | ||
|
|
4edd619841 | ||
|
|
77f707ca7a | ||
|
|
5f1298f9ce | ||
|
|
b71c0eafb8 | ||
|
|
39c7857ccc | ||
|
|
ff6fb56042 | ||
|
|
0c79a0d01c | ||
|
|
34cc9d63da | ||
|
|
3863bd3378 | ||
|
|
026f83ca81 | ||
|
|
77d71adc1f | ||
|
|
b4b3bbda54 | ||
|
|
5f16a98d08 | ||
|
|
f6c6b5e018 | ||
|
|
8ae152e67a | ||
|
|
66022c08fb | ||
|
|
0466c40242 | ||
|
|
83e6ebb430 | ||
|
|
f4bf7ea6b7 | ||
|
|
d360c8fb6a | ||
|
|
e444856964 | ||
|
|
7a5e280322 | ||
|
|
534bea942c | ||
|
|
3a93881392 | ||
|
|
e9c3fb8046 | ||
|
|
90c1aaad4b | ||
|
|
0aae9015a9 | ||
|
|
b170354e7f | ||
|
|
659f6cc14e | ||
|
|
72d6802230 | ||
|
|
4c1043ee17 | ||
|
|
54fc452aa2 | ||
|
|
f1e0499564 | ||
|
|
4a67aab716 | ||
|
|
f52c4e51c9 | ||
|
|
5df9b4d39f |
@@ -7,6 +7,5 @@ version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
target-branch: "indev"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
name: Fetch Dependencies
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # Runs weekly
|
||||
|
||||
@@ -11,24 +10,20 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Fetch Dependencies Script
|
||||
run: cd scripts && bash ./fetch_dependencies.sh
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
delete-branch: true
|
||||
title: update dependencies
|
||||
commit-message: "[BOT] update dependencies"
|
||||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
||||
author: kbJeff-8 <kbJeff-8@users.noreply.github.com>
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
signoff: false
|
||||
base: indev
|
||||
assignees: Kbz-8
|
||||
reviewers: Kbz-8
|
||||
branch: auto_deps_updates
|
||||
labels: |
|
||||
automated
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/first-interaction@v2
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: |
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
name: Linux (clang)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
@@ -17,13 +15,14 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-24.04]
|
||||
arch: [x86_64]
|
||||
mode: [release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
name: Linux (gcc)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
@@ -17,13 +15,14 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-24.04]
|
||||
arch: [x86_64]
|
||||
mode: [release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
name: Linux (meson)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04]
|
||||
arch: [x86_64]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install mesa-common-dev clang libsdl2-2.0-0 libsdl2-dev build-essential libvulkan-dev
|
||||
|
||||
- name: Python
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Meson with pip
|
||||
run: sudo pip3 install meson
|
||||
|
||||
- name: Build with meson
|
||||
run: |
|
||||
meson build --prefix=$PWD/ --bindir='' --libdir=''
|
||||
ninja install -C build
|
||||
@@ -1,42 +0,0 @@
|
||||
name: macOS (meson)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macOS-latest]
|
||||
arch: [x86_64, arm]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install SDL2
|
||||
|
||||
- name: Python
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Meson with pip
|
||||
run: sudo pip3 install meson
|
||||
|
||||
- name: Build with meson
|
||||
run: |
|
||||
meson build --prefix=$PWD/ --bindir='' --libdir=''
|
||||
ninja install -C build
|
||||
@@ -1,8 +1,6 @@
|
||||
name: macOS
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
@@ -16,14 +14,15 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macOS-latest]
|
||||
arch: [x86_64, arm]
|
||||
arch: [x86_64]
|
||||
mode: [release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Install system dependencies
|
||||
- name: Install Dependancies
|
||||
@@ -1,80 +0,0 @@
|
||||
name: Unit tests
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04]
|
||||
arch: [x86_64]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- uses: NcStudios/VulkanCI@v1.2
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install mesa-common-dev clang libsdl2-2.0-0 libsdl2-dev build-essential libvulkan-dev
|
||||
|
||||
# Build the lib
|
||||
- name: Build MacroLibX
|
||||
run: make -j DEBUG=true
|
||||
|
||||
# Force xmake to a specific folder (for cache)
|
||||
- name: Set xmake env
|
||||
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
|
||||
|
||||
# Install xmake
|
||||
- name: Setup xmake
|
||||
if: ${{ matrix.confs.plat != 'mingw' }}
|
||||
uses: xmake-io/github-action-setup-xmake@v1
|
||||
with:
|
||||
xmake-version: latest
|
||||
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Update xmake repository (in order to have the file that will be cached)
|
||||
- name: Update xmake repository
|
||||
run: xmake repo --update
|
||||
|
||||
# Fetch xmake dephash
|
||||
- name: Retrieve dependencies hash
|
||||
id: dep_hash
|
||||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install unit tester
|
||||
run: git clone https://github.com/seekrs/MacroUnitTest.git ../MacroUnitTest
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: |
|
||||
cd ../MacroUnitTest
|
||||
xmake config --toolchain=clang --ccache=n --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
- name: Build and run unit tester
|
||||
run: |
|
||||
cd ../MacroUnitTest
|
||||
xmake run MacroUnitTest --headless --path="${{ runner.workspace }}/MacroLibX/libmlx.so"
|
||||
@@ -1,8 +1,6 @@
|
||||
name: Windows (xmake)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
@@ -16,7 +14,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest]
|
||||
arch: [x64, x86]
|
||||
arch: [x64]
|
||||
mode: [release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -28,7 +26,7 @@ jobs:
|
||||
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Force xmake to a specific folder (for cache)
|
||||
- name: Set xmake env
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
name : Windows (Meson)
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [create-pull-request]
|
||||
pull_request:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
|
||||
jobs:
|
||||
VisualStudio:
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: ['x64', 'x86']
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Install a 32-bit Python so building related stuff work.
|
||||
- name: Setup x86 Python
|
||||
if: matrix.platform == 'x86'
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
architecture: 'x86'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install Meson & Ninja
|
||||
run: |
|
||||
python -m pip install meson ninja
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{matrix.platform}}
|
||||
|
||||
- name: Compile mlx
|
||||
run: |
|
||||
meson setup builddir
|
||||
meson compile -C builddir
|
||||
|
||||
VisualStudio-clang-cl:
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
env:
|
||||
CC: clang-cl
|
||||
CXX: clang-cl
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Meson & Ninja
|
||||
run: |
|
||||
python -m pip install meson ninja
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Compile mlx
|
||||
run: |
|
||||
meson setup builddir
|
||||
meson compile -C builddir
|
||||
|
||||
MSYS2:
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: ['UCRT64', 'CLANG64']
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{matrix.platform}}
|
||||
install: >-
|
||||
bison
|
||||
dos2unix
|
||||
flex
|
||||
git
|
||||
pacboy: >-
|
||||
cc:p
|
||||
cmake:p
|
||||
ninja:p
|
||||
pkgconf:p
|
||||
python-certifi:p
|
||||
python-pip:p
|
||||
# Make sure Python is updated to >=3.11 (fix https://github.com/msys2/MINGW-packages/issues/17415).
|
||||
update: true
|
||||
|
||||
- name: Install Meson
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
python -m pip install meson
|
||||
|
||||
- name: Compile mlx
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
meson setup builddir
|
||||
meson compile -C builddir
|
||||
@@ -23,5 +23,3 @@
|
||||
objs/
|
||||
build/
|
||||
example/Test
|
||||
subprojects/*/
|
||||
subprojects/.wraplock
|
||||
@@ -1,5 +1,5 @@
|
||||
MIT License
|
||||
Copyright (c) 2022-2026 kbz_8
|
||||
Copyright (c) 2022-2024 kbz_8
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -4,6 +4,8 @@ MAKE = make --no-print-directory
|
||||
OS ?= $(shell uname -s)
|
||||
DEBUG ?= false
|
||||
TOOLCHAIN ?= clang
|
||||
IMAGES_OPTIMIZED ?= true
|
||||
FORCE_INTEGRATED_GPU ?= false
|
||||
GRAPHICS_MEMORY_DUMP ?= false
|
||||
PROFILER ?= false
|
||||
FORCE_WAYLAND ?= false
|
||||
@@ -36,9 +38,6 @@ GCH = runtime/Includes/PreCompiled.h.gch
|
||||
CCH = runtime/Includes/PreCompiled.h.pch
|
||||
PCH =
|
||||
|
||||
# Personal path, should be overriden with env var
|
||||
UNIT_TESTS_PATH = ../UnitTester/build/Bin/linux_x86_64/MacroUnitTest
|
||||
|
||||
NZSLC ?= nzslc
|
||||
|
||||
ifeq ($(TOOLCHAIN), gcc)
|
||||
@@ -63,6 +62,14 @@ else
|
||||
CXXFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(FORCE_INTEGRATED_GPU), true)
|
||||
_ENABLEDFLAGS += FORCE_INTEGRATED_GPU
|
||||
endif
|
||||
|
||||
ifeq ($(IMAGES_OPTIMIZED), true)
|
||||
_ENABLEDFLAGS += IMAGE_OPTIMIZED
|
||||
endif
|
||||
|
||||
ifeq ($(GRAPHICS_MEMORY_DUMP), true)
|
||||
_ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP
|
||||
endif
|
||||
@@ -154,9 +161,6 @@ clean-shaders:
|
||||
|
||||
shaders: clean-shaders $(SPVS)
|
||||
|
||||
tests: debug
|
||||
@$(UNIT_TESTS_PATH) --headless --path="./$(NAME)"
|
||||
|
||||
clean:
|
||||
@$(RM) $(OBJ_DIR)
|
||||
@printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n"
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
<div align="center">
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml/badge.svg"></a>
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg"></a>
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/macos.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/macos.yml/badge.svg"></a>
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/macos_x86.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/macos_x86.yml/badge.svg"></a>
|
||||
</div>
|
||||
<div align="center">
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml/badge.svg"></a>
|
||||
</div>
|
||||
<div align="center">
|
||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/tests.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/tests.yml/badge.svg"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
###### MacroLibX, a rewrite of 42 School's MiniLibX using SDL2 and Vulkan.
|
||||
@@ -103,6 +100,12 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
|
||||
### 🛠️ Set the toolchain
|
||||
If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc`
|
||||
|
||||
### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️
|
||||
If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `make IMAGES_OPTIMIZED=false`.
|
||||
|
||||
### 🖥️ Force the integrated GPU (not recommended)
|
||||
You can force the mlx to use your integrated GPU by using `make FORCE_INTEGRATED_GPU=true`. Note that there are a lot of chances that your application crashes by using that.
|
||||
|
||||
### 💽 Dump the graphics memory
|
||||
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `make GRAPHICS_MEMORY_DUMP=true`.
|
||||
|
||||
|
||||
+7
-1
@@ -16,11 +16,17 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
|
||||
### 🛠️ Set the toolchain
|
||||
To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]`
|
||||
|
||||
### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️
|
||||
If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `xmake config --images_optimized=n`.
|
||||
|
||||
### 🖥️ Force the integrated GPU (not recommended)
|
||||
You can force the mlx to use your integrated GPU using `xmake config --force_integrated_gpu=y`. Note that there are a lot of chances that your application crashes by using that.
|
||||
|
||||
### 💽 Dump the graphics memory
|
||||
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `xmake config --graphics_memory_dump=y`.
|
||||
|
||||
### 🪛 A possible build configuration
|
||||
As a configuration example here's how the command can look like `xmake config --mode=debug --toolchain=clang --graphics_memory_dump=y`
|
||||
As a configuration example here's how the command can look like `xmake config --mode=debug --toolchain=clang --graphics_memory_dump=y --images_optimized=n`
|
||||
|
||||
## 🚧 Build the lib
|
||||
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
-DMLX_BUILD
|
||||
-DSDL_MAIN_HANDLED
|
||||
-DDEBUG
|
||||
-DIMAGE_OPTIMIZED
|
||||
-D_REENTRANT
|
||||
-isystem/usr/include/SDL2
|
||||
|
||||
+3
-10
@@ -44,16 +44,11 @@ void update(void* param)
|
||||
mlx_set_font(mlx->mlx, "default");
|
||||
mlx_string_put(mlx->mlx, mlx->win, 20, 50, (mlx_color){ .rgba = 0xFFFFFFFF }, "that's a text");
|
||||
|
||||
int win_width;
|
||||
int win_height;
|
||||
|
||||
mlx_get_window_size(mlx->mlx, mlx->win, &win_width, &win_height);
|
||||
|
||||
uint32_t color = 0;
|
||||
for(int j = 0; j < win_height; j++)
|
||||
for(int j = 0; j < 400; j++)
|
||||
{
|
||||
mlx_pixel_put(mlx->mlx, mlx->win, j, j, (mlx_color){ .rgba = 0x0000FFFF + (color << 24) });
|
||||
mlx_pixel_put(mlx->mlx, mlx->win, win_width - j, j, (mlx_color){ .rgba = 0x0000FFFF });
|
||||
mlx_pixel_put(mlx->mlx, mlx->win, 399 - j, j, (mlx_color){ .rgba = 0x0000FFFF });
|
||||
color += (color < 255);
|
||||
}
|
||||
|
||||
@@ -177,8 +172,6 @@ int main(void)
|
||||
mlx.logo_png = mlx_new_image_from_file(mlx.mlx, "42_logo.png", &dummy, &dummy);
|
||||
mlx.logo_jpg = mlx_new_image_from_file(mlx.mlx, "42_logo.jpg", &dummy, &dummy);
|
||||
|
||||
mlx_set_window_icon(mlx.mlx, mlx.win, mlx.logo_png);
|
||||
|
||||
mlx_pixel_put(mlx.mlx, mlx.win, 200, 10, (mlx_color){ .rgba = 0xFF00FFFF });
|
||||
mlx_put_image_to_window(mlx.mlx, mlx.win, mlx.logo_png, 0, 0);
|
||||
|
||||
@@ -195,7 +188,7 @@ int main(void)
|
||||
mlx_destroy_image(mlx.mlx, mlx.logo_bmp);
|
||||
mlx_destroy_image(mlx.mlx, mlx.img);
|
||||
mlx_destroy_window(mlx.mlx, mlx.win);
|
||||
|
||||
|
||||
mlx_destroy_context(mlx.mlx);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include "../../includes/mlx.h"
|
||||
#include "../../includes/mlx_extended.h"
|
||||
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
typedef VkInstance (*PFN_mlx_get_vk_instance)(mlx_context mlx);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
mlx_context mlx = mlx_init();
|
||||
|
||||
mlx_window_create_info info = { 0 };
|
||||
info.title = "My window";
|
||||
info.width = 400;
|
||||
info.height = 400;
|
||||
info.is_resizable = true;
|
||||
mlx_window win = mlx_new_window(mlx, &info);
|
||||
|
||||
PFN_mlx_get_vk_instance mlx_get_vk_instance = (PFN_mlx_get_vk_instance)mlx_get_proc_addr(mlx, "mlx_get_vk_instance");
|
||||
printf("%p\n", mlx_get_vk_instance(mlx));
|
||||
|
||||
mlx_destroy_window(mlx, win);
|
||||
mlx_destroy_context(mlx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -e a.out ]; then
|
||||
rm a.out
|
||||
fi
|
||||
|
||||
if [ $(uname -s) = 'Darwin' ]; then
|
||||
clang main.c ../../libmlx.dylib -L /opt/homebrew/lib -lSDL2 -lm -g;
|
||||
else
|
||||
clang main.c ../../libmlx.so -lSDL2 -g -Wall -Wextra -Werror -lm;
|
||||
fi
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash ./build.sh
|
||||
./a.out
|
||||
Regular → Executable
+29
-23
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
||||
/* Updated: 2025/10/22 16:59:21 by maldavid ### ########.fr */
|
||||
/* Updated: 2025/01/05 22:44:22 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef union mlx_color
|
||||
/**
|
||||
* @brief Initializes the MLX internal application
|
||||
*
|
||||
* @return (mlx_context) An opaque handler to the internal MLX application or MLX_NULL_HANDLE (0x0) in case of error
|
||||
* @return (mlx_context) An opaque handler to the internal MLX application or NULL (0x0) in case of error
|
||||
*/
|
||||
MLX_API mlx_context mlx_init();
|
||||
|
||||
@@ -122,7 +122,7 @@ typedef struct mlx_window_create_info
|
||||
* @param mlx Internal MLX application
|
||||
* @param info Pointer to a descriptor structure
|
||||
*
|
||||
* @return (mlx_window) An opaque handler to the internal MLX window or MLX_NULL_HANDLE (0x0) in case of error
|
||||
* @return (mlx_widnow) An opaque handler to the internal MLX window or NULL (0x0) in case of error
|
||||
*/
|
||||
MLX_API mlx_window mlx_new_window(mlx_context mlx, const mlx_window_create_info* info);
|
||||
|
||||
@@ -148,7 +148,7 @@ MLX_API void mlx_set_window_position(mlx_context mlx, mlx_window win, int x, int
|
||||
* @brief Sets window size
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to resize
|
||||
* @param win Internal window to move
|
||||
* @param width New width
|
||||
* @param height New height
|
||||
*/
|
||||
@@ -158,25 +158,16 @@ MLX_API void mlx_set_window_size(mlx_context mlx, mlx_window win, int width, int
|
||||
* @brief Sets window title
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to modify
|
||||
* @param win Internal window to move
|
||||
* @param title New title
|
||||
*/
|
||||
MLX_API void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title);
|
||||
|
||||
/**
|
||||
* @brief Sets window icon
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to modify
|
||||
* @param image New icon image
|
||||
*/
|
||||
MLX_API void mlx_set_window_icon(mlx_context mlx, mlx_window win, mlx_image image);
|
||||
|
||||
/**
|
||||
* @brief Enables/Disables window fullscreen mode
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to modify
|
||||
* @param win Internal window to move
|
||||
* @param enable Switch or not to fullscreen
|
||||
*/
|
||||
MLX_API void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool enable);
|
||||
@@ -185,7 +176,7 @@ MLX_API void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool ena
|
||||
* @brief Gets window position
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to get from
|
||||
* @param win Internal window to move
|
||||
* @param x Pointers to get position of the window
|
||||
* @param y Pointers to get position of the window
|
||||
*/
|
||||
@@ -195,7 +186,7 @@ MLX_API void mlx_get_window_position(mlx_context mlx, mlx_window win, int* x, in
|
||||
* @brief Gets window size
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to get from
|
||||
* @param win Internal window to move
|
||||
* @param x Pointers to get size of the window
|
||||
* @param y Pointers to get size of the window
|
||||
*/
|
||||
@@ -322,10 +313,7 @@ MLX_API void mlx_on_event(mlx_context mlx, mlx_window win, mlx_event_type event,
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param color Color of the pixel
|
||||
*
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put(mlx_context mlx, mlx_window win, int x, int y, mlx_color color);
|
||||
|
||||
|
||||
@@ -340,7 +328,7 @@ MLX_API void mlx_pixel_put(mlx_context mlx, mlx_window win, int x, int y, mlx_co
|
||||
* @param width Width of the image
|
||||
* @param height Height of the image
|
||||
*
|
||||
* @return (mlx_image) An opaque handler to the internal image or MLX_NULL_HANDLE (0x0) in case of error
|
||||
* @return (mlx_image) An opaque handler to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
MLX_API mlx_image mlx_new_image(mlx_context mlx, int width, int height);
|
||||
|
||||
@@ -350,9 +338,9 @@ MLX_API mlx_image mlx_new_image(mlx_context mlx, int width, int height);
|
||||
* @param mlx Internal MLX application
|
||||
* @param filename Path to the png file
|
||||
* @param width Get the width of the image
|
||||
* @param height Get the height of the image
|
||||
* @param heigth Get the height of the image
|
||||
*
|
||||
* @return (mlx_image) An opaque handler to the internal image or MLX_NULL_HANDLE (0x0) in case of error
|
||||
* @return (mlx_image) An opaque handler to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
MLX_API mlx_image mlx_new_image_from_file(mlx_context mlx, char* filename, int* width, int* height);
|
||||
|
||||
@@ -373,6 +361,14 @@ MLX_API void mlx_destroy_image(mlx_context mlx, mlx_image image);
|
||||
* @param y Y coordinate in the image
|
||||
*
|
||||
* @return (int) Return the pixel data
|
||||
*
|
||||
* /!\ If you run into glitches when writing or reading pixels from images /!\
|
||||
* You need to add IMAGES_OPTIMIZED=false to your make mlx command
|
||||
* ```
|
||||
* ~ git clone https://github.com/seekrs/MacroLibX.git
|
||||
* ~ cd MacroLibX
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
MLX_API mlx_color mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, int y);
|
||||
|
||||
@@ -384,6 +380,14 @@ MLX_API mlx_color mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, i
|
||||
* @param x X coordinate in the image
|
||||
* @param y Y coordinate in the image
|
||||
* @param color Color of the pixel to set
|
||||
*
|
||||
* /!\ If you run into glitches when writing or reading pixels from images /!\
|
||||
* You need to add IMAGES_OPTIMIZED=false to your make mlx command
|
||||
* ```
|
||||
* ~ git clone https://github.com/seekrs/MacroLibX.git
|
||||
* ~ cd MacroLibX
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
MLX_API void mlx_set_image_pixel(mlx_context mlx, mlx_image image, int x, int y, mlx_color color);
|
||||
|
||||
@@ -419,6 +423,7 @@ MLX_API void mlx_string_put(mlx_context mlx, mlx_window win, int x, int y, mlx_c
|
||||
* @brief Loads a font to be used by `mlx_string_put`
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window
|
||||
* @param filepath Filepath to the font or "default" to reset to the embedded font
|
||||
*/
|
||||
MLX_API void mlx_set_font(mlx_context mlx, char* filepath);
|
||||
@@ -427,6 +432,7 @@ MLX_API void mlx_set_font(mlx_context mlx, char* filepath);
|
||||
* @brief Loads a font to be used by `mlx_string_put` and scales it
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window
|
||||
* @param filepath Filepath to the font or "default" to reset to the embedded font
|
||||
* @param scale Scale to apply to the font
|
||||
*/
|
||||
|
||||
+19
-30
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/14 16:17:10 by maldavid #+# #+# */
|
||||
/* Updated: 2025/10/22 16:59:38 by maldavid ### ########.fr */
|
||||
/* Updated: 2025/01/08 12:37:15 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -75,6 +75,7 @@ MLX_API void mlx_restore_window(mlx_context mlx, mlx_window win);
|
||||
|
||||
/* Pixels drawing related functions */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put an array of pixels in the window
|
||||
*
|
||||
@@ -84,12 +85,7 @@ MLX_API void mlx_restore_window(mlx_context mlx, mlx_window win);
|
||||
* @param y Y coordinate
|
||||
* @param pixels Array of pixels
|
||||
* @param pixels_number Number of pixels
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `pixels` is
|
||||
* big enough for the given array.
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y, mlx_color* pixels, size_t pixels_number);
|
||||
|
||||
/**
|
||||
@@ -105,27 +101,13 @@ MLX_API void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y,
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `pixels` is
|
||||
* big enough for the given region.
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put_region(mlx_context mlx, mlx_window win, int x, int y, int w, int h, mlx_color* pixels);
|
||||
|
||||
|
||||
|
||||
/* Images related functions */
|
||||
|
||||
/**
|
||||
* @brief Set image rectangle
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param img Internal image
|
||||
* @param x X coordinate in the image
|
||||
* @param y Y coordinate in the image
|
||||
* @param w Width of the rectangle
|
||||
* @param y Height of the rectangle
|
||||
* @param color Color of the rectangle
|
||||
*/
|
||||
MLX_API void mlx_set_image_rectangle(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color color);
|
||||
|
||||
/**
|
||||
* @brief Get image region
|
||||
@@ -140,6 +122,14 @@ MLX_API void mlx_set_image_rectangle(mlx_context mlx, mlx_image image, int x, in
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `dst` is
|
||||
* big enough for the given region.
|
||||
*
|
||||
* /!\ If you run into glitches when writing or reading pixels from images /!\
|
||||
* You need to add IMAGES_OPTIMIZED=false to your make mlx command
|
||||
* ```
|
||||
* ~ git clone https://github.com/seekrs/MacroLibX.git
|
||||
* ~ cd MacroLibX
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
MLX_API void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* dst);
|
||||
|
||||
@@ -156,6 +146,14 @@ MLX_API void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `pixels` is
|
||||
* big enough for the given region.
|
||||
*
|
||||
* /!\ If you run into glitches when writing or reading pixels from images /!\
|
||||
* You need to add IMAGES_OPTIMIZED=false to your make mlx command
|
||||
* ```
|
||||
* ~ git clone https://github.com/seekrs/MacroLibX.git
|
||||
* ~ cd MacroLibX
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
MLX_API void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* pixels);
|
||||
|
||||
@@ -171,16 +169,7 @@ MLX_API void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y
|
||||
* @param scale_y Scale y of the image
|
||||
* @param angle Rotation angle of the image (clockwise)
|
||||
*/
|
||||
MLX_API void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, float x, float y, float scale_x, float scale_y, float angle);
|
||||
|
||||
/**
|
||||
* @brief Get direct pointers to hidden functions
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
*
|
||||
* @return (mlx_function) A function pointer or NULL (0x0) in case of error
|
||||
*/
|
||||
MLX_API mlx_function mlx_get_proc_addr(mlx_context mlx, const char* name);
|
||||
MLX_API void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, int x, int y, float scale_x, float scale_y, float angle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* mlx_keycodes.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rprieur <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/08/09 00:15:49 by rprieur #+# #+# */
|
||||
/* Updated: 2026/08/09 00:16:30 by rprieur ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
// MacroLibX official repo https://github.com/seekrs/MacroLibX
|
||||
// MacroLibX official website https://macrolibx.kbz8.me/
|
||||
|
||||
#ifndef MACROLIB_X_KEYCODES_H
|
||||
#define MACROLIB_X_KEYCODES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Event codes for physical keyboard keys
|
||||
*/
|
||||
typedef enum mlx_key_event_code
|
||||
{
|
||||
MLX_KEY_A = 4,
|
||||
MLX_KEY_B = 5,
|
||||
MLX_KEY_C = 6,
|
||||
MLX_KEY_D = 7,
|
||||
MLX_KEY_E = 8,
|
||||
MLX_KEY_F = 9,
|
||||
MLX_KEY_G = 10,
|
||||
MLX_KEY_H = 11,
|
||||
MLX_KEY_I = 12,
|
||||
MLX_KEY_J = 13,
|
||||
MLX_KEY_K = 14,
|
||||
MLX_KEY_L = 15,
|
||||
MLX_KEY_M = 16,
|
||||
MLX_KEY_N = 17,
|
||||
MLX_KEY_O = 18,
|
||||
MLX_KEY_P = 19,
|
||||
MLX_KEY_Q = 20,
|
||||
MLX_KEY_R = 21,
|
||||
MLX_KEY_S = 22,
|
||||
MLX_KEY_T = 23,
|
||||
MLX_KEY_U = 24,
|
||||
MLX_KEY_V = 25,
|
||||
MLX_KEY_W = 26,
|
||||
MLX_KEY_X = 27,
|
||||
MLX_KEY_Y = 28,
|
||||
MLX_KEY_Z = 29,
|
||||
MLX_KEY_1 = 30,
|
||||
MLX_KEY_2 = 31,
|
||||
MLX_KEY_3 = 32,
|
||||
MLX_KEY_4 = 33,
|
||||
MLX_KEY_5 = 34,
|
||||
MLX_KEY_6 = 35,
|
||||
MLX_KEY_7 = 36,
|
||||
MLX_KEY_8 = 37,
|
||||
MLX_KEY_9 = 38,
|
||||
MLX_KEY_0 = 39,
|
||||
MLX_KEY_RETURN = 40,
|
||||
MLX_KEY_ENTER = 40,
|
||||
MLX_KEY_ESCAPE = 41,
|
||||
MLX_KEY_BACKSPACE = 42,
|
||||
MLX_KEY_TAB = 43,
|
||||
MLX_KEY_SPACE = 44,
|
||||
MLX_KEY_MINUS = 45,
|
||||
MLX_KEY_EQUALS = 46,
|
||||
MLX_KEY_LEFTBRACKET = 47,
|
||||
MLX_KEY_RIGHTBRACKET = 48,
|
||||
MLX_KEY_BACKSLASH = 49,
|
||||
MLX_KEY_SEMICOLON = 51,
|
||||
MLX_KEY_APOSTROPHE = 52,
|
||||
MLX_KEY_GRAVE = 53,
|
||||
MLX_KEY_COMMA = 54,
|
||||
MLX_KEY_PERIOD = 55,
|
||||
MLX_KEY_SLASH = 56,
|
||||
MLX_KEY_CAPSLOCK = 57,
|
||||
MLX_KEY_F1 = 58,
|
||||
MLX_KEY_F2 = 59,
|
||||
MLX_KEY_F3 = 60,
|
||||
MLX_KEY_F4 = 61,
|
||||
MLX_KEY_F5 = 62,
|
||||
MLX_KEY_F6 = 63,
|
||||
MLX_KEY_F7 = 64,
|
||||
MLX_KEY_F8 = 65,
|
||||
MLX_KEY_F9 = 66,
|
||||
MLX_KEY_F10 = 67,
|
||||
MLX_KEY_F11 = 68,
|
||||
MLX_KEY_F12 = 69,
|
||||
MLX_KEY_PRINTSCREEN = 70,
|
||||
MLX_KEY_SCROLLLOCK = 71,
|
||||
MLX_KEY_PAUSE = 72,
|
||||
MLX_KEY_INSERT = 73,
|
||||
MLX_KEY_HOME = 74,
|
||||
MLX_KEY_PAGEUP = 75,
|
||||
MLX_KEY_DELETE = 76,
|
||||
MLX_KEY_END = 77,
|
||||
MLX_KEY_PAGEDOWN = 78,
|
||||
MLX_KEY_RIGHT = 79,
|
||||
MLX_KEY_LEFT = 80,
|
||||
MLX_KEY_DOWN = 81,
|
||||
MLX_KEY_UP = 82,
|
||||
MLX_KEY_NUMLOCKCLEAR = 83,
|
||||
MLX_KEY_KP_DIVIDE = 84,
|
||||
MLX_KEY_KP_MULTIPLY = 85,
|
||||
MLX_KEY_KP_MINUS = 86,
|
||||
MLX_KEY_KP_PLUS = 87,
|
||||
MLX_KEY_KP_ENTER = 88,
|
||||
MLX_KEY_KP_1 = 89,
|
||||
MLX_KEY_KP_2 = 90,
|
||||
MLX_KEY_KP_3 = 91,
|
||||
MLX_KEY_KP_4 = 92,
|
||||
MLX_KEY_KP_5 = 93,
|
||||
MLX_KEY_KP_6 = 94,
|
||||
MLX_KEY_KP_7 = 95,
|
||||
MLX_KEY_KP_8 = 96,
|
||||
MLX_KEY_KP_9 = 97,
|
||||
MLX_KEY_KP_0 = 98,
|
||||
MLX_KEY_KP_PERIOD = 99,
|
||||
MLX_KEY_LCTRL = 224,
|
||||
MLX_KEY_LSHIFT = 225,
|
||||
MLX_KEY_LALT = 226,
|
||||
MLX_KEY_LGUI = 227,
|
||||
MLX_KEY_RCTRL = 228,
|
||||
MLX_KEY_RSHIFT = 229,
|
||||
MLX_KEY_RALT = 230,
|
||||
MLX_KEY_RGUI = 231
|
||||
} mlx_key_codes;
|
||||
|
||||
/**
|
||||
* @brief Event codes for mouse buttons
|
||||
*/
|
||||
typedef enum mlx_mouse_code
|
||||
{
|
||||
MLX_MOUSE_LEFT = 1,
|
||||
MLX_MOUSE_MIDDLE = 2,
|
||||
MLX_MOUSE_RIGHT = 3,
|
||||
MLX_MOUSE_4 = 4,
|
||||
MLX_MOUSE_5 = 5,
|
||||
} mlx_mouse_code;
|
||||
|
||||
/**
|
||||
* @brief Event codes for window events
|
||||
*/
|
||||
typedef enum mlx_window_code
|
||||
{
|
||||
MLX_WINDOW_CLOSE = 0,
|
||||
MLX_WINDOW_MOVED = 1,
|
||||
MLX_WINDOW_MINIMIZED = 2,
|
||||
MLX_WINDOW_MAXIMIZED = 3,
|
||||
MLX_WINDOW_ENTER = 4,
|
||||
MLX_WINDOW_FOCUS = 5,
|
||||
MLX_WINDOW_LEAVE = 6,
|
||||
MLX_WINDOW_UNFOCUS = 7,
|
||||
MLX_WINDOW_SIZE_CHANGED = 8,
|
||||
MLX_WINDOW_RESIZED = 9,
|
||||
MLX_WINDOW_RESTORED = 11
|
||||
} mlx_window_code;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+2
-24
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
|
||||
/* Updated: 2025/10/22 13:38:43 by maldavid ### ########.fr */
|
||||
/* Updated: 2025/01/07 00:17:45 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -83,25 +83,6 @@
|
||||
#define MLX_API
|
||||
#endif
|
||||
|
||||
#define MLX_NO_DEPRECATE
|
||||
#ifdef MLX_NO_DEPRECATE
|
||||
#define MLX_DEPRECATED(msg)
|
||||
#elif defined(__has_c_attribute)
|
||||
#if __has_c_attribute(deprecated)
|
||||
#define MLX_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MLX_DEPRECATED
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define MLX_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define MLX_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#else
|
||||
#define MLX_DEPRECATED(msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
|
||||
#define MLX_FUNC_SIG __PRETTY_FUNCTION__
|
||||
#elif defined(__DMC__) && (__DMC__ >= 0x810)
|
||||
@@ -221,11 +202,8 @@
|
||||
#define MLX_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU)
|
||||
|
||||
#define MLX_DEFINE_HANDLE(object) typedef struct object##_handler* object
|
||||
#define MLX_NULL_HANDLE NULL
|
||||
|
||||
typedef void (*mlx_function)(void);
|
||||
|
||||
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 4)
|
||||
#define MLX_VERSION MLX_MAKE_VERSION(2, 0, 0)
|
||||
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
|
||||
|
||||
// Checking common assumptions
|
||||
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
project('MacroLibX',
|
||||
['c', 'cpp'],
|
||||
version : '2.3.0',
|
||||
license : 'MIT',
|
||||
meson_version : '>= 0.63.0',
|
||||
default_options : [
|
||||
'warning_level=2',
|
||||
'optimization=3',
|
||||
'cpp_std=c++20',
|
||||
]
|
||||
)
|
||||
|
||||
add_project_arguments('-DSDL_MAIN_HANDLED', language : 'c')
|
||||
|
||||
if get_option('graphics_memory_dump')
|
||||
add_project_arguments('-DGRAPHICS_MEMORY_DUMP', language : 'c')
|
||||
endif
|
||||
|
||||
if get_option('profiler')
|
||||
add_project_arguments('-DPROFILER_ENABLED', language : 'c')
|
||||
endif
|
||||
|
||||
if get_option('force_wayland')
|
||||
add_project_arguments('-DFORCE_WAYLAND', language : 'c')
|
||||
endif
|
||||
|
||||
if get_option('disable_all_safeties')
|
||||
add_project_arguments('-DDISABLE_ALL_SAFETIES', language : 'c')
|
||||
endif
|
||||
|
||||
includes_directories = include_directories(
|
||||
'includes',
|
||||
'runtime/Includes',
|
||||
'runtime/Sources',
|
||||
'third_party',
|
||||
)
|
||||
|
||||
sources = files(
|
||||
'runtime/Sources/Core/Application.cpp',
|
||||
'runtime/Sources/Core/Bridge.cpp',
|
||||
'runtime/Sources/Core/EventBus.cpp',
|
||||
'runtime/Sources/Core/EventListener.cpp',
|
||||
'runtime/Sources/Core/Fps.cpp',
|
||||
'runtime/Sources/Core/Graphics.cpp',
|
||||
'runtime/Sources/Core/Logs.cpp',
|
||||
'runtime/Sources/Core/Memory.cpp',
|
||||
'runtime/Sources/Core/Profiler.cpp',
|
||||
'runtime/Sources/Core/SDLManager.cpp',
|
||||
'runtime/Sources/Core/UUID.cpp',
|
||||
'runtime/Sources/Graphics/Font.cpp',
|
||||
'runtime/Sources/Graphics/Mesh.cpp',
|
||||
'runtime/Sources/Graphics/PutPixelManager.cpp',
|
||||
'runtime/Sources/Graphics/Scene.cpp',
|
||||
'runtime/Sources/Graphics/Sprite.cpp',
|
||||
'runtime/Sources/Graphics/Text.cpp',
|
||||
'runtime/Sources/Platform/Inputs.cpp',
|
||||
'runtime/Sources/Platform/Window.cpp',
|
||||
'runtime/Sources/Renderer/Pipelines/Graphics.cpp',
|
||||
'runtime/Sources/Renderer/Pipelines/Shader.cpp',
|
||||
'runtime/Sources/Renderer/RenderPasses/2DPass.cpp',
|
||||
'runtime/Sources/Renderer/RenderPasses/FinalPass.cpp',
|
||||
'runtime/Sources/Renderer/RenderPasses/Passes.cpp',
|
||||
'runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp',
|
||||
'runtime/Sources/Renderer/Buffer.cpp',
|
||||
'runtime/Sources/Renderer/Descriptor.cpp',
|
||||
'runtime/Sources/Renderer/Image.cpp',
|
||||
'runtime/Sources/Renderer/Memory.cpp',
|
||||
'runtime/Sources/Renderer/RenderCore.cpp',
|
||||
'runtime/Sources/Renderer/Renderer.cpp',
|
||||
'runtime/Sources/Renderer/SceneRenderer.cpp',
|
||||
'runtime/Sources/Renderer/Swapchain.cpp',
|
||||
)
|
||||
|
||||
mlx_headers = [
|
||||
'includes/mlx.h',
|
||||
'includes/mlx_extended.h',
|
||||
'includes/mlx_profile.h'
|
||||
]
|
||||
|
||||
install_headers(mlx_headers)
|
||||
|
||||
deps = dependency('sdl2')
|
||||
|
||||
libmlx = library('mlx',
|
||||
sources,
|
||||
include_directories : includes_directories,
|
||||
dependencies : deps,
|
||||
install : true)
|
||||
|
||||
libmlx_dep = declare_dependency(
|
||||
include_directories: includes_directories,
|
||||
dependencies : deps,
|
||||
link_with : libmlx)
|
||||
|
||||
meson.override_dependency('mlx', libmlx_dep)
|
||||
|
||||
# PKG CONFIG GENERATION
|
||||
pkg_mod = import('pkgconfig')
|
||||
|
||||
pkg_mod.generate(
|
||||
libmlx,
|
||||
name : 'mlx',
|
||||
description : 'MacroLibX Library',
|
||||
version : meson.project_version(),
|
||||
subdirs : ['.'],
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
option('graphics_memory_dump',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Enable graphics memory dump for debugging purposes.'
|
||||
)
|
||||
|
||||
option('profiler',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Enable profiler for performance analysis.'
|
||||
)
|
||||
|
||||
option('force_wayland',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Force the application to use Wayland display server.'
|
||||
)
|
||||
|
||||
option('disable_all_safeties',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Disable all safety checks in the application.'
|
||||
)
|
||||
@@ -23,7 +23,7 @@ namespace mlx
|
||||
|
||||
inline void OnEvent(mlx_window win, int event, void(*f)(int, void*), void* param) noexcept;
|
||||
|
||||
inline mlx_window NewGraphicsSupport(const mlx_window_create_info* info);
|
||||
inline mlx_window NewGraphicsSuport(const mlx_window_create_info* info);
|
||||
inline NonOwningPtr<GraphicsSupport> GetGraphicsSupport(mlx_window win);
|
||||
inline void DestroyGraphicsSupport(mlx_window win);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace mlx
|
||||
m_fps.SetMaxFPS(fps);
|
||||
}
|
||||
|
||||
mlx_window Application::NewGraphicsSupport(const mlx_window_create_info* info)
|
||||
mlx_window Application::NewGraphicsSuport(const mlx_window_create_info* info)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!info)
|
||||
@@ -68,11 +68,6 @@ namespace mlx
|
||||
Error("invalid window create info (NULL)");
|
||||
return nullptr;
|
||||
}
|
||||
if (info->title == nullptr)
|
||||
{
|
||||
Error("invalid window title (NULL)");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mlx_window window;
|
||||
try { window = new mlx_window_handler; }
|
||||
@@ -139,7 +134,7 @@ namespace mlx
|
||||
{
|
||||
m_hooks.emplace_back(f, param);
|
||||
}
|
||||
|
||||
|
||||
void Application::LoopEnd() noexcept
|
||||
{
|
||||
m_in.Finish();
|
||||
|
||||
@@ -19,10 +19,9 @@ namespace mlx
|
||||
|
||||
enum class Event
|
||||
{
|
||||
ResizeEventCode = 1,
|
||||
SwapchainResizeEventCode,
|
||||
FrameBeginEventCode,
|
||||
FatalErrorEventCode,
|
||||
ResizeEventCode = 56,
|
||||
FrameBeginEventCode = 57,
|
||||
FatalErrorEventCode = 168,
|
||||
|
||||
EndEnum
|
||||
};
|
||||
|
||||
@@ -1,30 +1,26 @@
|
||||
#ifndef __MLX_FPS__
|
||||
#define __MLX_FPS__
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
typedef std::chrono::steady_clock fps_clock;
|
||||
|
||||
class FpsManager
|
||||
{
|
||||
public:
|
||||
FpsManager() = default;
|
||||
|
||||
void Init();
|
||||
void WaitUntilNextFrame();
|
||||
inline void SetMaxFPS(std::uint32_t fps) noexcept { m_target_delta = fps_clock::duration(std::chrono::seconds(1)) / fps;}
|
||||
bool Update();
|
||||
inline void SetMaxFPS(std::uint32_t fps) noexcept { m_max_fps = fps; m_ns = 1000000000.0 / fps; }
|
||||
|
||||
~FpsManager() = default;
|
||||
|
||||
private:
|
||||
fps_clock::time_point m_current_time;
|
||||
fps_clock::time_point m_target_time;
|
||||
fps_clock::time_point m_last_time_record;
|
||||
fps_clock::duration m_delta_time = fps_clock::duration().zero();
|
||||
fps_clock::duration m_target_delta = fps_clock::duration().zero();
|
||||
fps_clock::duration m_sleep_margin = std::chrono::microseconds(200);
|
||||
double m_ns = 1000000000.0 / 1'337'000.0;
|
||||
std::int64_t m_fps_before = 0;
|
||||
std::int64_t m_fps_now = 0;
|
||||
std::int64_t m_timer = 0;
|
||||
std::uint32_t m_max_fps = 1'337'000;
|
||||
std::uint32_t m_fps_elapsed_time = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,33 +28,20 @@ namespace mlx
|
||||
void PixelPutArray(int x, int y, mlx_color* color, std::size_t pixels_size) noexcept;
|
||||
void PixelPutRegion(int x, int y, int w, int h, mlx_color* color) noexcept;
|
||||
void StringPut(int x, int y, mlx_color color, std::string str);
|
||||
void TexturePut(NonOwningPtr<class Texture> texture, float x, float y, float scale_x, float scale_y, float angle);
|
||||
void TexturePut(NonOwningPtr<class Texture> texture, int x, int y, float scale_x, float scale_y, float angle);
|
||||
|
||||
inline void TryEraseSpritesInScene(NonOwningPtr<Texture> texture) noexcept;
|
||||
|
||||
inline void AddPreRenderHook(void(*f)(VkCommandBuffer, void*), void* param);
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE bool HasWindow() const noexcept { return m_has_window; }
|
||||
[[nodiscard]] MLX_FORCEINLINE Renderer& GetRenderer() { return m_renderer; }
|
||||
[[nodiscard]] MLX_FORCEINLINE Scene& GetScene() { return *p_scene; }
|
||||
|
||||
~GraphicsSupport();
|
||||
|
||||
private:
|
||||
struct Hook
|
||||
{
|
||||
std::function<void(VkCommandBuffer, void*)> fn;
|
||||
void* param;
|
||||
|
||||
Hook(std::function<void(VkCommandBuffer, void*)> fn, void* param) : fn(fn), param(param) {}
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
Renderer m_renderer;
|
||||
SceneRenderer m_scene_renderer;
|
||||
PutPixelManager m_put_pixel_manager;
|
||||
std::vector<Hook> m_hooks;
|
||||
std::shared_ptr<Window> p_window;
|
||||
std::unique_ptr<Scene> p_scene;
|
||||
|
||||
|
||||
@@ -8,9 +8,4 @@ namespace mlx
|
||||
MLX_PROFILE_FUNCTION();
|
||||
p_scene->TryEraseSpriteFromTexture(texture);
|
||||
}
|
||||
|
||||
void GraphicsSupport::AddPreRenderHook(void(*f)(VkCommandBuffer, void*), void* param)
|
||||
{
|
||||
m_hooks.emplace_back(f, param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace mlx
|
||||
|
||||
std::unordered_map<std::string, std::pair<std::size_t, ProfileResult>> m_profile_data;
|
||||
std::ofstream m_output_stream;
|
||||
std::mutex m_mutex;
|
||||
bool m_runtime_session_began = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <mlx.h>
|
||||
#include <Maths/Vec2.h>
|
||||
#include <Renderer/Image.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -15,19 +14,16 @@ namespace mlx
|
||||
Handle CreateWindow(const mlx_window_create_info* info, std::int32_t& id, bool hidden);
|
||||
void DestroyWindow(Handle window) noexcept;
|
||||
|
||||
SDL_Window* GetRawWindow(Handle window) noexcept;
|
||||
|
||||
void InputsFetcher(std::function<void(mlx_event_type, int, int)> functor);
|
||||
void SetInputBinding(std::function<void(SDL_Event*)> functor);
|
||||
|
||||
VkSurfaceKHR CreateVulkanSurface(Handle window, VkInstance instance) const noexcept;
|
||||
std::vector<const char*> GetRequiredVulkanInstanceExtentions(Handle window) const noexcept;
|
||||
Vec2ui GetVulkanDrawableSize(Handle window) const noexcept;
|
||||
void MoveMouseOnWindow(Handle window, int x, int y) const noexcept;
|
||||
void GetScreenSizeWindowIsOn(Handle window, int* x, int* y) const noexcept;
|
||||
void SetWindowPosition(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowSize(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowTitle(Handle window, std::string_view title) const noexcept;
|
||||
void SetWindowIcon(Handle window, NonOwningPtr<Texture> texture) const noexcept;
|
||||
void SetWindowFullscreen(Handle window, bool enable) const noexcept;
|
||||
void SetWindowMaxSize(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowMinSize(Handle window, int x, int y) const noexcept;
|
||||
@@ -54,7 +50,6 @@ namespace mlx
|
||||
private:
|
||||
static SDLManager* s_instance;
|
||||
|
||||
std::function<void(SDL_Event*)> m_binding_hook;
|
||||
std::unordered_set<Handle> m_windows_registry;
|
||||
bool m_drop_sdl_responsability = false;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,9 @@ namespace mlx
|
||||
{
|
||||
public:
|
||||
UUID();
|
||||
inline operator std::uint64_t() const noexcept { return m_uuid; }
|
||||
UUID(std::uint64_t uuid);
|
||||
|
||||
inline operator std::uint64_t() const { return m_uuid; }
|
||||
|
||||
private:
|
||||
std::uint64_t m_uuid;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace mlx
|
||||
|
||||
inline void UpdateDescriptorSet(std::shared_ptr<DescriptorSet> set)
|
||||
{
|
||||
p_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool(set->GetShaderLayout(), set->GetShaderType()).RequestDescriptorSet(set->GetShaderLayout(), set->GetShaderType());
|
||||
p_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool().RequestDescriptorSet(set->GetShaderLayout(), set->GetShaderType());
|
||||
}
|
||||
|
||||
virtual void Bind(std::size_t frame_index, VkCommandBuffer cmd) = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace mlx
|
||||
class PutPixelManager
|
||||
{
|
||||
public:
|
||||
PutPixelManager(NonOwningPtr<class Renderer> renderer);
|
||||
PutPixelManager(NonOwningPtr<class Renderer> renderer) : p_renderer(renderer) {}
|
||||
|
||||
// Returns a valid pointer when a new texture has been created
|
||||
NonOwningPtr<Texture> DrawPixel(int x, int y, std::uint64_t draw_layer, mlx_color color);
|
||||
@@ -20,7 +20,6 @@ namespace mlx
|
||||
|
||||
private:
|
||||
NonOwningPtr<Texture> GetLayer(std::uint64_t draw_layer, bool& is_newlayer);
|
||||
std::unique_ptr<Texture> NewTexture();
|
||||
|
||||
private:
|
||||
std::unordered_map<std::uint64_t, NonOwningPtr<Texture>> m_placements;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <mlx.h>
|
||||
#include <Maths/Vec2.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Renderer/Image.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -25,7 +24,6 @@ namespace mlx
|
||||
MLX_FORCEINLINE void SetPosition(int x, int y) { SDLManager::Get().SetWindowPosition(p_window, x, y); }
|
||||
MLX_FORCEINLINE void SetSize(int x, int y) { SDLManager::Get().SetWindowSize(p_window, x, y); m_width = x; m_height = y; }
|
||||
MLX_FORCEINLINE void SetTitle(std::string title) { SDLManager::Get().SetWindowTitle(p_window, title); m_name = std::move(title); }
|
||||
MLX_FORCEINLINE void SetIcon(NonOwningPtr<Texture> texture) {SDLManager::Get().SetWindowIcon(p_window, texture); }
|
||||
MLX_FORCEINLINE void SetFullscreen(bool enable) { SDLManager::Get().SetWindowFullscreen(p_window, enable); }
|
||||
MLX_FORCEINLINE void SetMaxSize(int x, int y) { SDLManager::Get().SetWindowMaxSize(p_window, x, y); }
|
||||
MLX_FORCEINLINE void SetMinSize(int x, int y) { SDLManager::Get().SetWindowMinSize(p_window, x, y); }
|
||||
@@ -37,10 +35,9 @@ namespace mlx
|
||||
MLX_FORCEINLINE void GetSize(int* x, int* y) { *x = GetWidth(); *y = GetHeight(); }
|
||||
|
||||
MLX_FORCEINLINE VkSurfaceKHR CreateVulkanSurface(VkInstance instance) const noexcept { return SDLManager::Get().CreateVulkanSurface(p_window, instance); }
|
||||
MLX_FORCEINLINE std::vector<const char*> GetRequiredVulkanInstanceExtentions() const noexcept { return SDLManager::Get().GetRequiredVulkanInstanceExtentions(p_window); }
|
||||
MLX_FORCEINLINE Vec2ui GetVulkanDrawableSize() const noexcept { return SDLManager::Get().GetVulkanDrawableSize(p_window); }
|
||||
|
||||
[[nodiscard]] inline Handle GetRawHandle() const noexcept { return p_window; }
|
||||
|
||||
void Destroy() noexcept;
|
||||
|
||||
~Window() { Destroy(); }
|
||||
|
||||
@@ -17,21 +17,8 @@
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#if __has_include(<SDL2/SDL.h>)
|
||||
#include <SDL2/SDL.h>
|
||||
#elif __has_include(<SDL.h>)
|
||||
#include <SDL.h>
|
||||
#else
|
||||
#error Failed to find SDL2 headers
|
||||
#endif
|
||||
|
||||
#if __has_include(<SDL2/SDL_syswm.h>)
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#elif __has_include(<SDL_syswm.h>)
|
||||
#include <SDL_syswm.h>
|
||||
#else
|
||||
#error Failed to find SDL2 SysWMinfo
|
||||
#endif
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_vulkan.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace mlx
|
||||
|
||||
std::shared_ptr<class DescriptorSet> RequestDescriptorSet(const ShaderSetLayout& layout, ShaderType shader_type);
|
||||
void ReturnDescriptorSet(std::shared_ptr<class DescriptorSet> set);
|
||||
bool CanAllocate(const ShaderSetLayout& layout, ShaderType shader_type) const;
|
||||
|
||||
[[nodiscard]] inline VkDescriptorPool Get() const noexcept { return m_pool; }
|
||||
[[nodiscard]] MLX_FORCEINLINE std::size_t GetNumberOfSetsAllocated() const noexcept { return m_allocation_count; }
|
||||
|
||||
~DescriptorPool() = default;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace mlx
|
||||
std::vector<std::shared_ptr<class DescriptorSet>> m_free_sets;
|
||||
std::vector<std::shared_ptr<class DescriptorSet>> m_used_sets;
|
||||
VkDescriptorPool m_pool;
|
||||
std::size_t m_allocation_count = 0;
|
||||
};
|
||||
|
||||
class DescriptorPoolManager
|
||||
@@ -43,13 +44,13 @@ namespace mlx
|
||||
public:
|
||||
DescriptorPoolManager() = default;
|
||||
|
||||
DescriptorPool& GetAvailablePool(const ShaderSetLayout& layout, ShaderType shader_type);
|
||||
DescriptorPool& GetAvailablePool();
|
||||
void Destroy();
|
||||
|
||||
~DescriptorPoolManager() = default;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<DescriptorPool>> m_pools;
|
||||
std::vector<DescriptorPool> m_pools;
|
||||
};
|
||||
|
||||
class DescriptorSet : public std::enable_shared_from_this<DescriptorSet>
|
||||
|
||||
@@ -86,19 +86,10 @@ namespace mlx
|
||||
void SetPixel(int x, int y, mlx_color color) noexcept;
|
||||
void SetRegion(int x, int y, int w, int h, mlx_color* color) noexcept;
|
||||
void SetLinearRegion(int x, int y, std::size_t len, mlx_color* color) noexcept;
|
||||
void SetRectangle(int x, int y, int w, int h, mlx_color color) noexcept;
|
||||
mlx_color GetPixel(int x, int y) noexcept;
|
||||
void GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept;
|
||||
void Clear(VkCommandBuffer cmd, Vec4f color) override;
|
||||
void CopyTo(Texture& other);
|
||||
void Resize(std::uint32_t width, std::uint32_t height);
|
||||
|
||||
void Swap(Texture& texture) noexcept;
|
||||
|
||||
mlx_color* GetBufferCopy() noexcept;
|
||||
|
||||
// If a valid cmd buffer is passed, this function takes ownership and makes it invalid after
|
||||
void SyncCPUBuffer(VkCommandBuffer cmd = VK_NULL_HANDLE);
|
||||
void Update(VkCommandBuffer cmd);
|
||||
|
||||
~Texture() override { Destroy(); }
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace mlx
|
||||
|
||||
private:
|
||||
Swapchain m_swapchain;
|
||||
std::vector<VkSemaphore> m_render_finished_semaphores;
|
||||
std::array<VkSemaphore, MAX_FRAMES_IN_FLIGHT> m_image_available_semaphores;
|
||||
std::array<VkSemaphore, MAX_FRAMES_IN_FLIGHT> m_render_finished_semaphores;
|
||||
std::array<VkCommandBuffer, MAX_FRAMES_IN_FLIGHT> m_cmd_buffers;
|
||||
std::array<VkFence, MAX_FRAMES_IN_FLIGHT> m_cmd_fences;
|
||||
NonOwningPtr<Window> p_window;
|
||||
|
||||
@@ -123,41 +123,5 @@
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR)
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR)
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR)
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#ifdef VK_KHR_android_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateAndroidSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#ifdef VK_KHR_xcb_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#ifdef VK_KHR_xlib_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateXlibSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#ifdef VK_KHR_wayland_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateWaylandSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#ifdef VK_KHR_win32_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateWin32SurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#ifdef VK_EXT_metal_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateMetalSurfaceEXT)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef __MLX_CPU_BUFFER__
|
||||
#define __MLX_CPU_BUFFER__
|
||||
|
||||
#include <PreCompiled.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class CPUBuffer
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
Application::Application() : p_mem_manager(std::make_unique<MemManager>()), p_sdl_manager(std::make_unique<SDLManager>()), m_fps(), m_in()
|
||||
Application::Application() : p_mem_manager(std::make_unique<MemManager>()), p_sdl_manager(std::make_unique<SDLManager>()), m_fps(), m_in()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
std::srand(std::time(nullptr));
|
||||
@@ -33,7 +33,8 @@ namespace mlx
|
||||
|
||||
while(m_in.IsRunning())
|
||||
{
|
||||
m_fps.WaitUntilNextFrame();
|
||||
if(!m_fps.Update())
|
||||
continue;
|
||||
|
||||
m_in.FetchInputs();
|
||||
|
||||
|
||||
+11
-240
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <Core/Application.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Renderer/RenderCore.h>
|
||||
#include <mlx.h>
|
||||
#include <mlx_extended.h>
|
||||
#include <Core/Memory.h>
|
||||
#include <Core/Handles.h>
|
||||
#include <Renderer/RenderCore.h>
|
||||
|
||||
static mlx::Application* __internal_application_ptr = nullptr;
|
||||
|
||||
@@ -45,9 +45,10 @@ extern "C"
|
||||
void mlx_set_fps_goal(mlx_context mlx, int fps)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
if(fps <= 0)
|
||||
fps = -1;
|
||||
mlx->app->SetFPSCap(static_cast<std::uint32_t>(fps));
|
||||
if(fps < 0)
|
||||
mlx::Error("You cannot set a negative FPS cap (nice try)");
|
||||
else
|
||||
mlx->app->SetFPSCap(static_cast<std::uint32_t>(fps));
|
||||
}
|
||||
|
||||
void mlx_destroy_context(mlx_context mlx)
|
||||
@@ -61,7 +62,7 @@ extern "C"
|
||||
mlx_window mlx_new_window(mlx_context mlx, const mlx_window_create_info* info)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return mlx->app->NewGraphicsSupport(info);
|
||||
return mlx->app->NewGraphicsSuport(info);
|
||||
}
|
||||
|
||||
void mlx_destroy_window(mlx_context mlx, mlx_window win)
|
||||
@@ -91,29 +92,12 @@ extern "C"
|
||||
void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
if (title == nullptr)
|
||||
{
|
||||
mlx::Error("invalid window title (NULL)");
|
||||
return;
|
||||
}
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->SetTitle(title);
|
||||
}
|
||||
|
||||
void mlx_set_window_icon(mlx_context mlx, mlx_window win, mlx_image image)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
if(!texture)
|
||||
return;
|
||||
gs->GetWindow()->SetIcon(texture);
|
||||
}
|
||||
|
||||
void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool enable)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
@@ -254,15 +238,6 @@ extern "C"
|
||||
mlx::Error("Image loader: not a valid file format '%'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
{
|
||||
std::ifstream stream(file, std::ios::binary);
|
||||
if(!stream.is_open())
|
||||
{
|
||||
mlx::Error("Image loader: failed to open file '%'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return mlx->app->NewStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
@@ -329,29 +304,12 @@ extern "C"
|
||||
mlx::Error("Font loader: filepath is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
std::filesystem::path file(filepath);
|
||||
if (std::strcmp(filepath, "default") != 0 && !std::filesystem::exists(file))
|
||||
if(std::strcmp(filepath, "default") != 0 && file.extension() != ".ttf" && file.extension() != ".tte")
|
||||
{
|
||||
mlx::Error("TTF loader: unable to find file '%'", filepath);
|
||||
mlx::Error("TTF loader: not a truetype font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
if(std::strcmp(filepath, "default") != 0)
|
||||
{
|
||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||
{
|
||||
mlx::Error("TTF loader: not a truetype font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
std::ifstream stream(file, std::ios::binary);
|
||||
if(!stream.is_open())
|
||||
{
|
||||
mlx::Error("TTF loader: failed to open font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(std::strcmp(filepath, "default") == 0)
|
||||
mlx->app->LoadFont(file, 6.f);
|
||||
else
|
||||
@@ -366,29 +324,12 @@ extern "C"
|
||||
mlx::Error("Font loader: filepath is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
std::filesystem::path file(filepath);
|
||||
if (std::strcmp(filepath, "default") != 0 && !std::filesystem::exists(file))
|
||||
if(std::strcmp(filepath, "default") != 0 && file.extension() != ".ttf" && file.extension() != ".tte")
|
||||
{
|
||||
mlx::Error("TTF loader: unable to find file '%'", filepath);
|
||||
mlx::Error("TTF loader: not a truetype font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
if(std::strcmp(filepath, "default") != 0)
|
||||
{
|
||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||
{
|
||||
mlx::Error("TTF loader: not a truetype font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
std::ifstream stream(file, std::ios::binary);
|
||||
if(!stream.is_open())
|
||||
{
|
||||
mlx::Error("TTF loader: failed to open font file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mlx->app->LoadFont(file, scale);
|
||||
}
|
||||
|
||||
@@ -457,15 +398,6 @@ extern "C"
|
||||
gs->PixelPutRegion(x, y, w, h, pixels);
|
||||
}
|
||||
|
||||
void mlx_set_image_rectangle(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
if(!texture)
|
||||
return;
|
||||
texture->SetRectangle(x, y, w, h, color);
|
||||
}
|
||||
|
||||
void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* dst)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
@@ -484,7 +416,7 @@ extern "C"
|
||||
texture->SetRegion(x, y, w, h, pixels);
|
||||
}
|
||||
|
||||
void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, float x, float y, float scale_x, float scale_y, float angle)
|
||||
void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, int x, int y, float scale_x, float scale_y, float angle)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -495,165 +427,4 @@ extern "C"
|
||||
return;
|
||||
gs->TexturePut(texture, x, y, scale_x, scale_y, angle);
|
||||
}
|
||||
|
||||
// Hidden bindings
|
||||
|
||||
VkInstance mlx_get_vk_instance(mlx_context mlx)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return mlx::RenderCore::Get().GetInstance();
|
||||
}
|
||||
|
||||
VkPhysicalDevice mlx_get_vk_physical_device(mlx_context mlx)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return mlx::RenderCore::Get().GetPhysicalDevice();
|
||||
}
|
||||
|
||||
VkDevice mlx_get_vk_device(mlx_context mlx)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return mlx::RenderCore::Get().GetDevice();
|
||||
}
|
||||
|
||||
VkQueue mlx_get_vk_graphics_queue(mlx_context mlx)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return kvfGetDeviceQueue(mlx::RenderCore::Get().GetDevice(), KVF_GRAPHICS_QUEUE);
|
||||
}
|
||||
|
||||
unsigned int mlx_get_vk_graphics_queue_family(mlx_context mlx)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return kvfGetDeviceQueueFamily(mlx::RenderCore::Get().GetDevice(), KVF_GRAPHICS_QUEUE);
|
||||
}
|
||||
|
||||
mlx_function mlx_get_vk_fn(mlx_context mlx, const char* name)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
#define MLX_VULKAN_GLOBAL_FUNCTION(fn) if(std::strcmp(name, #fn) == 0) return reinterpret_cast<mlx_function>(mlx::RenderCore::Get().fn);
|
||||
#define MLX_VULKAN_INSTANCE_FUNCTION(fn) if(std::strcmp(name, #fn) == 0) return reinterpret_cast<mlx_function>(mlx::RenderCore::Get().fn);
|
||||
#define MLX_VULKAN_DEVICE_FUNCTION(fn) if(std::strcmp(name, #fn) == 0) return reinterpret_cast<mlx_function>(mlx::RenderCore::Get().fn);
|
||||
#include <Renderer/Vulkan/VulkanDefs.h>
|
||||
#undef MLX_VULKAN_GLOBAL_FUNCTION
|
||||
#undef MLX_VULKAN_INSTANCE_FUNCTION
|
||||
#undef MLX_VULKAN_DEVICE_FUNCTION
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VkSurfaceKHR mlx_get_vk_surface(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return VK_NULL_HANDLE;
|
||||
return gs->GetRenderer().GetSwapchain().GetSurface();
|
||||
}
|
||||
|
||||
VkImage mlx_get_vk_swapchain_image(mlx_context mlx, mlx_window win, unsigned int index)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
||||
return VK_NULL_HANDLE;
|
||||
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].Get();
|
||||
}
|
||||
|
||||
unsigned int mlx_get_vk_swapchain_image_count(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return 0;
|
||||
return gs->GetRenderer().GetSwapchain().GetImagesCount();
|
||||
}
|
||||
|
||||
VkImageView mlx_get_vk_swapchain_image_view(mlx_context mlx, mlx_window win, unsigned int index)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
||||
return VK_NULL_HANDLE;
|
||||
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].GetImageView();
|
||||
}
|
||||
|
||||
unsigned int mlx_get_current_vk_swapchain_image_index(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return -1;
|
||||
return gs->GetRenderer().GetSwapchain().GetImageIndex();
|
||||
}
|
||||
|
||||
VkExtent2D mlx_get_vk_swapchain_extent(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return {};
|
||||
return kvfGetSwapchainImagesSize(gs->GetRenderer().GetSwapchain().Get());
|
||||
}
|
||||
|
||||
VkFormat mlx_get_vk_swapchain_format(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return VK_FORMAT_UNDEFINED;
|
||||
return kvfGetSwapchainImagesFormat(gs->GetRenderer().GetSwapchain().Get());
|
||||
}
|
||||
|
||||
void* mlx_get_window_handle(mlx_context mlx, mlx_window win)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs || !gs->HasWindow())
|
||||
return nullptr;
|
||||
return mlx::SDLManager::Get().GetRawWindow(gs->GetWindow()->GetRawHandle());
|
||||
}
|
||||
|
||||
void mlx_set_sdl_input_hook(mlx_context mlx, void(*f)(void*))
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::SDLManager::Get().SetInputBinding(f);
|
||||
}
|
||||
|
||||
void mlx_add_pre_render_hook(mlx_context mlx, mlx_window win, void(*f)(VkCommandBuffer, void*), void* param)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs)
|
||||
return;
|
||||
gs->AddPreRenderHook(f, param);
|
||||
}
|
||||
|
||||
mlx_function mlx_get_proc_addr(mlx_context mlx, const char* name)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
#define MLX_MAKE_ENTRY(fn) { #fn, reinterpret_cast<mlx_function>(fn) }
|
||||
std::unordered_map<std::string, mlx_function> entries = {
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_instance),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_surface),
|
||||
MLX_MAKE_ENTRY(mlx_set_sdl_input_hook),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_physical_device),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_graphics_queue),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_graphics_queue_family),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_device),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_fn),
|
||||
MLX_MAKE_ENTRY(mlx_get_window_handle),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_swapchain_image_count),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_swapchain_extent),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_swapchain_format),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_swapchain_image),
|
||||
MLX_MAKE_ENTRY(mlx_get_vk_swapchain_image_view),
|
||||
MLX_MAKE_ENTRY(mlx_get_current_vk_swapchain_image_index),
|
||||
MLX_MAKE_ENTRY(mlx_add_pre_render_hook),
|
||||
};
|
||||
auto it = entries.find(std::string{ name });
|
||||
if(it != entries.end())
|
||||
return it->second;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
#include <PreCompiled.h>
|
||||
#include <Core/Fps.h>
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
void FpsManager::Init()
|
||||
{
|
||||
m_current_time = fps_clock::now();
|
||||
m_target_time = m_current_time + m_target_delta;
|
||||
m_timer = static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
m_fps_before = m_timer;
|
||||
m_fps_now = m_timer;
|
||||
}
|
||||
|
||||
void FpsManager::WaitUntilNextFrame()
|
||||
bool FpsManager::Update()
|
||||
{
|
||||
m_current_time = fps_clock::now();
|
||||
if(m_current_time < m_target_time)
|
||||
using namespace std::chrono_literals;
|
||||
m_fps_now = static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
|
||||
if(std::chrono::duration<std::uint64_t>{m_fps_now - m_timer} >= 1s)
|
||||
m_timer += m_fps_now;
|
||||
|
||||
m_fps_elapsed_time = m_fps_now - m_fps_before;
|
||||
if(m_fps_elapsed_time >= m_ns)
|
||||
{
|
||||
std::this_thread::sleep_until(m_target_time - m_sleep_margin);
|
||||
m_current_time = fps_clock::now();
|
||||
while (m_current_time < m_target_time)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
_mm_pause(); // reduces CPU usage on x86 without yielding
|
||||
#endif
|
||||
m_current_time = fps_clock::now();
|
||||
}
|
||||
m_fps_before += m_ns;
|
||||
return true;
|
||||
}
|
||||
else if (m_target_time < m_current_time - m_target_delta * 4)
|
||||
m_target_time = m_current_time;
|
||||
m_target_time += m_target_delta;
|
||||
m_delta_time = m_current_time - m_last_time_record;
|
||||
m_last_time_record = m_current_time;
|
||||
std::this_thread::sleep_for(std::chrono::duration<double, std::nano>(m_ns - 1));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,6 @@ namespace mlx
|
||||
m_renderer.BeginFrame();
|
||||
m_draw_layer = 0;
|
||||
m_scene_renderer.Render(*p_scene, m_renderer);
|
||||
for(const auto& hook : m_hooks)
|
||||
{
|
||||
if(hook.fn)
|
||||
hook.fn(m_renderer.GetActiveCommandBuffer(), hook.param);
|
||||
}
|
||||
m_renderer.EndFrame();
|
||||
#ifdef GRAPHICS_MEMORY_DUMP
|
||||
// Dump memory usage to file every two seconds
|
||||
@@ -136,7 +131,7 @@ namespace mlx
|
||||
p_scene->BringToDrawLayer(text.Get(), m_draw_layer);
|
||||
}
|
||||
|
||||
void GraphicsSupport::TexturePut(NonOwningPtr<Texture> texture, float x, float y, float scale_x, float scale_y, float angle)
|
||||
void GraphicsSupport::TexturePut(NonOwningPtr<Texture> texture, int x, int y, float scale_x, float scale_y, float angle)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
NonOwningPtr<Sprite> sprite = p_scene->GetSpriteFromTexturePositionScaleRotation(texture, Vec2f{ static_cast<float>(x), static_cast<float>(y) }, scale_x, scale_y, angle);
|
||||
@@ -146,14 +141,14 @@ namespace mlx
|
||||
{
|
||||
m_draw_layer++;
|
||||
m_pixelput_called = false;
|
||||
}
|
||||
}
|
||||
Sprite& new_sprite = p_scene->CreateSprite(texture);
|
||||
new_sprite.SetCenter(Vec2f{ texture->GetWidth() * 0.5f, texture->GetHeight() * 0.5f });
|
||||
new_sprite.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
|
||||
new_sprite.SetScale(Vec2f{ scale_x, scale_y });
|
||||
new_sprite.SetRotation(angle);
|
||||
}
|
||||
else if(!p_scene->IsTextureAtGivenDrawLayer(texture, m_draw_layer))
|
||||
else if(!p_scene->IsTextureAtGivenDrawLayer(texture, m_draw_layer))
|
||||
p_scene->BringToDrawLayer(sprite.Get(), m_draw_layer);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace mlx
|
||||
using namespace std::literals;
|
||||
|
||||
#ifndef DEBUG
|
||||
if(type == LogType::Debug && std::getenv("MLX_DEBUG_LOGS") == nullptr)
|
||||
return;
|
||||
if(type == LogType::Debug)
|
||||
return;
|
||||
#endif
|
||||
|
||||
std::string code_infos;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace mlx
|
||||
|
||||
void* MemManager::AlignedMalloc(std::size_t alignment, std::size_t size)
|
||||
{
|
||||
#ifdef MLX_PLAT_WINDOWS
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
void* ptr = _aligned_malloc(size, alignment);
|
||||
#else
|
||||
if(alignment < sizeof(void*))
|
||||
@@ -66,7 +66,7 @@ namespace mlx
|
||||
{
|
||||
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
||||
|
||||
#ifdef MLX_PLAT_WINDOWS
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
void* ptr2 = _aligned_realloc(ptr, size, alignment);
|
||||
if(it != s_blocks.end())
|
||||
s_blocks.erase(it);
|
||||
@@ -90,7 +90,7 @@ namespace mlx
|
||||
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
||||
if(it == s_blocks.end())
|
||||
return;
|
||||
#ifdef MLX_PLAT_WINDOWS
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
if(it->aligned)
|
||||
_aligned_free(it->ptr);
|
||||
else
|
||||
@@ -105,7 +105,7 @@ namespace mlx
|
||||
{
|
||||
for(const Descriptor& desc : s_blocks)
|
||||
{
|
||||
#ifdef MLX_PLAT_WINDOWS
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
if(desc.aligned)
|
||||
_aligned_free(desc.ptr);
|
||||
else
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace mlx
|
||||
|
||||
void Profiler::BeginRuntimeSession()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
if(m_runtime_session_began)
|
||||
return;
|
||||
m_output_stream.open("./runtime_profile.mlx.json", std::ofstream::out | std::ofstream::trunc);
|
||||
@@ -21,6 +22,7 @@ namespace mlx
|
||||
|
||||
void Profiler::AppendProfileData(ProfileResult&& result)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
auto it = m_profile_data.find(result.name);
|
||||
if(it != m_profile_data.end())
|
||||
{
|
||||
@@ -47,6 +49,7 @@ namespace mlx
|
||||
|
||||
void Profiler::EndRuntimeSession()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
if(!m_runtime_session_began)
|
||||
return;
|
||||
for(auto& [_, pair] : m_profile_data)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "Utils/Buffer.h"
|
||||
#include "mlx.h"
|
||||
#include <PreCompiled.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Core/Memory.h>
|
||||
@@ -24,17 +22,15 @@ namespace mlx
|
||||
MLX_PROFILE_FUNCTION();
|
||||
s_instance = this;
|
||||
|
||||
m_drop_sdl_responsability = SDL_WasInit(SDL_INIT_VIDEO) || std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||
m_drop_sdl_responsability = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
if(m_drop_sdl_responsability) // is case the mlx is running in a sandbox like MacroUnitTester where SDL is already init
|
||||
return;
|
||||
//SDL_SetMemoryFunctions(MemManager::Get().Malloc, MemManager::Get().Calloc, MemManager::Get().Realloc, MemManager::Get().Free);
|
||||
SDL_SetMemoryFunctions(MemManager::Get().Malloc, MemManager::Get().Calloc, MemManager::Get().Realloc, MemManager::Get().Free);
|
||||
|
||||
#ifdef FORCE_WAYLAND
|
||||
SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");
|
||||
#endif
|
||||
|
||||
//SDL_SetHintWithPriority(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, "1", SDL_HINT_OVERRIDE);
|
||||
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER) != 0)
|
||||
FatalError("SDL: unable to init all subsystems; %", SDL_GetError());
|
||||
DebugLog("SDL Manager initialized");
|
||||
@@ -45,7 +41,7 @@ namespace mlx
|
||||
Internal::WindowInfos* infos = new Internal::WindowInfos;
|
||||
Verify(infos != nullptr, "SDL: window allocation failed");
|
||||
|
||||
std::uint32_t flags = 0;
|
||||
std::uint32_t flags = SDL_WINDOW_VULKAN;
|
||||
if(hidden)
|
||||
flags |= SDL_WINDOW_HIDDEN;
|
||||
else
|
||||
@@ -58,12 +54,7 @@ namespace mlx
|
||||
infos->window = SDL_CreateWindow(info->title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, info->width, info->height, flags);
|
||||
if(!infos->window)
|
||||
FatalError("SDL: unable to open a new window; %", SDL_GetError());
|
||||
|
||||
mlx_color* buffer = new mlx_color[logo_mlx_size];
|
||||
std::memcpy(buffer, logo_mlx, logo_mlx_size);
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(buffer, logo_mlx_width, logo_mlx_height, 32, logo_mlx_width * 4, Rmask(), Gmask(), Bmask(), Amask());
|
||||
if(!infos->icon)
|
||||
FatalError("SDL: unable to create a window icon; %", SDL_GetError());
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(static_cast<void*>(logo_mlx), logo_mlx_width, logo_mlx_height, 32, 4 * logo_mlx_width, Rmask(), Gmask(), Bmask(), Amask());
|
||||
SDL_SetWindowIcon(infos->window, infos->icon);
|
||||
|
||||
m_windows_registry.insert(infos);
|
||||
@@ -81,55 +72,36 @@ namespace mlx
|
||||
if(infos->window != nullptr)
|
||||
SDL_DestroyWindow(infos->window);
|
||||
if(infos->icon != nullptr)
|
||||
{
|
||||
delete[] reinterpret_cast<mlx_color*>(infos->icon->pixels);
|
||||
SDL_FreeSurface(infos->icon);
|
||||
}
|
||||
|
||||
m_windows_registry.erase(infos);
|
||||
delete infos;
|
||||
}
|
||||
|
||||
SDL_Window* SDLManager::GetRawWindow(Handle window) noexcept
|
||||
{
|
||||
Internal::WindowInfos* infos = static_cast<Internal::WindowInfos*>(window);
|
||||
return infos->window;
|
||||
}
|
||||
|
||||
VkSurfaceKHR SDLManager::CreateVulkanSurface(Handle window, VkInstance instance) const noexcept
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
if(SDL_GetWindowWMInfo(static_cast<Internal::WindowInfos*>(window)->window, &info) != SDL_TRUE)
|
||||
FatalError("SDL Manager: cannot retrieve window informations");
|
||||
VkSurfaceKHR surface;
|
||||
if(!SDL_Vulkan_CreateSurface(static_cast<Internal::WindowInfos*>(window)->window, instance, &surface))
|
||||
FatalError("SDL: could not create a Vulkan surface; %", SDL_GetError());
|
||||
return surface;
|
||||
}
|
||||
|
||||
switch(info.subsystem)
|
||||
{
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
case SDL_SYSWM_WINDOWS: return kvfCreateSurfaceKHR(instance, KVF_SURFACE_WINDOWS, static_cast<void*>(info.info.win.hinstance), static_cast<void*>(info.info.win.window));
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
case SDL_SYSWM_X11: return kvfCreateSurfaceKHR(instance, KVF_SURFACE_XLIB, static_cast<void*>(info.info.x11.display), static_cast<void*>(&info.info.x11.window));
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||
case SDL_SYSWM_COCOA: FatalError("SDL Manager: Vulkan surfaces over Metal are not supported yet. Please fill an issue here https://github.com/seekrs/MacroLibX/issues/new");
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||
case SDL_SYSWM_WAYLAND: return kvfCreateSurfaceKHR(instance, KVF_SURFACE_WAYLAND, static_cast<void*>(info.info.wl.display), static_cast<void*>(info.info.wl.surface));
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_ANDROID
|
||||
case SDL_SYSWM_ANDROID: return kvfCreateSurfaceKHR(instance, KVF_SURFACE_ANDROID, nullptr, static_cast<void*>(info.info.android.window));
|
||||
#endif
|
||||
|
||||
default : FatalError("SDL Manager: unsupported windowing system"); break;
|
||||
}
|
||||
return VK_NULL_HANDLE;
|
||||
std::vector<const char*> SDLManager::GetRequiredVulkanInstanceExtentions(Handle window) const noexcept
|
||||
{
|
||||
std::uint32_t count;
|
||||
if(!SDL_Vulkan_GetInstanceExtensions(static_cast<Internal::WindowInfos*>(window)->window, &count, nullptr))
|
||||
FatalError("SDL Manager: could not retrieve Vulkan instance extensions");
|
||||
std::vector<const char*> extensions(count);
|
||||
if(!SDL_Vulkan_GetInstanceExtensions(static_cast<Internal::WindowInfos*>(window)->window, &count, extensions.data()))
|
||||
FatalError("SDL Manager: could not retrieve Vulkan instance extensions");
|
||||
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
return extensions;
|
||||
}
|
||||
|
||||
Vec2ui SDLManager::GetVulkanDrawableSize(Handle window) const noexcept
|
||||
{
|
||||
Vec2i extent;
|
||||
SDL_GetWindowSize(static_cast<Internal::WindowInfos*>(window)->window, &extent.x, &extent.y);
|
||||
SDL_Vulkan_GetDrawableSize(static_cast<Internal::WindowInfos*>(window)->window, &extent.x, &extent.y);
|
||||
return Vec2ui{ extent };
|
||||
}
|
||||
|
||||
@@ -162,21 +134,6 @@ namespace mlx
|
||||
SDL_SetWindowTitle(static_cast<Internal::WindowInfos*>(window)->window, title.data());
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowIcon(Handle window, NonOwningPtr<Texture> texture) const noexcept
|
||||
{
|
||||
Internal::WindowInfos* infos = static_cast<Internal::WindowInfos*>(window);
|
||||
if(infos->icon != nullptr)
|
||||
{
|
||||
delete[] reinterpret_cast<mlx_color*>(infos->icon->pixels);
|
||||
SDL_FreeSurface(infos->icon);
|
||||
}
|
||||
|
||||
int width = texture->GetWidth(), height = texture->GetHeight();
|
||||
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(texture->GetBufferCopy(), width, height, 32, width * 4, Rmask(), Gmask(), Bmask(), Amask());
|
||||
SDL_SetWindowIcon(infos->window, infos->icon);
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowFullscreen(Handle window, bool enable) const noexcept
|
||||
{
|
||||
SDL_SetWindowFullscreen(static_cast<Internal::WindowInfos*>(window)->window, (enable ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
||||
@@ -259,11 +216,6 @@ namespace mlx
|
||||
return y;
|
||||
}
|
||||
|
||||
void SDLManager::SetInputBinding(std::function<void(SDL_Event*)> functor)
|
||||
{
|
||||
m_binding_hook = std::move(functor);
|
||||
}
|
||||
|
||||
void SDLManager::InputsFetcher(std::function<void(mlx_event_type, int, int)> functor)
|
||||
{
|
||||
SDL_Event event;
|
||||
@@ -300,9 +252,6 @@ namespace mlx
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED: functor(MLX_WINDOW_EVENT, id, 5); break;
|
||||
case SDL_WINDOWEVENT_LEAVE: functor(MLX_WINDOW_EVENT, id, 6); break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST: functor(MLX_WINDOW_EVENT, id, 7); break;
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED: functor(MLX_WINDOW_EVENT, id, 8); break;
|
||||
case SDL_WINDOWEVENT_RESIZED: functor(MLX_WINDOW_EVENT, id, 9); break;
|
||||
case SDL_WINDOWEVENT_RESTORED: functor(MLX_WINDOW_EVENT, id, 11); break;
|
||||
|
||||
default : break;
|
||||
}
|
||||
@@ -311,9 +260,6 @@ namespace mlx
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if(m_binding_hook)
|
||||
m_binding_hook(&event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +267,6 @@ namespace mlx
|
||||
{
|
||||
if(m_drop_sdl_responsability)
|
||||
return;
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS);
|
||||
SDL_Quit();
|
||||
s_instance = nullptr;
|
||||
|
||||
@@ -7,14 +7,7 @@ namespace mlx
|
||||
static std::random_device random_device;
|
||||
static std::mt19937_64 engine(random_device());
|
||||
static std::uniform_int_distribution<std::uint64_t> uniform_distribution;
|
||||
static std::unordered_set<std::uint64_t> registry;
|
||||
|
||||
UUID::UUID()
|
||||
{
|
||||
do
|
||||
{
|
||||
m_uuid = uniform_distribution(engine);
|
||||
} while(registry.contains(m_uuid));
|
||||
registry.emplace(m_uuid);
|
||||
}
|
||||
UUID::UUID() : m_uuid(uniform_distribution(engine)) {}
|
||||
UUID::UUID(std::uint64_t uuid) : m_uuid(uuid) {}
|
||||
}
|
||||
|
||||
@@ -6,29 +6,6 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
PutPixelManager::PutPixelManager(NonOwningPtr<class Renderer> renderer) : p_renderer(renderer)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
std::function<void(const EventBase&)> functor = [this](const EventBase& event)
|
||||
{
|
||||
// Suboptimal for multi-windows applications
|
||||
if(event.What() == Event::ResizeEventCode)
|
||||
{
|
||||
VkExtent2D extent{ .width = 0, .height = 0 };
|
||||
if(p_renderer->GetWindow())
|
||||
extent = kvfGetSwapchainImagesSize(p_renderer->GetSwapchain().Get());
|
||||
else if(p_renderer->GetRenderTarget())
|
||||
extent = VkExtent2D{ .width = p_renderer->GetRenderTarget()->GetWidth(), .height = p_renderer->GetRenderTarget()->GetHeight() };
|
||||
else
|
||||
FatalError("a renderer was created without window nor render target attached (wtf!?)");
|
||||
|
||||
for(auto& texture : m_textures)
|
||||
texture->Resize(extent.width, extent.height);
|
||||
}
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_put_pixel_manager_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
}
|
||||
|
||||
NonOwningPtr<Texture> PutPixelManager::DrawPixel(int x, int y, std::uint64_t draw_layer, mlx_color color)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
@@ -76,8 +53,21 @@ namespace mlx
|
||||
is_newlayer = true;
|
||||
|
||||
if(m_current_texture_index >= m_textures.size())
|
||||
m_textures.push_back(NewTexture());
|
||||
{
|
||||
VkExtent2D extent{ .width = 0, .height = 0 };
|
||||
if(p_renderer->GetWindow())
|
||||
extent = kvfGetSwapchainImagesSize(p_renderer->GetSwapchain().Get());
|
||||
else if(p_renderer->GetRenderTarget())
|
||||
extent = VkExtent2D{ .width = p_renderer->GetRenderTarget()->GetWidth(), .height = p_renderer->GetRenderTarget()->GetHeight() };
|
||||
else
|
||||
FatalError("a renderer was created without window nor render target attached (wtf)");
|
||||
|
||||
#ifdef DEBUG
|
||||
m_textures.push_back(std::make_unique<Texture>(CPUBuffer{}, extent.width, extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, "mlx_put_pixel_layer_" + std::to_string(m_current_texture_index)));
|
||||
#else
|
||||
m_textures.push_back(std::make_unique<Texture>(CPUBuffer{}, extent.width, extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, std::string_view{}));
|
||||
#endif
|
||||
}
|
||||
try
|
||||
{
|
||||
m_placements[draw_layer] = m_textures.at(m_current_texture_index).get();
|
||||
@@ -93,23 +83,6 @@ namespace mlx
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Texture> PutPixelManager::NewTexture()
|
||||
{
|
||||
VkExtent2D extent{ .width = 0, .height = 0 };
|
||||
if(p_renderer->GetWindow())
|
||||
extent = kvfGetSwapchainImagesSize(p_renderer->GetSwapchain().Get());
|
||||
else if(p_renderer->GetRenderTarget())
|
||||
extent = VkExtent2D{ .width = p_renderer->GetRenderTarget()->GetWidth(), .height = p_renderer->GetRenderTarget()->GetHeight() };
|
||||
else
|
||||
FatalError("a renderer was created without window nor render target attached (wtf!?)");
|
||||
|
||||
#ifdef DEBUG
|
||||
return std::make_unique<Texture>(CPUBuffer{}, extent.width, extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, "mlx_put_pixel_layer_" + std::to_string(m_current_texture_index));
|
||||
#else
|
||||
return std::make_unique<Texture>(CPUBuffer{}, extent.width, extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, std::string_view{});
|
||||
#endif
|
||||
}
|
||||
|
||||
void PutPixelManager::ResetRenderData()
|
||||
{
|
||||
m_placements.clear();
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
#include <PreCompiled.h>
|
||||
|
||||
#include <mlx.h>
|
||||
#include <Platform/Inputs.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Core/EventBus.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
struct SwapchainResizeEventBroadcast : public EventBase
|
||||
{
|
||||
Event What() const override { return Event::SwapchainResizeEventCode; }
|
||||
};
|
||||
}
|
||||
|
||||
void Inputs::FetchInputs()
|
||||
{
|
||||
SDLManager::Get().InputsFetcher([this](mlx_event_type event, int window_id, int code)
|
||||
@@ -22,8 +14,6 @@ namespace mlx
|
||||
return;
|
||||
if(!m_events_hooks.contains(window_id) || m_events_hooks[window_id][event].empty())
|
||||
return;
|
||||
if(event == MLX_WINDOW_EVENT && code == 8)
|
||||
EventBus::SendBroadcast(Internal::SwapchainResizeEventBroadcast{});
|
||||
for(const auto& hook : m_events_hooks[window_id][event])
|
||||
{
|
||||
if(hook.fn)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace mlx
|
||||
|
||||
VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
kvfBeginCommandBuffer(cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
|
||||
kvfCopyBufferToBuffer(cmd, m_buffer, buffer.Get(), m_size, 0, 0);
|
||||
kvfCopyBufferToBuffer(cmd, m_buffer, buffer.Get(), m_size);
|
||||
kvfEndCommandBuffer(cmd);
|
||||
VkFence fence = kvfCreateFence(RenderCore::Get().GetDevice());
|
||||
kvfSubmitSingleTimeCommandBuffer(RenderCore::Get().GetDevice(), cmd, KVF_GRAPHICS_QUEUE, fence);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
constexpr std::size_t MAX_SETS_PER_POOL = 1024;
|
||||
constexpr std::size_t MAX_SETS_PER_POOL = MAX_FRAMES_IN_FLIGHT * 1024;
|
||||
|
||||
void TransitionImageToCorrectLayout(Image& image, VkCommandBuffer cmd)
|
||||
{
|
||||
@@ -26,19 +26,19 @@ namespace mlx
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
VkDescriptorPoolSize pool_sizes[] = {
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MAX_FRAMES_IN_FLIGHT * MAX_SETS_PER_POOL },
|
||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, MAX_FRAMES_IN_FLIGHT * MAX_SETS_PER_POOL },
|
||||
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, MAX_FRAMES_IN_FLIGHT * MAX_SETS_PER_POOL }
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MAX_SETS_PER_POOL },
|
||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, MAX_SETS_PER_POOL },
|
||||
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, MAX_SETS_PER_POOL }
|
||||
};
|
||||
|
||||
VkDescriptorPoolCreateInfo pool_info{};
|
||||
pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
pool_info.poolSizeCount = sizeof(pool_sizes) / sizeof(pool_sizes[0]);
|
||||
pool_info.pPoolSizes = pool_sizes;
|
||||
pool_info.maxSets = MAX_FRAMES_IN_FLIGHT * MAX_SETS_PER_POOL;
|
||||
pool_info.maxSets = MAX_SETS_PER_POOL;
|
||||
pool_info.flags = 0;
|
||||
kvfCheckVk(RenderCore::Get().vkCreateDescriptorPool(RenderCore::Get().GetDevice(), &pool_info, nullptr, &m_pool));
|
||||
DebugLog("Vulkan: created new descriptor pool");
|
||||
m_allocation_count = 0;
|
||||
}
|
||||
|
||||
void DescriptorPool::Destroy() noexcept
|
||||
@@ -52,6 +52,7 @@ namespace mlx
|
||||
kvfDestroyDescriptorSetLayout(RenderCore::Get().GetDevice(), set->m_set_layout);
|
||||
RenderCore::Get().vkDestroyDescriptorPool(RenderCore::Get().GetDevice(), m_pool, nullptr);
|
||||
m_pool = VK_NULL_HANDLE;
|
||||
m_allocation_count = 0;
|
||||
m_free_sets.clear();
|
||||
m_used_sets.clear();
|
||||
}
|
||||
@@ -102,6 +103,7 @@ namespace mlx
|
||||
alloc_info.pSetLayouts = &vulkan_layout;
|
||||
VkDescriptorSet vulkan_set;
|
||||
kvfCheckVk(RenderCore::Get().vkAllocateDescriptorSets(RenderCore::Get().GetDevice(), &alloc_info, &vulkan_set));
|
||||
m_allocation_count++;
|
||||
vulkan_sets[i] = vulkan_set;
|
||||
}
|
||||
|
||||
@@ -110,9 +112,9 @@ namespace mlx
|
||||
return set;
|
||||
}
|
||||
|
||||
void DescriptorPool::ReturnDescriptorSet(std::shared_ptr<DescriptorSet> set)
|
||||
void DescriptorPool::ReturnDescriptorSet(std::shared_ptr<class DescriptorSet> set)
|
||||
{
|
||||
auto it = std::find_if(m_used_sets.begin(), m_used_sets.end(), [&](const std::shared_ptr<DescriptorSet>& rhs_set)
|
||||
auto it = std::find_if(m_used_sets.begin(), m_used_sets.end(), [&](std::shared_ptr<DescriptorSet> rhs_set)
|
||||
{
|
||||
return set == rhs_set;
|
||||
});
|
||||
@@ -122,34 +124,23 @@ namespace mlx
|
||||
m_free_sets.push_back(set);
|
||||
}
|
||||
|
||||
bool DescriptorPool::CanAllocate(const ShaderSetLayout& layout, ShaderType shader_type) const
|
||||
{
|
||||
auto it = std::find_if(m_free_sets.begin(), m_free_sets.end(), [&](std::shared_ptr<DescriptorSet> set)
|
||||
{
|
||||
return shader_type == set->GetShaderType() && layout == set->GetShaderLayout();
|
||||
});
|
||||
if(it != m_free_sets.end())
|
||||
return true;
|
||||
return m_used_sets.size() + m_free_sets.size() < MAX_SETS_PER_POOL;
|
||||
}
|
||||
|
||||
DescriptorPool& DescriptorPoolManager::GetAvailablePool(const ShaderSetLayout& layout, ShaderType shader_type)
|
||||
DescriptorPool& DescriptorPoolManager::GetAvailablePool()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
for(auto& pool : m_pools)
|
||||
{
|
||||
if(pool->CanAllocate(layout, shader_type))
|
||||
return *pool;
|
||||
if(pool.GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
|
||||
return pool;
|
||||
}
|
||||
m_pools.emplace_back(std::make_unique<DescriptorPool>())->Init();
|
||||
return *m_pools.back();
|
||||
m_pools.emplace_back().Init();
|
||||
return m_pools.back();
|
||||
}
|
||||
|
||||
void DescriptorPoolManager::Destroy()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
for(auto& pool : m_pools)
|
||||
pool->Destroy();
|
||||
pool.Destroy();
|
||||
m_pools.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "Utils/Buffer.h"
|
||||
#include "mlx.h"
|
||||
#include <PreCompiled.h>
|
||||
#include <Renderer/Image.h>
|
||||
#include <Maths/Vec4.h>
|
||||
@@ -24,9 +22,15 @@
|
||||
#include <stb_image.h>
|
||||
#endif
|
||||
|
||||
#ifdef IMAGE_OPTIMIZED
|
||||
#define TILING VK_IMAGE_TILING_OPTIMAL
|
||||
#else
|
||||
#define TILING VK_IMAGE_TILING_LINEAR
|
||||
#endif
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
MLX_FORCEINLINE mlx_color ReverseColor(mlx_color color)
|
||||
mlx_color ReverseColor(mlx_color color)
|
||||
{
|
||||
mlx_color reversed_color;
|
||||
reversed_color.r = color.a;
|
||||
@@ -182,7 +186,7 @@ namespace mlx
|
||||
void Texture::Init(CPUBuffer pixels, std::uint32_t width, std::uint32_t height, VkFormat format, bool is_multisampled, [[maybe_unused]] std::string_view debug_name)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
Image::Init(ImageType::Color, width, height, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name));
|
||||
Image::Init(ImageType::Color, width, height, format, TILING, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name));
|
||||
Image::CreateImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
Image::CreateSampler();
|
||||
if(pixels)
|
||||
@@ -214,7 +218,7 @@ namespace mlx
|
||||
void Texture::SetPixel(int x, int y, mlx_color color) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
@@ -228,34 +232,25 @@ namespace mlx
|
||||
void Texture::SetRegion(int x, int y, int w, int h, mlx_color* pixels) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(w < 0 || h < 0 || x < -w || y < -h
|
||||
|| x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
||||
return;
|
||||
if(w < 0 || h < 0)
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
const int
|
||||
start_x = std::max<int>(x, 0),
|
||||
start_y = std::max<int>(y, 0),
|
||||
start_row = start_y * m_width,
|
||||
start_i = (start_y - y) * w + (start_x - x),
|
||||
end_x = std::min<int>(x + w, m_width),
|
||||
end_y = std::min<int>(y + h, m_height),
|
||||
end_row = end_y * m_width,
|
||||
incr = (x + w) - end_x + (start_x - x);
|
||||
for(int i = start_i, dx = start_x, row = start_row;; i++, dx++)
|
||||
for(std::uint32_t i = 0, moving_x = x, moving_y = y;; i++, moving_x++)
|
||||
{
|
||||
if(dx >= end_x)
|
||||
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
|
||||
{
|
||||
i += incr;
|
||||
dx = start_x;
|
||||
row += m_width;
|
||||
if(row >= end_row)
|
||||
moving_x = x;
|
||||
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
|
||||
break;
|
||||
moving_y++;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = ReverseColor(pixels[i]);
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = ReverseColor(pixels[i]);
|
||||
else
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = pixels[i];
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = pixels[i];
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
@@ -263,55 +258,23 @@ namespace mlx
|
||||
void Texture::SetLinearRegion(int x, int y, std::size_t len, mlx_color* pixels) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
int
|
||||
start = y * m_width + x,
|
||||
dest_start = std::max<int>(start, 0),
|
||||
src_start = dest_start - start,
|
||||
dest_end = std::min<int>(start + len, m_width * m_height);
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
{
|
||||
for(int i = dest_start, j = src_start; i < dest_end; i++, j++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[i] = ReverseColor(pixels[j]);
|
||||
for(std::size_t i = 0; i < len && (y * m_width) + x + i < m_width * m_height; i++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(y * m_width) + x + i] = ReverseColor(pixels[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(
|
||||
&m_staging_buffer->GetMap<mlx_color*>()[dest_start],
|
||||
&pixels[src_start], dest_end - dest_start);
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
|
||||
void Texture::SetRectangle(int x, int y, int w, int h, mlx_color color) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(w < 0 || h < 0 || x < -w || y < -h
|
||||
|| x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
const int
|
||||
start_x = std::max<int>(x, 0),
|
||||
start_row = std::max<int>(y, 0) * m_width,
|
||||
end_x = std::min<int>(x + w, m_width),
|
||||
end_row = std::min<int>(y + h, m_height) * m_width;
|
||||
for(int dx = start_x, row = start_row;; dx++)
|
||||
{
|
||||
if(dx >= end_x)
|
||||
{
|
||||
dx = start_x;
|
||||
row += m_width;
|
||||
if(row >= end_row)
|
||||
break;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = ReverseColor(color);
|
||||
std::size_t len_guard;
|
||||
if((y * m_width + x + len) < m_width * m_height)
|
||||
len_guard = len;
|
||||
else
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = color;
|
||||
len_guard = len - (m_width * m_height - (y * m_width + x + len));
|
||||
std::memcpy(&m_staging_buffer->GetMap<mlx_color*>()[(y * m_width) + x], pixels, len_guard);
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
@@ -319,7 +282,7 @@ namespace mlx
|
||||
mlx_color Texture::GetPixel(int x, int y) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
||||
return { .rgba = 0x00000000 };
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
@@ -332,23 +295,23 @@ namespace mlx
|
||||
void Texture::GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(w < 0 || h < 0 || x < 0 || y < 0 || static_cast<std::uint32_t>(x + w) >= m_width || static_cast<std::uint32_t>(y + h) >= m_height)
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
for(std::uint32_t i = 0, dx = x, row = y * m_width;; i++, dx++)
|
||||
for(std::uint32_t i = 0, moving_x = x, moving_y = y;; i++, moving_x++)
|
||||
{
|
||||
if(dx >= m_width)
|
||||
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
|
||||
{
|
||||
dx = x;
|
||||
row += m_width;
|
||||
if(row >= m_height * m_width)
|
||||
moving_x = x;
|
||||
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
|
||||
break;
|
||||
moving_y++;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[row + dx]);
|
||||
dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x]);
|
||||
else
|
||||
dst[i] = m_staging_buffer->GetMap<mlx_color*>()[row + dx];
|
||||
dst[i] = m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,8 +326,16 @@ namespace mlx
|
||||
processed_color.g = static_cast<std::uint8_t>(color.g * 255.f);
|
||||
processed_color.b = static_cast<std::uint8_t>(color.b * 255.f);
|
||||
processed_color.a = static_cast<std::uint8_t>(color.a * 255.f);
|
||||
for(std::size_t i = 0; i < m_width * m_height; i++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[i] = processed_color;
|
||||
if(processed_color.r == 0 && processed_color.g == 0 && processed_color.b == 0)
|
||||
std::memset(m_staging_buffer->GetMap(), processed_color.a, m_staging_buffer->GetSize());
|
||||
else
|
||||
{
|
||||
for(std::size_t y = 0; y < m_height; y++)
|
||||
{
|
||||
for(std::size_t x = 0; x < m_width; x++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[y * m_width + x] = processed_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,17 +352,6 @@ namespace mlx
|
||||
m_has_been_modified = false;
|
||||
}
|
||||
|
||||
mlx_color* Texture::GetBufferCopy() noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
|
||||
mlx_color* dst = new mlx_color[m_width * m_height];
|
||||
std::memcpy(dst, m_staging_buffer->GetMap<mlx_color*>(), m_width * m_height * sizeof(mlx_color));
|
||||
return dst;
|
||||
}
|
||||
|
||||
void Texture::OpenCPUBuffer()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
@@ -408,16 +368,8 @@ namespace mlx
|
||||
m_staging_buffer->Init(BufferType::Staging, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, {}, {});
|
||||
#endif
|
||||
|
||||
SyncCPUBuffer();
|
||||
}
|
||||
|
||||
void Texture::SyncCPUBuffer(VkCommandBuffer cmd)
|
||||
{
|
||||
if(!m_staging_buffer.has_value())
|
||||
return;
|
||||
VkImageLayout old_layout = m_layout;
|
||||
if(cmd == VK_NULL_HANDLE)
|
||||
cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
kvfBeginCommandBuffer(cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
|
||||
TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, cmd);
|
||||
kvfCopyImageToBuffer(cmd, m_staging_buffer->Get(), m_image, m_staging_buffer->GetOffset(), VK_IMAGE_ASPECT_COLOR_BIT, { m_width, m_height, 1 });
|
||||
@@ -429,105 +381,6 @@ namespace mlx
|
||||
kvfDestroyCommandBuffer(RenderCore::Get().GetDevice(), cmd);
|
||||
}
|
||||
|
||||
void Texture::CopyTo(Texture& other)
|
||||
{
|
||||
VkImageLayout old_layout = m_layout;
|
||||
VkImageLayout other_old_layout = other.GetLayout();
|
||||
|
||||
VkImageSubresourceLayers subresource{};
|
||||
subresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
subresource.mipLevel = 0;
|
||||
subresource.layerCount = 1;
|
||||
subresource.baseArrayLayer = 0;
|
||||
|
||||
VkExtent3D extent{};
|
||||
extent.width = m_width;
|
||||
extent.height = m_height;
|
||||
extent.depth = 1;
|
||||
|
||||
VkOffset3D offset{};
|
||||
offset.x = 0;
|
||||
offset.y = 0;
|
||||
offset.z = 0;
|
||||
|
||||
VkImageCopy region{};
|
||||
region.srcSubresource = subresource;
|
||||
region.dstSubresource = subresource;
|
||||
region.extent = extent;
|
||||
region.srcOffset = offset;
|
||||
region.dstOffset = offset;
|
||||
|
||||
VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
kvfBeginCommandBuffer(cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
|
||||
|
||||
TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, cmd);
|
||||
other.TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, cmd);
|
||||
|
||||
kvfCopyImageToImage(cmd, m_image, m_layout, other.Get(), other.GetLayout(), 1, ®ion);
|
||||
|
||||
TransitionLayout(old_layout, cmd);
|
||||
other.TransitionLayout(other_old_layout, cmd);
|
||||
|
||||
kvfEndCommandBuffer(cmd);
|
||||
|
||||
SyncCPUBuffer(cmd);
|
||||
}
|
||||
|
||||
void Texture::Resize(std::uint32_t width, std::uint32_t height)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
Texture new_texture = Texture(CPUBuffer{}, width, height, m_format, m_is_multisampled, m_debug_name);
|
||||
#else
|
||||
Texture new_texture = Texture(CPUBuffer{}, width, height, m_format, m_is_multisampled, std::string_view{});
|
||||
#endif
|
||||
|
||||
if(m_staging_buffer.has_value())
|
||||
{
|
||||
new_texture.OpenCPUBuffer();
|
||||
new_texture.m_staging_buffer->CopyFrom(*m_staging_buffer);
|
||||
}
|
||||
|
||||
// Suboptimal operations, should bake all of them in a single command buffer
|
||||
new_texture.Clear(VK_NULL_HANDLE, Vec4f{ 0.f });
|
||||
CopyTo(new_texture);
|
||||
|
||||
Swap(new_texture);
|
||||
|
||||
#ifdef DEBUG
|
||||
DebugLog("Texture: resized '%'", m_debug_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Texture::Swap(Texture& texture) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
|
||||
#ifdef DEBUG
|
||||
std::swap(m_debug_name, texture.m_debug_name);
|
||||
#endif
|
||||
std::swap(m_allocation, texture.m_allocation);
|
||||
std::swap(m_image, texture.m_image);
|
||||
std::swap(m_image_view, texture.m_image_view);
|
||||
std::swap(m_sampler, texture.m_sampler);
|
||||
std::swap(m_format, texture.m_format);
|
||||
std::swap(m_tiling, texture.m_tiling);
|
||||
std::swap(m_layout, texture.m_layout);
|
||||
std::swap(m_type, texture.m_type);
|
||||
std::swap(m_width, texture.m_width);
|
||||
std::swap(m_height, texture.m_height);
|
||||
std::swap(m_is_multisampled, texture.m_is_multisampled);
|
||||
|
||||
if(m_staging_buffer.has_value() && texture.m_staging_buffer.has_value())
|
||||
m_staging_buffer->Swap(*texture.m_staging_buffer);
|
||||
else if(m_staging_buffer.has_value())
|
||||
m_staging_buffer.reset();
|
||||
else if(texture.m_staging_buffer.has_value())
|
||||
texture.m_staging_buffer.reset();
|
||||
|
||||
m_has_been_modified = true;
|
||||
texture.m_has_been_modified = true;
|
||||
}
|
||||
|
||||
Texture* StbTextureLoad(const std::filesystem::path& file, int* w, int* h)
|
||||
{
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -127,9 +127,6 @@ namespace mlx
|
||||
void GraphicPipeline::Destroy() noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(m_pipeline == VK_NULL_HANDLE)
|
||||
return;
|
||||
|
||||
p_vertex_shader.reset();
|
||||
p_fragment_shader.reset();
|
||||
for(auto fb : m_framebuffers)
|
||||
|
||||
@@ -55,17 +55,17 @@ namespace mlx
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void* VKAPI_PTR VulkanAllocationFunction(void*, std::size_t size, std::size_t alignment, VkSystemAllocationScope)
|
||||
void* VulkanAllocationFunction(void*, std::size_t size, std::size_t alignment, VkSystemAllocationScope)
|
||||
{
|
||||
return MemManager::AlignedMalloc(alignment, size);
|
||||
}
|
||||
|
||||
void* VKAPI_PTR VulkanReallocationFunction(void*, void* ptr, std::size_t size, std::size_t alignment, VkSystemAllocationScope)
|
||||
void* VulkanReallocationFunction(void*, void* ptr, std::size_t size, std::size_t alignment, VkSystemAllocationScope)
|
||||
{
|
||||
return MemManager::AlignedRealloc(ptr, alignment, size);
|
||||
}
|
||||
|
||||
void VKAPI_PTR VulkanFreeFunction(void*, void* ptr)
|
||||
void VulkanFreeFunction(void*, void* ptr)
|
||||
{
|
||||
MemManager::Free(ptr);
|
||||
}
|
||||
@@ -87,41 +87,15 @@ namespace mlx
|
||||
kvfSetValidationErrorCallback(&ValidationErrorCallback);
|
||||
kvfSetValidationWarningCallback(&WarningCallback);
|
||||
|
||||
std::vector<const char*> instance_extensions;
|
||||
VkSurfaceKHR surface = VK_NULL_HANDLE;
|
||||
std::unique_ptr<Window> window;
|
||||
|
||||
bool is_headless = std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||
|
||||
if(!is_headless)
|
||||
{
|
||||
mlx_window_create_info info{};
|
||||
info.title = "";
|
||||
info.width = 1;
|
||||
info.height = 1;
|
||||
window = std::make_unique<Window>(&info, true);
|
||||
instance_extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
instance_extensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
instance_extensions.push_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
instance_extensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
instance_extensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
instance_extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
|
||||
instance_extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
#endif
|
||||
}
|
||||
mlx_window_create_info info{};
|
||||
info.title = "";
|
||||
info.width = 1;
|
||||
info.height = 1;
|
||||
Window window(&info, true);
|
||||
std::vector<const char*> instance_extensions = window.GetRequiredVulkanInstanceExtentions();
|
||||
#ifdef MLX_PLAT_MACOS
|
||||
instance_extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
m_instance = kvfCreateInstance(instance_extensions.data(), instance_extensions.size());
|
||||
DebugLog("Vulkan: instance created");
|
||||
@@ -129,34 +103,25 @@ namespace mlx
|
||||
loader->LoadInstance(m_instance);
|
||||
LoadKVFInstanceVulkanFunctionPointers();
|
||||
|
||||
if(!is_headless)
|
||||
{
|
||||
surface = window->CreateVulkanSurface(m_instance);
|
||||
m_physical_device = kvfPickGoodDefaultPhysicalDevice(m_instance, surface);
|
||||
}
|
||||
else
|
||||
m_physical_device = kvfPickGoodPhysicalDevice(m_instance, VK_NULL_HANDLE, nullptr, 0);
|
||||
VkSurfaceKHR surface = window.CreateVulkanSurface(m_instance);
|
||||
|
||||
Verify(m_physical_device != VK_NULL_HANDLE, "Could not find a suitable physical device");
|
||||
m_physical_device = kvfPickGoodDefaultPhysicalDevice(m_instance, surface);
|
||||
|
||||
// just for style
|
||||
VkPhysicalDeviceProperties props;
|
||||
vkGetPhysicalDeviceProperties(m_physical_device, &props);
|
||||
DebugLog("Vulkan: physical device picked '%'", props.deviceName);
|
||||
|
||||
std::vector<const char*> device_extensions;
|
||||
if(!is_headless)
|
||||
device_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
const char* device_extensions[] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
|
||||
VkPhysicalDeviceFeatures features{};
|
||||
vkGetPhysicalDeviceFeatures(m_physical_device, &features);
|
||||
m_device = kvfCreateDevice(m_physical_device, device_extensions.data(), device_extensions.size(), &features);
|
||||
m_device = kvfCreateDevice(m_physical_device, device_extensions, sizeof(device_extensions) / sizeof(device_extensions[0]), &features);
|
||||
DebugLog("Vulkan: logical device created");
|
||||
|
||||
loader->LoadDevice(m_device);
|
||||
LoadKVFDeviceVulkanFunctionPointers();
|
||||
|
||||
if(surface != VK_NULL_HANDLE)
|
||||
vkDestroySurfaceKHR(m_instance, surface, nullptr);
|
||||
vkDestroySurfaceKHR(m_instance, surface, nullptr);
|
||||
|
||||
VkAllocationCallbacks callbacks;
|
||||
callbacks.pUserData = nullptr;
|
||||
@@ -202,41 +167,6 @@ namespace mlx
|
||||
MLX_LOAD_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR);
|
||||
MLX_LOAD_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR);
|
||||
MLX_LOAD_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR);
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#ifdef VK_KHR_android_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateAndroidSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#ifdef VK_KHR_xcb_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateXcbSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#ifdef VK_KHR_xlib_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateXlibSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#ifdef VK_KHR_wayland_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateWaylandSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#ifdef VK_KHR_win32_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateWin32SurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#ifdef VK_EXT_metal_surface
|
||||
MLX_LOAD_FUNCTION(vkCreateMetalSurfaceEXT);
|
||||
#endif
|
||||
#endif
|
||||
kvfPassInstanceVulkanFunctionPointers(&pfns);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace mlx
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_2d_render_pass_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
|
||||
p_viewer_data_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool(p_vertex_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Vertex).RequestDescriptorSet(p_vertex_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Vertex);
|
||||
p_texture_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment).RequestDescriptorSet(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment);
|
||||
p_viewer_data_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool().RequestDescriptorSet(p_vertex_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Vertex);
|
||||
p_texture_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool().RequestDescriptorSet(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment);
|
||||
|
||||
p_viewer_data_buffer = std::make_shared<UniformBuffer>();
|
||||
p_viewer_data_buffer->Init(sizeof(ViewerData), "mlx_2d_pass_viewer_data");
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace mlx
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_final_pass_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
|
||||
p_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment).RequestDescriptorSet(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment);
|
||||
p_set = RenderCore::Get().GetDescriptorPoolManager().GetAvailablePool().RequestDescriptorSet(p_fragment_shader->GetShaderLayout().set_layouts[0].second, ShaderType::Fragment);
|
||||
}
|
||||
|
||||
void FinalPass::Pass([[maybe_unused]] Scene& scene, Renderer& renderer, Texture& render_target, NonOwningPtr<class Texture> final_target)
|
||||
|
||||
@@ -20,42 +20,29 @@ namespace mlx
|
||||
MLX_PROFILE_FUNCTION();
|
||||
p_window = window;
|
||||
m_swapchain.Init(p_window);
|
||||
Init(NonOwningPtr<Texture>{ nullptr });
|
||||
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
|
||||
{
|
||||
m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: image available semaphore created");
|
||||
m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: render finished semaphore created");
|
||||
m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: command buffer created");
|
||||
m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: fence created");
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::Init(NonOwningPtr<Texture> render_target)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
std::function<void(const EventBase&)> functor = [this](const EventBase& event)
|
||||
{
|
||||
if(event.What() == Event::ResizeEventCode)
|
||||
{
|
||||
for(std::size_t i = 0; i < m_render_finished_semaphores.size(); i++)
|
||||
{
|
||||
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
|
||||
DebugLog("Vulkan: render finished semaphore destroyed");
|
||||
}
|
||||
m_render_finished_semaphores.clear();
|
||||
for(std::size_t i = 0; i < (p_window ? m_swapchain.GetImagesCount() : 1); i++)
|
||||
{
|
||||
m_render_finished_semaphores.push_back(kvfCreateSemaphore(RenderCore::Get().GetDevice()));
|
||||
DebugLog("Vulkan: render finished semaphore created");
|
||||
}
|
||||
}
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_renderer_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
|
||||
if(render_target)
|
||||
p_render_target = render_target;
|
||||
for(std::size_t i = 0; i < (p_window ? m_swapchain.GetImagesCount() : 1); i++)
|
||||
{
|
||||
m_render_finished_semaphores.push_back(kvfCreateSemaphore(RenderCore::Get().GetDevice()));
|
||||
DebugLog("Vulkan: render finished semaphore created");
|
||||
}
|
||||
p_render_target = render_target;
|
||||
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
|
||||
{
|
||||
m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: image available semaphore created");
|
||||
m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: render finished semaphore created");
|
||||
m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
|
||||
DebugLog("Vulkan: command buffer created");
|
||||
m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice());
|
||||
@@ -79,15 +66,14 @@ namespace mlx
|
||||
void Renderer::EndFrame()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
std::size_t render_finished_index = (p_window ? m_swapchain.GetImageIndex() : 0);
|
||||
VkPipelineStageFlags wait_stages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
||||
kvfEndCommandBuffer(m_cmd_buffers[m_current_frame_index]);
|
||||
if(p_window)
|
||||
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, m_render_finished_semaphores[render_finished_index], m_image_available_semaphores[m_current_frame_index], m_cmd_fences[m_current_frame_index], wait_stages);
|
||||
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, m_render_finished_semaphores[m_current_frame_index], m_image_available_semaphores[m_current_frame_index], m_cmd_fences[m_current_frame_index], wait_stages);
|
||||
else
|
||||
kvfSubmitCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[m_current_frame_index], KVF_GRAPHICS_QUEUE, VK_NULL_HANDLE, VK_NULL_HANDLE, m_cmd_fences[m_current_frame_index], wait_stages);
|
||||
if(p_window)
|
||||
m_swapchain.Present(m_render_finished_semaphores[render_finished_index]);
|
||||
m_swapchain.Present(m_render_finished_semaphores[m_current_frame_index]);
|
||||
m_current_frame_index = (m_current_frame_index + 1) % MAX_FRAMES_IN_FLIGHT;
|
||||
}
|
||||
|
||||
@@ -95,16 +81,12 @@ namespace mlx
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
RenderCore::Get().WaitDeviceIdle();
|
||||
for(std::size_t i = 0; i < m_render_finished_semaphores.size(); i++)
|
||||
{
|
||||
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
|
||||
DebugLog("Vulkan: render finished semaphore destroyed");
|
||||
}
|
||||
m_render_finished_semaphores.clear();
|
||||
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
|
||||
{
|
||||
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_image_available_semaphores[i]);
|
||||
DebugLog("Vulkan: image available semaphore destroyed");
|
||||
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
|
||||
DebugLog("Vulkan: render finished semaphore destroyed");
|
||||
kvfDestroyCommandBuffer(RenderCore::Get().GetDevice(), m_cmd_buffers[i]);
|
||||
DebugLog("Vulkan: command buffer destroyed");
|
||||
kvfDestroyFence(RenderCore::Get().GetDevice(), m_cmd_fences[i]);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace mlx
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
std::string VulkanFormatName(VkFormat format)
|
||||
{
|
||||
#define STRINGIFY(x) case x: return #x
|
||||
@@ -158,16 +159,7 @@ namespace mlx
|
||||
void Swapchain::Init(NonOwningPtr<Window> window)
|
||||
{
|
||||
p_window = window;
|
||||
|
||||
std::function<void(const EventBase&)> functor = [this](const EventBase& event)
|
||||
{
|
||||
if(event.What() == Event::SwapchainResizeEventCode && !m_resize)
|
||||
m_resize = true;
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_swapchain_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
|
||||
CreateSwapchain();
|
||||
m_resize = false;
|
||||
}
|
||||
|
||||
void Swapchain::AquireFrame(VkSemaphore signal)
|
||||
@@ -178,7 +170,6 @@ namespace mlx
|
||||
Destroy();
|
||||
CreateSwapchain();
|
||||
EventBus::SendBroadcast(Internal::ResizeEventBroadcast{});
|
||||
m_resize = false;
|
||||
}
|
||||
|
||||
VkResult result = RenderCore::Get().vkAcquireNextImageKHR(RenderCore::Get().GetDevice(), m_swapchain, UINT64_MAX, signal, VK_NULL_HANDLE, &m_current_image_index);
|
||||
@@ -254,6 +245,7 @@ namespace mlx
|
||||
kvfSubmitSingleTimeCommandBuffer(RenderCore::Get().GetDevice(), cmd, KVF_GRAPHICS_QUEUE, fence);
|
||||
kvfDestroyFence(RenderCore::Get().GetDevice(), fence);
|
||||
kvfDestroyCommandBuffer(RenderCore::Get().GetDevice(), cmd);
|
||||
m_resize = false;
|
||||
DebugLog("Vulkan: swapchain created with format %", VulkanFormatName(format));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,6 @@ namespace mlx
|
||||
{
|
||||
static inline PFN_vkVoidFunction vkGetInstanceProcAddrStub(Handle context, const char* name)
|
||||
{
|
||||
bool is_headless = std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||
if(is_headless && std::string_view(name).find("KHR") != std::string_view::npos)
|
||||
return nullptr;
|
||||
|
||||
PFN_vkVoidFunction function = RenderCore::Get().vkGetInstanceProcAddr(static_cast<VkInstance>(context), name);
|
||||
if(!function)
|
||||
FatalError("Vulkan Loader: could not load '%'", name);
|
||||
@@ -41,10 +37,6 @@ namespace mlx
|
||||
|
||||
static inline PFN_vkVoidFunction vkGetDeviceProcAddrStub(Handle context, const char* name)
|
||||
{
|
||||
bool is_headless = std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||
if(is_headless && std::string_view(name).find("KHR") != std::string_view::npos)
|
||||
return nullptr;
|
||||
|
||||
PFN_vkVoidFunction function = RenderCore::Get().vkGetDeviceProcAddr(static_cast<VkDevice>(context), name);
|
||||
if(!function)
|
||||
FatalError("Vulkan Loader: could not load '%'", name);
|
||||
|
||||
@@ -21,6 +21,6 @@ rm vulkan-headers.zip
|
||||
|
||||
# Update KVF
|
||||
rm -f ../third_party/kvf.h
|
||||
git clone https://git.kbz8.me/kbz_8/KVF.git ../third_party/KVF/
|
||||
git clone https://github.com/Kbz-8/KVF.git ../third_party/KVF/
|
||||
mv ../third_party/KVF/kvf.h ../third_party/kvf.h
|
||||
rm -rf ../third_party/KVF
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = SDL2-2.32.8
|
||||
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-2.32.8.tar.gz
|
||||
source_filename = SDL2-2.32.8.tar.gz
|
||||
source_hash = 0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e
|
||||
patch_filename = sdl2_2.32.8-1_patch.zip
|
||||
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.32.8-1/get_patch
|
||||
patch_hash = 5df17ea39ca418826db20e96bd821fa52b5718dac64b6225119fb6588c2744f0
|
||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.32.8-1/SDL2-2.32.8.tar.gz
|
||||
wrapdb_version = 2.32.8-1
|
||||
|
||||
[provide]
|
||||
sdl2 = sdl2_dep
|
||||
sdl2main = sdl2main_dep
|
||||
sdl2_test = sdl2_test_dep
|
||||
Vendored
+15
-258
@@ -1,7 +1,7 @@
|
||||
/***
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023-2025 kbz_8
|
||||
* Copyright (c) 2023-2024 kbz_8
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -51,50 +51,10 @@
|
||||
#ifndef KBZ_8_VULKAN_FRAMEWORK_H
|
||||
#define KBZ_8_VULKAN_FRAMEWORK_H
|
||||
|
||||
#if defined(KVF_IMPL_VK_NO_PROTOTYPES) && !defined(VK_NO_PROTOTYPES)
|
||||
#ifdef KVF_IMPL_VK_NO_PROTOTYPES
|
||||
#define VK_NO_PROTOTYPES
|
||||
#endif
|
||||
|
||||
#ifndef KVF_NO_KHR
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include <vulkan/vulkan_android.h>
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include <vulkan/vulkan_wayland.h>
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
typedef struct HINSTANCE__* HINSTANCE;
|
||||
typedef struct HWND__* HWND;
|
||||
typedef struct HMONITOR__* HMONITOR;
|
||||
typedef void* HANDLE;
|
||||
typedef /*_Null_terminated_*/ const wchar_t* LPCWSTR;
|
||||
typedef unsigned long DWORD;
|
||||
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
||||
#include <vulkan/vulkan_win32.h>
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
struct xcb_connection_t;
|
||||
typedef uint32_t xcb_window_t;
|
||||
typedef uint32_t xcb_visualid_t;
|
||||
#include <vulkan/vulkan_xcb.h>
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#include <vulkan/vulkan_metal.h>
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
typedef struct _XDisplay Display;
|
||||
typedef unsigned long XID;
|
||||
typedef XID Window;
|
||||
typedef unsigned long VisualID;
|
||||
#include <vulkan/vulkan_xlib.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -122,18 +82,6 @@ typedef enum
|
||||
KVF_IMAGE_OTHER = 4,
|
||||
} KvfImageType;
|
||||
|
||||
#ifndef KVF_NO_KHR
|
||||
typedef enum
|
||||
{
|
||||
KVF_SURFACE_ANDROID = 0,
|
||||
KVF_SURFACE_XLIB = 1,
|
||||
KVF_SURFACE_XCB = 2,
|
||||
KVF_SURFACE_WAYLAND = 3,
|
||||
KVF_SURFACE_WINDOWS = 4,
|
||||
KVF_SURFACE_METAL = 5,
|
||||
} KvfSurfaceType;
|
||||
#endif
|
||||
|
||||
typedef void (*KvfErrorCallback)(const char* message);
|
||||
|
||||
#ifdef KVF_IMPL_VK_NO_PROTOTYPES
|
||||
@@ -156,7 +104,6 @@ void kvfSetValidationWarningCallback(KvfErrorCallback callback);
|
||||
void kvfAddLayer(const char* layer);
|
||||
|
||||
VkInstance kvfCreateInstance(const char** extensions_enabled, uint32_t extensions_count);
|
||||
VkInstance kvfCreateInstanceNext(const char** extensions_enabled, uint32_t extensions_count, void* p_next);
|
||||
void kvfDestroyInstance(VkInstance instance);
|
||||
|
||||
// If surfaces given to theses functions are VK_NULL_HANDLE no present queues will be searched and thus kvfQueuePresentKHR will not work
|
||||
@@ -200,39 +147,10 @@ void kvfDestroySemaphore(VkDevice device, VkSemaphore semaphore);
|
||||
uint32_t kvfGetSwapchainMinImagesCount(VkSwapchainKHR swapchain);
|
||||
VkExtent2D kvfGetSwapchainImagesSize(VkSwapchainKHR swapchain);
|
||||
void kvfDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain);
|
||||
|
||||
/**
|
||||
* For Windows:
|
||||
* - instance_handle -> HINSTANCE
|
||||
* - window_handle -> HWND window handle
|
||||
*
|
||||
* For Wayland:
|
||||
* - instance_handle -> wl_display
|
||||
* - window_handle -> wl_surface
|
||||
*
|
||||
* For XLIB:
|
||||
* - instance_handle -> Display
|
||||
* - window_handle -> Window
|
||||
*
|
||||
* For XCB:
|
||||
* - instance_handle -> xcb_connection_t
|
||||
* - window_handle -> xcb_window_t
|
||||
*
|
||||
* For Metal:
|
||||
* - instance_handle -> ignored
|
||||
* - window_handle -> CAMetalLayer
|
||||
*
|
||||
* For Android:
|
||||
* - instance_handle -> ignored
|
||||
* - window_handle -> ANativeWindow
|
||||
*/
|
||||
VkSurfaceKHR kvfCreateSurfaceKHR(VkInstance instance, KvfSurfaceType type, void* instance_handle, void* window_handle);
|
||||
#endif
|
||||
|
||||
VkImage kvfCreateImage(VkDevice device, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, KvfImageType type);
|
||||
void kvfCopyImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent);
|
||||
void kvfCopyImageToImage(VkCommandBuffer cmd, VkImage src, VkImageLayout src_layout, VkImage dst, VkImageLayout dst_layout, uint32_t count, const VkImageCopy* regions);
|
||||
|
||||
void kvfDestroyImage(VkDevice device, VkImage image);
|
||||
VkImageView kvfCreateImageView(VkDevice device, VkImage image, VkFormat format, VkImageViewType type, VkImageAspectFlags aspect, int layer_count);
|
||||
void kvfDestroyImageView(VkDevice device, VkImageView image_view);
|
||||
@@ -241,7 +159,7 @@ VkSampler kvfCreateSampler(VkDevice device, VkFilter filters, VkSamplerAddressMo
|
||||
void kvfDestroySampler(VkDevice device, VkSampler sampler);
|
||||
|
||||
VkBuffer kvfCreateBuffer(VkDevice device, VkBufferUsageFlags usage, VkDeviceSize size);
|
||||
void kvfCopyBufferToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkBuffer src, size_t size, size_t src_offset, size_t dst_offset);
|
||||
void kvfCopyBufferToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkBuffer src, size_t size);
|
||||
void kvfCopyBufferToImage(VkCommandBuffer cmd, VkImage dst, VkBuffer src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent);
|
||||
void kvfDestroyBuffer(VkDevice device, VkBuffer buffer);
|
||||
|
||||
@@ -317,7 +235,6 @@ VkPipeline kvfCreateGraphicsPipeline(VkDevice device, VkPipelineCache cache, VkP
|
||||
void kvfDestroyPipeline(VkDevice device, VkPipeline pipeline);
|
||||
|
||||
void kvfCheckVk(VkResult result);
|
||||
int32_t kvfFindMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter, VkMemoryPropertyFlags properties);
|
||||
|
||||
#ifdef KVF_IMPL_VK_NO_PROTOTYPES
|
||||
#ifdef KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE
|
||||
@@ -351,42 +268,6 @@ int32_t kvfFindMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkGetPhysicalDeviceSurfaceFormatsKHR);
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkGetPhysicalDeviceSurfacePresentModesKHR);
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkGetPhysicalDeviceSurfaceSupportKHR);
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#ifdef VK_KHR_android_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateAndroidSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#ifdef VK_KHR_xcb_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateXcbSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#ifdef VK_KHR_xlib_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateXlibSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#ifdef VK_KHR_wayland_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateWaylandSurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#ifdef VK_KHR_win32_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateWin32SurfaceKHR);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#ifdef VK_EXT_metal_surface
|
||||
KVF_DEFINE_VULKAN_FUNCTION_PROTOTYPE(vkCreateMetalSurfaceEXT);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -493,12 +374,12 @@ int32_t kvfFindMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter
|
||||
#ifdef KVF_DESCRIPTOR_POOL_CAPACITY
|
||||
#undef KVF_DESCRIPTOR_POOL_CAPACITY
|
||||
#endif
|
||||
#define KVF_DESCRIPTOR_POOL_CAPACITY 1024
|
||||
#define KVF_DESCRIPTOR_POOL_CAPACITY 512
|
||||
|
||||
#ifdef KVF_COMMAND_POOL_CAPACITY
|
||||
#undef KVF_COMMAND_POOL_CAPACITY
|
||||
#endif
|
||||
#define KVF_COMMAND_POOL_CAPACITY 1024
|
||||
#define KVF_COMMAND_POOL_CAPACITY 512
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -638,19 +519,6 @@ void kvfCheckVk(VkResult result)
|
||||
__kvfCheckVk(result);
|
||||
}
|
||||
|
||||
int32_t kvfFindMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter, VkMemoryPropertyFlags properties)
|
||||
{
|
||||
VkPhysicalDeviceMemoryProperties mem_properties;
|
||||
KVF_GET_INSTANCE_FUNCTION(vkGetPhysicalDeviceMemoryProperties)(physical_device, &mem_properties);
|
||||
|
||||
for(int32_t i = 0; i < (int32_t)mem_properties.memoryTypeCount; i++)
|
||||
{
|
||||
if((type_filter & (1 << i)) && (mem_properties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void __kvfAddDeviceToArray(VkPhysicalDevice device, int32_t graphics_queue, int32_t present_queue, int32_t compute_queue)
|
||||
{
|
||||
KVF_ASSERT(device != VK_NULL_HANDLE);
|
||||
@@ -692,7 +560,6 @@ void __kvfCompleteDevice(VkPhysicalDevice physical, VkDevice device)
|
||||
|
||||
kvf_device->device = device;
|
||||
kvf_device->cmd_pool = pool;
|
||||
kvf_device->callbacks = NULL;
|
||||
kvf_device->sets_pools = NULL;
|
||||
kvf_device->sets_pools_size = 0;
|
||||
kvf_device->cmd_buffers_size = 0;
|
||||
@@ -1283,7 +1150,7 @@ const char* kvfVerbaliseVkResult(VkResult result)
|
||||
case VK_ERROR_OUT_OF_DATE_KHR: return "A surface has changed in such a way that it is no longer compatible with the swapchain";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "The display used by a swapchain does not use the same presentable image layout";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT: return "A command failed because invalid usage was detected by the implementation or a validation layer.";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT: return "A validation layer found an error";
|
||||
|
||||
default: return "Unknown Vulkan error";
|
||||
}
|
||||
@@ -1427,11 +1294,6 @@ void kvfAddLayer(const char* layer)
|
||||
}
|
||||
|
||||
VkInstance kvfCreateInstance(const char** extensions_enabled, uint32_t extensions_count)
|
||||
{
|
||||
return kvfCreateInstanceNext(extensions_enabled, extensions_count, NULL);
|
||||
}
|
||||
|
||||
VkInstance kvfCreateInstanceNext(const char** extensions_enabled, uint32_t extensions_count, void* p_next)
|
||||
{
|
||||
VkInstance instance = VK_NULL_HANDLE;
|
||||
|
||||
@@ -1442,7 +1304,7 @@ VkInstance kvfCreateInstanceNext(const char** extensions_enabled, uint32_t exten
|
||||
create_info.ppEnabledExtensionNames = extensions_enabled;
|
||||
create_info.enabledLayerCount = 0;
|
||||
create_info.ppEnabledLayerNames = NULL;
|
||||
create_info.pNext = p_next;
|
||||
create_info.pNext = NULL;
|
||||
#if defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)
|
||||
create_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
||||
#else
|
||||
@@ -1461,8 +1323,6 @@ VkInstance kvfCreateInstanceNext(const char** extensions_enabled, uint32_t exten
|
||||
memcpy(new_extension_set, extensions_enabled, sizeof(char*) * extensions_count);
|
||||
new_extension_set[extensions_count] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||
|
||||
debug_create_info.pNext = p_next;
|
||||
|
||||
create_info.enabledExtensionCount = extensions_count + 1;
|
||||
create_info.ppEnabledExtensionNames = new_extension_set;
|
||||
create_info.enabledLayerCount = __kvf_extra_layers_count;
|
||||
@@ -1614,6 +1474,9 @@ int32_t __kvfScorePhysicalDevice(VkPhysicalDevice device, VkSurfaceKHR surface,
|
||||
if(device_props.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
|
||||
score += 1000;
|
||||
|
||||
if(!device_features.geometryShader)
|
||||
return -1;
|
||||
|
||||
score += device_props.limits.maxImageDimension2D;
|
||||
score += device_props.limits.maxBoundDescriptorSets;
|
||||
|
||||
@@ -2208,98 +2071,6 @@ void kvfDestroySemaphore(VkDevice device, VkSemaphore semaphore)
|
||||
KVF_ASSERT(device != VK_NULL_HANDLE);
|
||||
__kvfDestroySwapchain(device, swapchain);
|
||||
}
|
||||
|
||||
VkSurfaceKHR kvfCreateSurfaceKHR(VkInstance instance, KvfSurfaceType type, void* instance_handle, void* window_handle)
|
||||
{
|
||||
VkSurfaceKHR surface = VK_NULL_HANDLE;
|
||||
switch(type)
|
||||
{
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
case KVF_SURFACE_ANDROID:
|
||||
{
|
||||
VkAndroidSurfaceCreateInfoKHR create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.window = (ANativeWindow*)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateAndroidSurfaceKHR)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
case KVF_SURFACE_XLIB:
|
||||
{
|
||||
VkXlibSurfaceCreateInfoKHR create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.dpy = (Display*)instance_handle;
|
||||
create_info.window = *(Window*)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateXlibSurfaceKHR)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
case KVF_SURFACE_XCB:
|
||||
{
|
||||
VkXcbSurfaceCreateInfoKHR create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.connection = (xcb_connection_t*)instance_handle;
|
||||
create_info.window = (*xcb_window_t*)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
case KVF_SURFACE_WAYLAND:
|
||||
{
|
||||
VkWaylandSurfaceCreateInfoKHR create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.display = (wl_display*)instance_handle;
|
||||
create_info.surface = (wl_surface*)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateWaylandSurfaceKHR)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
case KVF_SURFACE_WINDOWS:
|
||||
{
|
||||
VkWin32SurfaceCreateInfoKHR create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.hinstance = (HINSTANCE)instance_handle;
|
||||
create_info.hwnd = (HWND)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateWin32SurfaceKHR)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
case KVF_SURFACE_METAL:
|
||||
{
|
||||
VkMetalSurfaceCreateInfoEXT create_info = {};
|
||||
create_info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.pLayer = (CAMetalLayer*)window_handle;
|
||||
kvfCheckVk(KVF_GET_INSTANCE_FUNCTION(vkCreateMetalSurfaceEXT)(instance, &create_info, NULL, &surface));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default: break;
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
#endif
|
||||
|
||||
VkImage kvfCreateImage(VkDevice device, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, KvfImageType type)
|
||||
@@ -2356,18 +2127,6 @@ void kvfCopyImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t
|
||||
KVF_GET_DEVICE_FUNCTION(vkCmdCopyImageToBuffer)(cmd, src, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst, 1, ®ion);
|
||||
}
|
||||
|
||||
void kvfCopyImageToImage(VkCommandBuffer cmd, VkImage src, VkImageLayout src_layout, VkImage dst, VkImageLayout dst_layout, uint32_t count, const VkImageCopy* regions)
|
||||
{
|
||||
KVF_ASSERT(cmd != VK_NULL_HANDLE);
|
||||
KVF_ASSERT(dst != VK_NULL_HANDLE);
|
||||
KVF_ASSERT(src != VK_NULL_HANDLE);
|
||||
#ifdef KVF_IMPL_VK_NO_PROTOTYPES
|
||||
__KvfDevice* kvf_device = __kvfGetKvfDeviceFromVkCommandBuffer(cmd);
|
||||
KVF_ASSERT(kvf_device != NULL && "could not find VkDevice in registered devices");
|
||||
#endif
|
||||
KVF_GET_DEVICE_FUNCTION(vkCmdCopyImage)(cmd, src, src_layout, dst, dst_layout, count, regions);
|
||||
}
|
||||
|
||||
void kvfDestroyImage(VkDevice device, VkImage image)
|
||||
{
|
||||
if(image == VK_NULL_HANDLE)
|
||||
@@ -2518,7 +2277,7 @@ VkBuffer kvfCreateBuffer(VkDevice device, VkBufferUsageFlags usage, VkDeviceSize
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void kvfCopyBufferToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkBuffer src, size_t size, size_t src_offset, size_t dst_offset)
|
||||
void kvfCopyBufferToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkBuffer src, size_t size)
|
||||
{
|
||||
KVF_ASSERT(cmd != VK_NULL_HANDLE);
|
||||
KVF_ASSERT(dst != VK_NULL_HANDLE);
|
||||
@@ -2529,8 +2288,6 @@ void kvfCopyBufferToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkBuffer src, size
|
||||
#endif
|
||||
VkBufferCopy copy_region = {};
|
||||
copy_region.size = size;
|
||||
copy_region.srcOffset = src_offset;
|
||||
copy_region.dstOffset = dst_offset;
|
||||
KVF_GET_DEVICE_FUNCTION(vkCmdCopyBuffer)(cmd, src, dst, 1, ©_region);
|
||||
}
|
||||
|
||||
@@ -2559,7 +2316,7 @@ void kvfCopyBufferToImage(VkCommandBuffer cmd, VkImage dst, VkBuffer src, size_t
|
||||
|
||||
void kvfDestroyBuffer(VkDevice device, VkBuffer buffer)
|
||||
{
|
||||
if(buffer == VK_NULL_HANDLE)
|
||||
if(buffer != VK_NULL_HANDLE)
|
||||
return;
|
||||
KVF_ASSERT(device != VK_NULL_HANDLE);
|
||||
__KvfDevice* kvf_device = __kvfGetKvfDeviceFromVkDevice(device);
|
||||
@@ -2786,7 +2543,7 @@ VkAttachmentDescription kvfBuildAttachmentDescription(KvfImageType type, VkForma
|
||||
__KvfSwapchain* kvf_swapchain = __kvfGetKvfSwapchainFromVkSwapchainKHR(swapchain);
|
||||
KVF_ASSERT(kvf_swapchain != NULL);
|
||||
KVF_ASSERT(kvf_swapchain->images_count != 0);
|
||||
return kvfBuildAttachmentDescription(KVF_IMAGE_COLOR, kvf_swapchain->images_format, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, clear, VK_SAMPLE_COUNT_1_BIT);
|
||||
return kvfBuildAttachmentDescription(KVF_IMAGE_COLOR, kvf_swapchain->images_format, VK_IMAGE_LAYOUT_UNDEFINED,VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, clear, VK_SAMPLE_COUNT_1_BIT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3176,7 +2933,7 @@ void kvfGPipelineBuilderEnableAdditiveBlending(KvfGraphicsPipelineBuilder* build
|
||||
builder->color_blend_attachment_state.dstColorBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
builder->color_blend_attachment_state.colorBlendOp = VK_BLEND_OP_ADD;
|
||||
builder->color_blend_attachment_state.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
builder->color_blend_attachment_state.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
builder->color_blend_attachment_state.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
builder->color_blend_attachment_state.alphaBlendOp = VK_BLEND_OP_ADD;
|
||||
}
|
||||
|
||||
@@ -3189,7 +2946,7 @@ void kvfGPipelineBuilderEnableAlphaBlending(KvfGraphicsPipelineBuilder* builder)
|
||||
builder->color_blend_attachment_state.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
builder->color_blend_attachment_state.colorBlendOp = VK_BLEND_OP_ADD;
|
||||
builder->color_blend_attachment_state.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
builder->color_blend_attachment_state.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
builder->color_blend_attachment_state.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
builder->color_blend_attachment_state.alphaBlendOp = VK_BLEND_OP_ADD;
|
||||
}
|
||||
|
||||
|
||||
+24
-24
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -22,27 +22,27 @@ extern "C" {
|
||||
// vulkan_video_codec_av1std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_av1std 1
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_AV1_NUM_REF_FRAMES 8U
|
||||
#define STD_VIDEO_AV1_REFS_PER_FRAME 7U
|
||||
#define STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME 8U
|
||||
#define STD_VIDEO_AV1_MAX_TILE_COLS 64U
|
||||
#define STD_VIDEO_AV1_MAX_TILE_ROWS 64U
|
||||
#define STD_VIDEO_AV1_MAX_SEGMENTS 8U
|
||||
#define STD_VIDEO_AV1_SEG_LVL_MAX 8U
|
||||
#define STD_VIDEO_AV1_PRIMARY_REF_NONE 7U
|
||||
#define STD_VIDEO_AV1_SELECT_INTEGER_MV 2U
|
||||
#define STD_VIDEO_AV1_SELECT_SCREEN_CONTENT_TOOLS 2U
|
||||
#define STD_VIDEO_AV1_SKIP_MODE_FRAMES 2U
|
||||
#define STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS 4U
|
||||
#define STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS 2U
|
||||
#define STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS 8U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_PLANES 3U
|
||||
#define STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS 6U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_Y_POINTS 14U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CB_POINTS 10U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CR_POINTS 10U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_LUMA 24U
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_CHROMA 25U
|
||||
#define STD_VIDEO_AV1_NUM_REF_FRAMES 8
|
||||
#define STD_VIDEO_AV1_REFS_PER_FRAME 7
|
||||
#define STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME 8
|
||||
#define STD_VIDEO_AV1_MAX_TILE_COLS 64
|
||||
#define STD_VIDEO_AV1_MAX_TILE_ROWS 64
|
||||
#define STD_VIDEO_AV1_MAX_SEGMENTS 8
|
||||
#define STD_VIDEO_AV1_SEG_LVL_MAX 8
|
||||
#define STD_VIDEO_AV1_PRIMARY_REF_NONE 7
|
||||
#define STD_VIDEO_AV1_SELECT_INTEGER_MV 2
|
||||
#define STD_VIDEO_AV1_SELECT_SCREEN_CONTENT_TOOLS 2
|
||||
#define STD_VIDEO_AV1_SKIP_MODE_FRAMES 2
|
||||
#define STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS 4
|
||||
#define STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS 2
|
||||
#define STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS 8
|
||||
#define STD_VIDEO_AV1_MAX_NUM_PLANES 3
|
||||
#define STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS 6
|
||||
#define STD_VIDEO_AV1_MAX_NUM_Y_POINTS 14
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CB_POINTS 10
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CR_POINTS 10
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_LUMA 24
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_CHROMA 25
|
||||
|
||||
typedef enum StdVideoAV1Profile {
|
||||
STD_VIDEO_AV1_PROFILE_MAIN = 0,
|
||||
@@ -144,7 +144,7 @@ typedef enum StdVideoAV1ColorPrimaries {
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_SMPTE_432 = 12,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_EBU_3213 = 22,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_INVALID = 0x7FFFFFFF,
|
||||
// STD_VIDEO_AV1_COLOR_PRIMARIES_BT_UNSPECIFIED is a legacy alias
|
||||
// STD_VIDEO_AV1_COLOR_PRIMARIES_BT_UNSPECIFIED is a deprecated alias
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_UNSPECIFIED = STD_VIDEO_AV1_COLOR_PRIMARIES_UNSPECIFIED,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1ColorPrimaries;
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_AV1STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
+10
-12
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -22,14 +22,14 @@ extern "C" {
|
||||
// vulkan_video_codec_h264std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h264std 1
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32U
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6U
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16U
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6U
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64U
|
||||
#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32U
|
||||
#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2U
|
||||
#define STD_VIDEO_H264_NO_REFERENCE_PICTURE 0xFFU
|
||||
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32
|
||||
#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2
|
||||
#define STD_VIDEO_H264_NO_REFERENCE_PICTURE 0xFF
|
||||
|
||||
typedef enum StdVideoH264ChromaFormatIdc {
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
@@ -44,8 +44,6 @@ typedef enum StdVideoH264ProfileIdc {
|
||||
STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66,
|
||||
STD_VIDEO_H264_PROFILE_IDC_MAIN = 77,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH = 100,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH_10 = 110,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH_422 = 122,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244,
|
||||
STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
|
||||
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2U
|
||||
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
|
||||
|
||||
typedef enum StdVideoDecodeH264FieldOrderCount {
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
+25
-25
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -22,29 +22,29 @@ extern "C" {
|
||||
// vulkan_video_codec_h265std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h265std 1
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32U
|
||||
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2U
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64U
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6U
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19U
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21U
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3U
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128U
|
||||
#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15U
|
||||
#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2U
|
||||
#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64U
|
||||
#define STD_VIDEO_H265_MAX_DPB_SIZE 16U
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32U
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16U
|
||||
#define STD_VIDEO_H265_MAX_DELTA_POC 48U
|
||||
#define STD_VIDEO_H265_NO_REFERENCE_PICTURE 0xFFU
|
||||
#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
|
||||
#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15
|
||||
#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2
|
||||
#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64
|
||||
#define STD_VIDEO_H265_MAX_DPB_SIZE 16
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16
|
||||
#define STD_VIDEO_H265_MAX_DELTA_POC 48
|
||||
#define STD_VIDEO_H265_NO_REFERENCE_PICTURE 0xFF
|
||||
|
||||
typedef enum StdVideoH265ChromaFormatIdc {
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
|
||||
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8U
|
||||
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
|
||||
typedef struct StdVideoDecodeH265PictureInfoFlags {
|
||||
uint32_t IrapPicFlag : 1;
|
||||
uint32_t IdrPicFlag : 1;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
-151
@@ -1,151 +0,0 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_VP9STD_H_
|
||||
#define VULKAN_VIDEO_CODEC_VP9STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_vp9std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_vp9std 1
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_VP9_NUM_REF_FRAMES 8U
|
||||
#define STD_VIDEO_VP9_REFS_PER_FRAME 3U
|
||||
#define STD_VIDEO_VP9_MAX_REF_FRAMES 4U
|
||||
#define STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS 2U
|
||||
#define STD_VIDEO_VP9_MAX_SEGMENTS 8U
|
||||
#define STD_VIDEO_VP9_SEG_LVL_MAX 4U
|
||||
#define STD_VIDEO_VP9_MAX_SEGMENTATION_TREE_PROBS 7U
|
||||
#define STD_VIDEO_VP9_MAX_SEGMENTATION_PRED_PROB 3U
|
||||
|
||||
typedef enum StdVideoVP9Profile {
|
||||
STD_VIDEO_VP9_PROFILE_0 = 0,
|
||||
STD_VIDEO_VP9_PROFILE_1 = 1,
|
||||
STD_VIDEO_VP9_PROFILE_2 = 2,
|
||||
STD_VIDEO_VP9_PROFILE_3 = 3,
|
||||
STD_VIDEO_VP9_PROFILE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_PROFILE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9Profile;
|
||||
|
||||
typedef enum StdVideoVP9Level {
|
||||
STD_VIDEO_VP9_LEVEL_1_0 = 0,
|
||||
STD_VIDEO_VP9_LEVEL_1_1 = 1,
|
||||
STD_VIDEO_VP9_LEVEL_2_0 = 2,
|
||||
STD_VIDEO_VP9_LEVEL_2_1 = 3,
|
||||
STD_VIDEO_VP9_LEVEL_3_0 = 4,
|
||||
STD_VIDEO_VP9_LEVEL_3_1 = 5,
|
||||
STD_VIDEO_VP9_LEVEL_4_0 = 6,
|
||||
STD_VIDEO_VP9_LEVEL_4_1 = 7,
|
||||
STD_VIDEO_VP9_LEVEL_5_0 = 8,
|
||||
STD_VIDEO_VP9_LEVEL_5_1 = 9,
|
||||
STD_VIDEO_VP9_LEVEL_5_2 = 10,
|
||||
STD_VIDEO_VP9_LEVEL_6_0 = 11,
|
||||
STD_VIDEO_VP9_LEVEL_6_1 = 12,
|
||||
STD_VIDEO_VP9_LEVEL_6_2 = 13,
|
||||
STD_VIDEO_VP9_LEVEL_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_LEVEL_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9Level;
|
||||
|
||||
typedef enum StdVideoVP9FrameType {
|
||||
STD_VIDEO_VP9_FRAME_TYPE_KEY = 0,
|
||||
STD_VIDEO_VP9_FRAME_TYPE_NON_KEY = 1,
|
||||
STD_VIDEO_VP9_FRAME_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_FRAME_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9FrameType;
|
||||
|
||||
typedef enum StdVideoVP9ReferenceName {
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_INTRA_FRAME = 0,
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_LAST_FRAME = 1,
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_GOLDEN_FRAME = 2,
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_ALTREF_FRAME = 3,
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_REFERENCE_NAME_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9ReferenceName;
|
||||
|
||||
typedef enum StdVideoVP9InterpolationFilter {
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP = 0,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_BILINEAR = 3,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_SWITCHABLE = 4,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_INTERPOLATION_FILTER_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9InterpolationFilter;
|
||||
|
||||
typedef enum StdVideoVP9ColorSpace {
|
||||
STD_VIDEO_VP9_COLOR_SPACE_UNKNOWN = 0,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_BT_601 = 1,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_BT_709 = 2,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_SMPTE_170 = 3,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_SMPTE_240 = 4,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_BT_2020 = 5,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_RESERVED = 6,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_RGB = 7,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_VP9_COLOR_SPACE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoVP9ColorSpace;
|
||||
typedef struct StdVideoVP9ColorConfigFlags {
|
||||
uint32_t color_range : 1;
|
||||
uint32_t reserved : 31;
|
||||
} StdVideoVP9ColorConfigFlags;
|
||||
|
||||
typedef struct StdVideoVP9ColorConfig {
|
||||
StdVideoVP9ColorConfigFlags flags;
|
||||
uint8_t BitDepth;
|
||||
uint8_t subsampling_x;
|
||||
uint8_t subsampling_y;
|
||||
uint8_t reserved1;
|
||||
StdVideoVP9ColorSpace color_space;
|
||||
} StdVideoVP9ColorConfig;
|
||||
|
||||
typedef struct StdVideoVP9LoopFilterFlags {
|
||||
uint32_t loop_filter_delta_enabled : 1;
|
||||
uint32_t loop_filter_delta_update : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoVP9LoopFilterFlags;
|
||||
|
||||
typedef struct StdVideoVP9LoopFilter {
|
||||
StdVideoVP9LoopFilterFlags flags;
|
||||
uint8_t loop_filter_level;
|
||||
uint8_t loop_filter_sharpness;
|
||||
uint8_t update_ref_delta;
|
||||
int8_t loop_filter_ref_deltas[STD_VIDEO_VP9_MAX_REF_FRAMES];
|
||||
uint8_t update_mode_delta;
|
||||
int8_t loop_filter_mode_deltas[STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS];
|
||||
} StdVideoVP9LoopFilter;
|
||||
|
||||
typedef struct StdVideoVP9SegmentationFlags {
|
||||
uint32_t segmentation_update_map : 1;
|
||||
uint32_t segmentation_temporal_update : 1;
|
||||
uint32_t segmentation_update_data : 1;
|
||||
uint32_t segmentation_abs_or_delta_update : 1;
|
||||
uint32_t reserved : 28;
|
||||
} StdVideoVP9SegmentationFlags;
|
||||
|
||||
typedef struct StdVideoVP9Segmentation {
|
||||
StdVideoVP9SegmentationFlags flags;
|
||||
uint8_t segmentation_tree_probs[STD_VIDEO_VP9_MAX_SEGMENTATION_TREE_PROBS];
|
||||
uint8_t segmentation_pred_prob[STD_VIDEO_VP9_MAX_SEGMENTATION_PRED_PROB];
|
||||
uint8_t FeatureEnabled[STD_VIDEO_VP9_MAX_SEGMENTS];
|
||||
int16_t FeatureData[STD_VIDEO_VP9_MAX_SEGMENTS][STD_VIDEO_VP9_SEG_LVL_MAX];
|
||||
} StdVideoVP9Segmentation;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_VP9STD_DECODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_VP9STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_vp9std_decode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_vp9std_decode 1
|
||||
#include "vulkan_video_codec_vp9std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_vp9_decode"
|
||||
typedef struct StdVideoDecodeVP9PictureInfoFlags {
|
||||
uint32_t error_resilient_mode : 1;
|
||||
uint32_t intra_only : 1;
|
||||
uint32_t allow_high_precision_mv : 1;
|
||||
uint32_t refresh_frame_context : 1;
|
||||
uint32_t frame_parallel_decoding_mode : 1;
|
||||
uint32_t segmentation_enabled : 1;
|
||||
uint32_t show_frame : 1;
|
||||
uint32_t UsePrevFrameMvs : 1;
|
||||
uint32_t reserved : 24;
|
||||
} StdVideoDecodeVP9PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeVP9PictureInfo {
|
||||
StdVideoDecodeVP9PictureInfoFlags flags;
|
||||
StdVideoVP9Profile profile;
|
||||
StdVideoVP9FrameType frame_type;
|
||||
uint8_t frame_context_idx;
|
||||
uint8_t reset_frame_context;
|
||||
uint8_t refresh_frame_flags;
|
||||
uint8_t ref_frame_sign_bias_mask;
|
||||
StdVideoVP9InterpolationFilter interpolation_filter;
|
||||
uint8_t base_q_idx;
|
||||
int8_t delta_q_y_dc;
|
||||
int8_t delta_q_uv_dc;
|
||||
int8_t delta_q_uv_ac;
|
||||
uint8_t tile_cols_log2;
|
||||
uint8_t tile_rows_log2;
|
||||
uint16_t reserved1[3];
|
||||
const StdVideoVP9ColorConfig* pColorConfig;
|
||||
const StdVideoVP9LoopFilter* pLoopFilter;
|
||||
const StdVideoVP9Segmentation* pSegmentation;
|
||||
} StdVideoDecodeVP9PictureInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_VIDEO_CODECS_COMMON_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Vendored
+1414
-2282
File diff suppressed because it is too large
Load Diff
Vendored
+3
-3
@@ -2,7 +2,8 @@
|
||||
* Copyright 2015-2023 The Khronos Group Inc.
|
||||
* Copyright 2015-2023 Valve Corporation
|
||||
* Copyright 2015-2023 LunarG, Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -43,9 +44,8 @@
|
||||
typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
|
||||
// This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
|
||||
// file directly, it won't be found.
|
||||
#ifndef IS_DEFINED_PFN_GetPhysicalDeviceProcAddr
|
||||
#ifndef PFN_GetPhysicalDeviceProcAddr
|
||||
typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
|
||||
#define IS_DEFINED_PFN_GetPhysicalDeviceProcAddr
|
||||
#endif
|
||||
|
||||
// Typedefs for loader/ICD interface
|
||||
|
||||
Vendored
+2
-4
@@ -2,7 +2,8 @@
|
||||
* Copyright 2015-2023 The Khronos Group Inc.
|
||||
* Copyright 2015-2023 Valve Corporation
|
||||
* Copyright 2015-2023 LunarG, Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -26,10 +27,7 @@
|
||||
#define VK_CURRENT_CHAIN_VERSION 1
|
||||
|
||||
// Typedef for use in the interfaces below
|
||||
#ifndef IS_DEFINED_PFN_GetPhysicalDeviceProcAddr
|
||||
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
|
||||
#define IS_DEFINED_PFN_GetPhysicalDeviceProcAddr
|
||||
#endif
|
||||
|
||||
// Version negotiation values
|
||||
typedef enum VkNegotiateLayerStructType {
|
||||
|
||||
Vendored
+3
-2
@@ -2,8 +2,9 @@
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/*
|
||||
** Copyright 2014-2026 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** Copyright 2014-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Vendored
+7990
-1053
File diff suppressed because it is too large
Load Diff
Vendored
+3
-6
@@ -2,8 +2,9 @@
|
||||
#define VULKAN_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "vk_platform.h"
|
||||
@@ -95,8 +96,4 @@
|
||||
#include "vulkan_beta.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_OHOS
|
||||
#include "vulkan_ohos.h"
|
||||
#endif
|
||||
|
||||
#endif // VULKAN_H_
|
||||
|
||||
Vendored
+4435
-10484
File diff suppressed because it is too large
Load Diff
Vendored
+2
-8
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_ANDROID_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -35,14 +35,12 @@ typedef struct VkAndroidSurfaceCreateInfoKHR {
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_ANDROID_external_memory_android_hardware_buffer is a preprocessor guard. Do not pass it to API calls.
|
||||
@@ -111,20 +109,16 @@ typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(Vk
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
|
||||
VkDevice device,
|
||||
const struct AHardwareBuffer* buffer,
|
||||
VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
|
||||
VkDevice device,
|
||||
const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
|
||||
struct AHardwareBuffer** pBuffer);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_ANDROID_external_format_resolve is a preprocessor guard. Do not pass it to API calls.
|
||||
|
||||
Vendored
+3
-152
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_BETA_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -120,7 +120,7 @@ typedef struct VkPipelineShaderStageNodeCreateInfoAMDX {
|
||||
uint32_t index;
|
||||
} VkPipelineShaderStageNodeCreateInfoAMDX;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateExecutionGraphPipelinesAMDX)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateExecutionGraphPipelinesAMDX)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)(VkDevice device, VkPipeline executionGraph, VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)(VkDevice device, VkPipeline executionGraph, const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, uint32_t* pNodeIndex);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdInitializeGraphScratchMemoryAMDX)(VkCommandBuffer commandBuffer, VkPipeline executionGraph, VkDeviceAddress scratch, VkDeviceSize scratchSize);
|
||||
@@ -129,7 +129,6 @@ typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectAMDX)(VkCommandBuffer
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectCountAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, VkDeviceSize scratchSize, VkDeviceAddress countInfo);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateExecutionGraphPipelinesAMDX(
|
||||
VkDevice device,
|
||||
VkPipelineCache pipelineCache,
|
||||
@@ -137,159 +136,42 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateExecutionGraphPipelinesAMDX(
|
||||
const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkPipeline* pPipelines);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineScratchSizeAMDX(
|
||||
VkDevice device,
|
||||
VkPipeline executionGraph,
|
||||
VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineNodeIndexAMDX(
|
||||
VkDevice device,
|
||||
VkPipeline executionGraph,
|
||||
const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo,
|
||||
uint32_t* pNodeIndex);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdInitializeGraphScratchMemoryAMDX(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkPipeline executionGraph,
|
||||
VkDeviceAddress scratch,
|
||||
VkDeviceSize scratchSize);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphAMDX(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkDeviceAddress scratch,
|
||||
VkDeviceSize scratchSize,
|
||||
const VkDispatchGraphCountInfoAMDX* pCountInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectAMDX(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkDeviceAddress scratch,
|
||||
VkDeviceSize scratchSize,
|
||||
const VkDispatchGraphCountInfoAMDX* pCountInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectCountAMDX(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkDeviceAddress scratch,
|
||||
VkDeviceSize scratchSize,
|
||||
VkDeviceAddress countInfo);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_NV_cuda_kernel_launch is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_cuda_kernel_launch 1
|
||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaModuleNV)
|
||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaFunctionNV)
|
||||
#define VK_NV_CUDA_KERNEL_LAUNCH_SPEC_VERSION 2
|
||||
#define VK_NV_CUDA_KERNEL_LAUNCH_EXTENSION_NAME "VK_NV_cuda_kernel_launch"
|
||||
typedef struct VkCudaModuleCreateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
size_t dataSize;
|
||||
const void* pData;
|
||||
} VkCudaModuleCreateInfoNV;
|
||||
|
||||
typedef struct VkCudaFunctionCreateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkCudaModuleNV module;
|
||||
const char* pName;
|
||||
} VkCudaFunctionCreateInfoNV;
|
||||
|
||||
typedef struct VkCudaLaunchInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkCudaFunctionNV function;
|
||||
uint32_t gridDimX;
|
||||
uint32_t gridDimY;
|
||||
uint32_t gridDimZ;
|
||||
uint32_t blockDimX;
|
||||
uint32_t blockDimY;
|
||||
uint32_t blockDimZ;
|
||||
uint32_t sharedMemBytes;
|
||||
size_t paramCount;
|
||||
const void* const * pParams;
|
||||
size_t extraCount;
|
||||
const void* const * pExtras;
|
||||
} VkCudaLaunchInfoNV;
|
||||
|
||||
typedef struct VkPhysicalDeviceCudaKernelLaunchFeaturesNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 cudaKernelLaunchFeatures;
|
||||
} VkPhysicalDeviceCudaKernelLaunchFeaturesNV;
|
||||
|
||||
typedef struct VkPhysicalDeviceCudaKernelLaunchPropertiesNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t computeCapabilityMinor;
|
||||
uint32_t computeCapabilityMajor;
|
||||
} VkPhysicalDeviceCudaKernelLaunchPropertiesNV;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaModuleNV)(VkDevice device, const VkCudaModuleCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCudaModuleNV* pModule);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetCudaModuleCacheNV)(VkDevice device, VkCudaModuleNV module, size_t* pCacheSize, void* pCacheData);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaFunctionNV)(VkDevice device, const VkCudaFunctionCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCudaFunctionNV* pFunction);
|
||||
typedef void (VKAPI_PTR *PFN_vkDestroyCudaModuleNV)(VkDevice device, VkCudaModuleNV module, const VkAllocationCallbacks* pAllocator);
|
||||
typedef void (VKAPI_PTR *PFN_vkDestroyCudaFunctionNV)(VkDevice device, VkCudaFunctionNV function, const VkAllocationCallbacks* pAllocator);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdCudaLaunchKernelNV)(VkCommandBuffer commandBuffer, const VkCudaLaunchInfoNV* pLaunchInfo);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateCudaModuleNV(
|
||||
VkDevice device,
|
||||
const VkCudaModuleCreateInfoNV* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkCudaModuleNV* pModule);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetCudaModuleCacheNV(
|
||||
VkDevice device,
|
||||
VkCudaModuleNV module,
|
||||
size_t* pCacheSize,
|
||||
void* pCacheData);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateCudaFunctionNV(
|
||||
VkDevice device,
|
||||
const VkCudaFunctionCreateInfoNV* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkCudaFunctionNV* pFunction);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkDestroyCudaModuleNV(
|
||||
VkDevice device,
|
||||
VkCudaModuleNV module,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkDestroyCudaFunctionNV(
|
||||
VkDevice device,
|
||||
VkCudaFunctionNV function,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdCudaLaunchKernelNV(
|
||||
VkCommandBuffer commandBuffer,
|
||||
const VkCudaLaunchInfoNV* pLaunchInfo);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_NV_displacement_micromap is a preprocessor guard. Do not pass it to API calls.
|
||||
@@ -337,37 +219,6 @@ typedef struct VkAccelerationStructureTrianglesDisplacementMicromapNV {
|
||||
} VkAccelerationStructureTrianglesDisplacementMicromapNV;
|
||||
|
||||
|
||||
|
||||
// VK_AMDX_dense_geometry_format is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_AMDX_dense_geometry_format 1
|
||||
#define VK_AMDX_DENSE_GEOMETRY_FORMAT_SPEC_VERSION 1
|
||||
#define VK_AMDX_DENSE_GEOMETRY_FORMAT_EXTENSION_NAME "VK_AMDX_dense_geometry_format"
|
||||
#define VK_COMPRESSED_TRIANGLE_FORMAT_DGF1_BYTE_ALIGNMENT_AMDX 128U
|
||||
#define VK_COMPRESSED_TRIANGLE_FORMAT_DGF1_BYTE_STRIDE_AMDX 128U
|
||||
|
||||
typedef enum VkCompressedTriangleFormatAMDX {
|
||||
VK_COMPRESSED_TRIANGLE_FORMAT_DGF1_AMDX = 0,
|
||||
VK_COMPRESSED_TRIANGLE_FORMAT_MAX_ENUM_AMDX = 0x7FFFFFFF
|
||||
} VkCompressedTriangleFormatAMDX;
|
||||
typedef struct VkPhysicalDeviceDenseGeometryFormatFeaturesAMDX {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 denseGeometryFormat;
|
||||
} VkPhysicalDeviceDenseGeometryFormatFeaturesAMDX;
|
||||
|
||||
typedef struct VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceOrHostAddressConstKHR compressedData;
|
||||
VkDeviceSize dataSize;
|
||||
uint32_t numTriangles;
|
||||
uint32_t numVertices;
|
||||
uint32_t maxPrimitiveIndex;
|
||||
uint32_t maxGeometryIndex;
|
||||
VkCompressedTriangleFormatAMDX format;
|
||||
} VkAccelerationStructureDenseGeometryFormatTrianglesDataAMDX;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Vendored
+2589
-8421
File diff suppressed because it is too large
Load Diff
Vendored
+2
-6
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_DIRECTFB_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -36,21 +36,17 @@ typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(
|
||||
VkInstance instance,
|
||||
const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
IDirectFB* dfb);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Vendored
+1762
-4735
File diff suppressed because it is too large
Load Diff
+703
-1721
File diff suppressed because it is too large
Load Diff
+4445
-7430
File diff suppressed because it is too large
Load Diff
Vendored
+2
-22
@@ -2,9 +2,9 @@
|
||||
#define VULKAN_FUCHSIA_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2026 The Khronos Group Inc.
|
||||
** Copyright 2015-2025 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -34,14 +34,12 @@ typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
|
||||
VkInstance instance,
|
||||
const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_FUCHSIA_external_memory is a preprocessor guard. Do not pass it to API calls.
|
||||
@@ -72,21 +70,17 @@ typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandleFUCHSIA)(VkDevice device
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, zx_handle_t zirconHandle, VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
||||
zx_handle_t* pZirconHandle);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(
|
||||
VkDevice device,
|
||||
VkExternalMemoryHandleTypeFlagBits handleType,
|
||||
zx_handle_t zirconHandle,
|
||||
VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_FUCHSIA_external_semaphore is a preprocessor guard. Do not pass it to API calls.
|
||||
@@ -113,19 +107,15 @@ typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreZirconHandleFUCHSIA)(VkDevice
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreZirconHandleFUCHSIA)(VkDevice device, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
||||
zx_handle_t* pZirconHandle);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// VK_FUCHSIA_buffer_collection is a preprocessor guard. Do not pass it to API calls.
|
||||
@@ -238,42 +228,32 @@ typedef void (VKAPI_PTR *PFN_vkDestroyBufferCollectionFUCHSIA)(VkDevice device,
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetBufferCollectionPropertiesFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferCollectionFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkBufferCollectionFUCHSIA* pCollection);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionImageConstraintsFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionBufferConstraintsFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkDestroyBufferCollectionFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
#endif
|
||||
|
||||
#ifndef VK_ONLY_EXPORTED_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferCollectionPropertiesFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Vendored
+14106
-19675
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user