vrclient: Add field alignment to converted structs, too

This commit is contained in:
Andrew Eikum 2019-09-18 13:37:19 -05:00
parent 1d2b72f307
commit b32161679d
11 changed files with 15 additions and 14 deletions

View File

@ -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")

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));