Noticed when manually reviewing Vortice.MediaFoundation bindings. MFTOPONODE_ATTRIBUTE_UPDATE is an example of a wrong structure. cfa2b3b adds a repro, without a fix. Union fields are supposed to all have an offset of 32, but the first member of a union (u32) is generated to have an offset of 28, which will lead to incorrectly behaving bindings.
Most likely StructTransform is not robust enough, and I'm not sure why union is aligned to 8 byte boundary, instead of traditional 4. This will require investigation into struct layout ABIs.
This is confirmed not to be a regression from 2.0.0-beta.7 to 2.0.0-beta.8.
|
public override void Process(CsStruct csStruct) |
|
{ |
|
// TODO: this mapping must be robust. Current calculation for field offset is not always accurate for union. |
|
// TODO: need to handle align/packing correctly. |
FYI, @amerkoleci.
Noticed when manually reviewing Vortice.MediaFoundation bindings.
MFTOPONODE_ATTRIBUTE_UPDATEis an example of a wrong structure. cfa2b3b adds a repro, without a fix. Union fields are supposed to all have an offset of32, but the first member of a union (u32) is generated to have an offset of28, which will lead to incorrectly behaving bindings.Most likely
StructTransformis not robust enough, and I'm not sure why union is aligned to 8 byte boundary, instead of traditional 4. This will require investigation into struct layout ABIs.This is confirmed not to be a regression from 2.0.0-beta.7 to 2.0.0-beta.8.
SharpGenTools/SharpGen/Transform/StructTransform.cs
Lines 89 to 92 in cfa2b3b
FYI, @amerkoleci.