From b32161679dfff3405433fd21da7fb337f7dd70fb Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 18 Sep 2019 13:37:19 -0500 Subject: [PATCH] vrclient: Add field alignment to converted structs, too --- vrclient_x64/gen_wrapper.py | 9 +++++---- vrclient_x64/vrclient_x64/struct_converters_090.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_091.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_0910.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_092.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_093.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_094.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_096.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_097.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_098.cpp | 2 +- vrclient_x64/vrclient_x64/struct_converters_099.cpp | 2 +- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index 8b82303e..0098b773 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -879,16 +879,17 @@ def handle_struct(sdkver, struct): for m in struct.get_children(): if m.kind == clang.cindex.CursorKind.FIELD_DECL: if m.type.get_canonical().kind == clang.cindex.TypeKind.CONSTANTARRAY: - cppfile.write(" %s %s[%u];\n" % (m.type.element_type.spelling, m.displayname, m.type.element_count)) + cppfile.write(" %s %s[%u]" % (m.type.element_type.spelling, m.displayname, m.type.element_count)) elif m.type.get_canonical().kind == clang.cindex.TypeKind.RECORD and \ struct_needs_conversion(m.type.get_canonical()): - cppfile.write(" win%s_%s %s;\n" % (strip_ns(m.type.spelling), display_sdkver(sdkver), m.displayname)) + cppfile.write(" win%s_%s %s" % (strip_ns(m.type.spelling), display_sdkver(sdkver), m.displayname)) else: if m.type.get_canonical().kind == clang.cindex.TypeKind.POINTER and \ m.type.get_pointee().kind == clang.cindex.TypeKind.FUNCTIONPROTO: - cppfile.write(" void *%s; /*fn pointer*/\n" % m.displayname) + cppfile.write(" void *%s /*fn pointer*/ " % m.displayname) else: - cppfile.write(" %s %s%s;\n" % (m.type.spelling, m.displayname, get_field_attribute_str(m))) + cppfile.write(" %s %s" % (m.type.spelling, m.displayname)) + cppfile.write(get_field_attribute_str(m) + ";\n") if WRAPPERS in which: cppfile.write("\n %s *linux_side;\n" % struct.displayname) cppfile.write("} __attribute__ ((ms_struct));\n") diff --git a/vrclient_x64/vrclient_x64/struct_converters_090.cpp b/vrclient_x64/vrclient_x64/struct_converters_090.cpp index 708088d1..bbd57593 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_090.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_090.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_090 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_090 diffuseTexture; + winRenderModel_TextureMap_t_090 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_091.cpp b/vrclient_x64/vrclient_x64/struct_converters_091.cpp index f7be46a7..0ac95f76 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_091.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_091.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_091 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_091 diffuseTexture; + winRenderModel_TextureMap_t_091 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_0910.cpp b/vrclient_x64/vrclient_x64/struct_converters_0910.cpp index 761f2346..a577910b 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_0910.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_0910.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_0910 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_0910 diffuseTexture; + winRenderModel_TextureMap_t_0910 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_092.cpp b/vrclient_x64/vrclient_x64/struct_converters_092.cpp index cde8d984..9590af02 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_092.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_092.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_092 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_092 diffuseTexture; + winRenderModel_TextureMap_t_092 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_093.cpp b/vrclient_x64/vrclient_x64/struct_converters_093.cpp index 129f08e0..180e8ff8 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_093.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_093.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_093 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_093 diffuseTexture; + winRenderModel_TextureMap_t_093 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_094.cpp b/vrclient_x64/vrclient_x64/struct_converters_094.cpp index 91c5e6af..5b0bc3ae 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_094.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_094.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_094 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_094 diffuseTexture; + winRenderModel_TextureMap_t_094 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_096.cpp b/vrclient_x64/vrclient_x64/struct_converters_096.cpp index cc08a992..1830c88f 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_096.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_096.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_096 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_096 diffuseTexture; + winRenderModel_TextureMap_t_096 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_097.cpp b/vrclient_x64/vrclient_x64/struct_converters_097.cpp index fe0ec17e..ebd6d5e9 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_097.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_097.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_097 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_097 diffuseTexture; + winRenderModel_TextureMap_t_097 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_098.cpp b/vrclient_x64/vrclient_x64/struct_converters_098.cpp index f24c4f91..8b73d730 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_098.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_098.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_098 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_098 diffuseTexture; + winRenderModel_TextureMap_t_098 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct)); diff --git a/vrclient_x64/vrclient_x64/struct_converters_099.cpp b/vrclient_x64/vrclient_x64/struct_converters_099.cpp index eb57a0e5..5366aaef 100644 --- a/vrclient_x64/vrclient_x64/struct_converters_099.cpp +++ b/vrclient_x64/vrclient_x64/struct_converters_099.cpp @@ -59,7 +59,7 @@ struct winRenderModel_t_099 { uint32_t unVertexCount; const uint16_t * rIndexData; uint32_t unTriangleCount; - winRenderModel_TextureMap_t_099 diffuseTexture; + winRenderModel_TextureMap_t_099 diffuseTexture __attribute__((aligned(4))); RenderModel_t *linux_side; } __attribute__ ((ms_struct));