JuliaWGPU / WGPUNative.jl

WGPU bindings (Alias for WGPU_jll without JLLWrappers)
MIT License
13 stars 3 forks source link

mutability of WGPUChainedStruct #22

Open VarLad opened 5 months ago

VarLad commented 5 months ago

Shouldn't WGPUChainedStruct be mutable since a pointer to it is needed in a lot of structs, including itself

struct WGPUChainedStruct
    next::Ptr{WGPUChainedStruct}
    sType::WGPUSType
end
arhik commented 5 months ago

Usually LinkedList Datastructure should be mutable for extensibility. Let's reason around it and make changes. Meanwhile if this is a show stopper for you, you can use cStruct like interface to create this struct on heap or use Accessors.jl to create copy for each modification.

VarLad commented 5 months ago

There's a chance that we can get it fixed from Clang.jl itself Lets wait and see. https://github.com/JuliaInterop/Clang.jl/issues/490

arhik commented 5 months ago

I was going through clang.jl to find the fix. If they are fixing it upstream themselves, great. Thanks for taking initiative.

arhik commented 5 months ago

I guess they will have to check for recursive structure now.

arhik commented 5 months ago

I guess they will have to check for recursive structure now.

It's a bug rather. They should generalize Pointer to const structure as mutable 🤔.