-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect union types #40
Comments
With JuliaInterop/Clang.jl#278, #39 has:
|
Any comments on these |
Looks neat! I don't know if it's a copy-pasting error, but you're missing a
function VkClearColorValue(data::T) where {T<:Union{NTuple{4,Float32},NTuple{4,Int32},NTuple{4,UInt32}}}
r = Ref(data)
ptr = Base.unsafe_convert(Ptr{T}, r)
ptr_uint8 = convert(Ptr{UInt8}, ptr)
GC.@preserve r begin
bits = unsafe_wrap(Vector{UInt8}, ptr_uint8, (16,))
end
VkClearColorValue(tuple(bits...))
end |
Thanks! That's indeed a bug. As for the constructor, I was thinking to generate something like:
|
It's more than 10 times faster than my version. Awesome! |
I have a similar issue with // Provided by VK_KHR_acceleration_structure
typedef union VkAccelerationStructureGeometryDataKHR {
VkAccelerationStructureGeometryTrianglesDataKHR triangles;
VkAccelerationStructureGeometryAabbsDataKHR aabbs;
VkAccelerationStructureGeometryInstancesDataKHR instances;
} VkAccelerationStructureGeometryDataKHR; But is in VulkanCore defined like this: struct VkAccelerationStructureGeometryDataKHR
triangles::VkAccelerationStructureGeometryTrianglesDataKHR
end which means I'm at the moment not able to generate a TopLevel AccelerationStructure from instanceData. |
Which version are you using? Is this union in a Vulkan extension? I can not find the definition. |
I'm using VulkanCore v1.2.3 through Vulkan.jl. I checked VulkanCore#master directly, though, which has the same type definition. VulkanCore.LibVulkan.VkAccelerationStructureGeometryDataKHR(triangles::VulkanCore.LibVulkan.VkAccelerationStructureGeometryTrianglesDataKHR) in VulkanCore.LibVulkan at $HOME/.julia/packages/VulkanCore/oRcIR/gen/vk_common.jl:9190 |
There is no
It's probably in the Vulkan beta API. As discussed in #43, we need another package for these beta API definitions. cc @serenity4 |
OK, it's not in the beta API and should be generated in the lib folder. |
|
Yeah, I'm going to push a fix on the master branch and tag v1.2.5. |
Ok this was my bad. I checked VulkanCore#master again and it's just like you described. Sorry for the false information.
Thank you! |
@maj0e as Vulkan.jl still uses v1.2.3, I guess you could directly search and copy-paste the definitions you need to make an ad-hoc fix. VulkanCore.jl/lib/aarch64-linux-gnu.jl Lines 11208 to 11236 in 0ef91a8
These are the definitions for aarch64-linux-gnu, you might need to choose another one that matches your local machine. But in most cases, these definitions should be the same. |
I am planning to update Vulkan.jl to the latest version of VulkanCore for the next release, along with a few breaking changes (hopefully not too many), and there are a couple of things that require some work before it is ready. In the meantime, you can try a manual patch, but this may break the behavior of the wrapper for Vulkan.jl for this particular struct. Therefore, feel free to use VulkanCore directly as shown above. To complete what @Gnimuc said, if you don't want to modify VulkanCore directly you can define your own type (copy-pasting the code above) and You can check out this section and this section of the Vulkan.jl documentation for some help if needed. |
Thanks, both of you. I was able to make it work by using VulkanCore directly as described above. This is a site project for me to learn about the new raytracing extensions, so I'm in no hurry and will probably wait for the new Vulkan.jl version before proceeding with the raytracing_pipeline. |
The unions are currently not generated correctly. I believe this will be fixed by JuliaInterop/Clang.jl#278 (do you confirm @Gnimuc?), though I thought it would be nice to track it somewhere.
For example, the XML specification for the
VkClearColorValue
type lists:and, in Julia, we only have the
float
part of the union correct:The text was updated successfully, but these errors were encountered: