chuigda / vulkan4j

Vulkan bindings for Java using Project-Panama (java.lang.foreign) APIs
http://vulkan4j.7dg.tech/
BSD 3-Clause "New" or "Revised" License
16 stars 0 forks source link

自引用 `ValueLayout.ADDRESS.withTargetLayout` #6

Open chuigda opened 1 month ago

chuigda commented 1 month ago

https://github.com/chuigda/vulkan4j/commit/cce76900627c99426fb5ed5e58e82d82179304a3#diff-684b0093c9c8d8b45e65a0725183bf5e2be1eae11b3f8a4b36679e911bd0937a

代码生成器生成了一个 VkBaseOutStructure.LAYOUT,其中一个字段的 layout 是 ValueLayout.ADDRESS.withTargetLayout(VkBaseOutStructure.LAYOUT)。这种数据结构在 C 语言里是完全合法的,但是 Java 里类初始化的时候 withTargetLayout 取到的这个 VkBaseOutStructure.LAYOUT 就会变成 null,进而带来一些问题。目前 CZ 进行了手动修复,但我们得为长远考虑。

CousinZe commented 1 month ago

Temporarily fixed with https://github.com/chuigda/vulkan4j/commit/5a1fe186156278473ae900ae86bc0d21d08c8e56