marlersoft / zigwin32

Zig bindings for Win32 generated by https://github.com/marlersoft/zigwin32gen
MIT License
257 stars 31 forks source link

ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart has incorrect signature which results in segfault #16

Open dcov opened 1 year ago

dcov commented 1 year ago

After a quick search I found this article explaining the issue: https://joshstaiger.org/notes/C-Language-Problems-in-Direct3D-12-GetCPUDescriptorHandleForHeapStart.html

The gist of it being that instead of returning a D3D12_CPU_DESCRIPTOR_HANDLE, it takes an 'out' pointer parameter.

And indeed applying the fix works:

const GetCPUDescriptorHandleForHeapStart = @ptrCast(
    *const fn (
        self: *const ID3D12DescriptorHeap,
        out: ?*D3D12_CPU_DESCRIPTOR_HANDLE,
    ) callconv(WINAPI) void,
    heap.vtable.GetCPUDescriptorHandleForHeapStart
);

I'm guessing this is an issue with the win32metadata, but I'm fine with the workaround so there's no rush on my end to fix it.

marler8997 commented 1 year ago

I think this is a manifestation of https://github.com/marlersoft/zigwin32/issues/6