winevulkan: Fix bit field struct members.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2021-06-22 12:15:41 +02:00 committed by Alexandre Julliard
parent 2aeab85c27
commit afa49b18ca
2 changed files with 28 additions and 14 deletions

View File

@ -1078,7 +1078,7 @@ class VkHandle(object):
class VkMember(object):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
dyn_array_len=None, optional=False, values=None, object_type=None):
dyn_array_len=None, optional=False, values=None, object_type=None, bit_width=None):
self.const = const
self.struct_fwd_decl = struct_fwd_decl
self.name = name
@ -1090,6 +1090,7 @@ class VkMember(object):
self.optional = optional
self.values = values
self.object_type = object_type
self.bit_width = bit_width
def __eq__(self, other):
""" Compare member based on name against a string.
@ -1116,6 +1117,7 @@ class VkMember(object):
member_type = None
pointer = None
array_len = None
bit_width = None
values = member.get("values")
@ -1161,8 +1163,14 @@ class VkMember(object):
object_type = member.get("objecttype", None)
# Some members are bit field values:
# <member><type>uint32_t</type> <name>mask</name>:8</member>
if name_elem.tail and name_elem.tail[0] == ':':
LOGGER.debug("Found bit field")
bit_width = int(name_elem.tail[1:])
return VkMember(const=const, struct_fwd_decl=struct_fwd_decl, _type=member_type, pointer=pointer, name=name_elem.text,
array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, values=values, object_type=object_type)
array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, values=values, object_type=object_type, bit_width=bit_width)
def copy(self, input, output, direction, conv):
""" Helper method for use by conversion logic to generate a C-code statement to copy this member.
@ -1267,6 +1275,9 @@ class VkMember(object):
if self.is_static_array():
text += "[{0}]".format(self.array_len)
if self.is_bit_field():
text += ":{}".format(self.bit_width)
return text
def get_conversions(self):
@ -1344,6 +1355,9 @@ class VkMember(object):
return self.object_type != None and self.type == "uint64_t"
def is_bit_field(self):
return self.bit_width is not None
def needs_alignment(self):
""" Check if this member needs alignment for 64-bit data.
Various structures need alignment on 64-bit variables due

View File

@ -5752,10 +5752,10 @@ typedef struct VkAccelerationStructureGeometryMotionTrianglesDataNV
typedef struct VkAccelerationStructureInstanceKHR
{
VkTransformMatrixKHR transform;
uint32_t instanceCustomIndex;
uint32_t mask;
uint32_t instanceShaderBindingTableRecordOffset;
VkGeometryInstanceFlagsKHR flags;
uint32_t instanceCustomIndex:24;
uint32_t mask:8;
uint32_t instanceShaderBindingTableRecordOffset:24;
VkGeometryInstanceFlagsKHR flags:8;
uint64_t WINE_VK_ALIGN(8) accelerationStructureReference;
} VkAccelerationStructureInstanceKHR;
typedef VkAccelerationStructureInstanceKHR VkAccelerationStructureInstanceNV;
@ -5772,10 +5772,10 @@ typedef struct VkAccelerationStructureSRTMotionInstanceNV
{
VkSRTDataNV transformT0;
VkSRTDataNV transformT1;
uint32_t instanceCustomIndex;
uint32_t mask;
uint32_t instanceShaderBindingTableRecordOffset;
VkGeometryInstanceFlagsKHR flags;
uint32_t instanceCustomIndex:24;
uint32_t mask:8;
uint32_t instanceShaderBindingTableRecordOffset:24;
VkGeometryInstanceFlagsKHR flags:8;
uint64_t WINE_VK_ALIGN(8) accelerationStructureReference;
} VkAccelerationStructureSRTMotionInstanceNV;
@ -7033,10 +7033,10 @@ typedef struct VkAccelerationStructureMatrixMotionInstanceNV
{
VkTransformMatrixKHR transformT0;
VkTransformMatrixKHR transformT1;
uint32_t instanceCustomIndex;
uint32_t mask;
uint32_t instanceShaderBindingTableRecordOffset;
VkGeometryInstanceFlagsKHR flags;
uint32_t instanceCustomIndex:24;
uint32_t mask:8;
uint32_t instanceShaderBindingTableRecordOffset:24;
VkGeometryInstanceFlagsKHR flags:8;
uint64_t WINE_VK_ALIGN(8) accelerationStructureReference;
} VkAccelerationStructureMatrixMotionInstanceNV;