Commit 8463c4f1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Fix handling unions in needs_alignment().

parent 19a23b78
......@@ -1145,6 +1145,9 @@ class VkVariable(object):
def is_struct(self):
return self.struct is not None
def is_union(self):
return self.type_info["category"] == "union"
def is_dynamic_array(self):
""" Returns if the member is an array element.
Vulkan uses this for dynamically sized arrays for which
......@@ -1177,8 +1180,8 @@ class VkVariable(object):
return False
elif self.type in ["uint64_t", "VkDeviceAddress", "VkDeviceSize"]:
return True
elif self.is_struct():
return self.struct.needs_alignment()
elif self.is_struct() or self.is_union():
return self.type_info["data"].needs_alignment()
elif self.is_handle():
# Dispatchable handles are pointers to objects, while
# non-dispatchable are uint64_t and hence need alignment.
......@@ -1399,9 +1402,6 @@ class VkMember(VkVariable):
def is_struct_forward_declaration(self):
return self.struct_fwd_decl
def is_union(self):
return self.type_info["category"] == "union"
def is_bit_field(self):
return self.bit_width is not None
......@@ -2009,6 +2009,10 @@ class VkStruct(Sequence):
return False
def needs_host_type(self):
# FIXME: needs pointer array support
if self.name == "VkAccelerationStructureGeometryKHR":
return False
for m in self.members:
if self.name == m.type:
continue
......
......@@ -7950,6 +7950,26 @@ static inline void convert_VkMicromapBuildSizesInfoEXT_host_to_win32(const VkMic
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPerformanceValueINTEL_win32_to_host(const VkPerformanceValueINTEL *in, VkPerformanceValueINTEL_host *out)
{
if (!in) return;
out->type = in->type;
out->data = in->data;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPerformanceValueINTEL_host_to_win32(const VkPerformanceValueINTEL_host *in, VkPerformanceValueINTEL *out)
{
if (!in) return;
out->type = in->type;
out->data = in->data;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPhysicalDeviceExternalSemaphoreInfo_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceExternalSemaphoreInfo *in, VkPhysicalDeviceExternalSemaphoreInfo *out)
{
const VkBaseInStructure *in_header;
......@@ -9867,6 +9887,60 @@ static inline void convert_VkPipelineInfoKHR_win32_to_host(const VkPipelineInfoK
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPipelineExecutableStatisticKHR_win32_to_host(const VkPipelineExecutableStatisticKHR *in, VkPipelineExecutableStatisticKHR_host *out)
{
if (!in) return;
out->sType = in->sType;
out->pNext = in->pNext;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPipelineExecutableStatisticKHR_host_to_win32(const VkPipelineExecutableStatisticKHR_host *in, VkPipelineExecutableStatisticKHR *out)
{
if (!in) return;
memcpy(out->name, in->name, VK_MAX_DESCRIPTION_SIZE * sizeof(char));
memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char));
out->format = in->format;
out->value = in->value;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline VkPipelineExecutableStatisticKHR_host *convert_VkPipelineExecutableStatisticKHR_array_win32_to_host(struct conversion_context *ctx, const VkPipelineExecutableStatisticKHR *in, uint32_t count)
{
VkPipelineExecutableStatisticKHR_host *out;
unsigned int i;
if (!in || !count) return NULL;
out = conversion_context_alloc(ctx, count * sizeof(*out));
for (i = 0; i < count; i++)
{
convert_VkPipelineExecutableStatisticKHR_win32_to_host(&in[i], &out[i]);
}
return out;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPipelineExecutableStatisticKHR_array_host_to_win32(const VkPipelineExecutableStatisticKHR_host *in, VkPipelineExecutableStatisticKHR *out, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
convert_VkPipelineExecutableStatisticKHR_host_to_win32(&in[i], &out[i]);
}
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkPipelineInfoEXT_win32_to_host(const VkPipelineInfoEXT *in, VkPipelineInfoEXT_host *out)
{
if (!in) return;
......@@ -21547,10 +21621,13 @@ static NTSTATUS thunk64_vkGetPerformanceParameterINTEL(void *args)
static NTSTATUS thunk32_vkGetPerformanceParameterINTEL(void *args)
{
struct vkGetPerformanceParameterINTEL_params *params = args;
VkPerformanceValueINTEL_host pValue_host;
TRACE("%p, %#x, %p\n", params->device, params->parameter, params->pValue);
params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPerformanceParameterINTEL(wine_device_from_handle(params->device)->device, params->parameter, params->pValue);
convert_VkPerformanceValueINTEL_win32_to_host(params->pValue, &pValue_host);
params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPerformanceParameterINTEL(wine_device_from_handle(params->device)->device, params->parameter, &pValue_host);
convert_VkPerformanceValueINTEL_host_to_win32(&pValue_host, params->pValue);
return STATUS_SUCCESS;
}
......@@ -22852,11 +22929,17 @@ static NTSTATUS thunk32_vkGetPipelineExecutableStatisticsKHR(void *args)
{
struct vkGetPipelineExecutableStatisticsKHR_params *params = args;
VkPipelineExecutableInfoKHR_host pExecutableInfo_host;
VkPipelineExecutableStatisticKHR_host *pStatistics_host;
struct conversion_context ctx;
TRACE("%p, %p, %p, %p\n", params->device, params->pExecutableInfo, params->pStatisticCount, params->pStatistics);
init_conversion_context(&ctx);
convert_VkPipelineExecutableInfoKHR_win32_to_host(params->pExecutableInfo, &pExecutableInfo_host);
params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineExecutableStatisticsKHR(wine_device_from_handle(params->device)->device, &pExecutableInfo_host, params->pStatisticCount, params->pStatistics);
pStatistics_host = convert_VkPipelineExecutableStatisticKHR_array_win32_to_host(&ctx, params->pStatistics, *params->pStatisticCount);
params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineExecutableStatisticsKHR(wine_device_from_handle(params->device)->device, &pExecutableInfo_host, params->pStatisticCount, pStatistics_host);
convert_VkPipelineExecutableStatisticKHR_array_host_to_win32(pStatistics_host, params->pStatistics, *params->pStatisticCount);
free_conversion_context(&ctx);
return STATUS_SUCCESS;
}
......@@ -1670,6 +1670,16 @@ typedef VkMicromapBuildSizesInfoEXT VkMicromapBuildSizesInfoEXT_host;
#endif
#if defined(USE_STRUCT_CONVERSION)
typedef struct VkPerformanceValueINTEL_host
{
VkPerformanceValueTypeINTEL type;
VkPerformanceValueDataINTEL data;
} VkPerformanceValueINTEL_host;
#else
typedef VkPerformanceValueINTEL VkPerformanceValueINTEL_host;
#endif
#if defined(USE_STRUCT_CONVERSION)
typedef struct VkImageFormatProperties_host
{
VkExtent3D maxExtent;
......@@ -2217,6 +2227,20 @@ typedef VkPipelineInfoKHR VkPipelineInfoKHR_host;
#endif
#if defined(USE_STRUCT_CONVERSION)
typedef struct VkPipelineExecutableStatisticKHR_host
{
VkStructureType sType;
void *pNext;
char name[VK_MAX_DESCRIPTION_SIZE];
char description[VK_MAX_DESCRIPTION_SIZE];
VkPipelineExecutableStatisticFormatKHR format;
VkPipelineExecutableStatisticValueKHR value;
} VkPipelineExecutableStatisticKHR_host;
#else
typedef VkPipelineExecutableStatisticKHR VkPipelineExecutableStatisticKHR_host;
#endif
#if defined(USE_STRUCT_CONVERSION)
typedef struct VkPipelineInfoEXT_host
{
VkStructureType sType;
......@@ -2847,11 +2871,11 @@ struct vulkan_device_funcs
uint32_t (*p_vkGetImageViewHandleNVX)(VkDevice, const VkImageViewHandleInfoNVX_host *);
VkResult (*p_vkGetMemoryHostPointerPropertiesEXT)(VkDevice, VkExternalMemoryHandleTypeFlagBits, const void *, VkMemoryHostPointerPropertiesEXT *);
void (*p_vkGetMicromapBuildSizesEXT)(VkDevice, VkAccelerationStructureBuildTypeKHR, const VkMicromapBuildInfoEXT_host *, VkMicromapBuildSizesInfoEXT_host *);
VkResult (*p_vkGetPerformanceParameterINTEL)(VkDevice, VkPerformanceParameterTypeINTEL, VkPerformanceValueINTEL *);
VkResult (*p_vkGetPerformanceParameterINTEL)(VkDevice, VkPerformanceParameterTypeINTEL, VkPerformanceValueINTEL_host *);
VkResult (*p_vkGetPipelineCacheData)(VkDevice, VkPipelineCache, size_t *, void *);
VkResult (*p_vkGetPipelineExecutableInternalRepresentationsKHR)(VkDevice, const VkPipelineExecutableInfoKHR_host *, uint32_t *, VkPipelineExecutableInternalRepresentationKHR *);
VkResult (*p_vkGetPipelineExecutablePropertiesKHR)(VkDevice, const VkPipelineInfoKHR_host *, uint32_t *, VkPipelineExecutablePropertiesKHR *);
VkResult (*p_vkGetPipelineExecutableStatisticsKHR)(VkDevice, const VkPipelineExecutableInfoKHR_host *, uint32_t *, VkPipelineExecutableStatisticKHR *);
VkResult (*p_vkGetPipelineExecutableStatisticsKHR)(VkDevice, const VkPipelineExecutableInfoKHR_host *, uint32_t *, VkPipelineExecutableStatisticKHR_host *);
VkResult (*p_vkGetPipelinePropertiesEXT)(VkDevice, const VkPipelineInfoEXT_host *, VkBaseOutStructure *);
void (*p_vkGetPrivateData)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *);
void (*p_vkGetPrivateDataEXT)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *);
......
......@@ -6583,7 +6583,7 @@ typedef union VkPerformanceValueDataINTEL
typedef struct VkPerformanceValueINTEL
{
VkPerformanceValueTypeINTEL type;
VkPerformanceValueDataINTEL data;
VkPerformanceValueDataINTEL WINE_VK_ALIGN(8) data;
} VkPerformanceValueINTEL;
typedef struct VkPhysicalDevice16BitStorageFeatures
......@@ -10288,7 +10288,7 @@ typedef struct VkAccelerationStructureGeometryAabbsDataKHR
{
VkStructureType sType;
const void *pNext;
VkDeviceOrHostAddressConstKHR data;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) data;
VkDeviceSize WINE_VK_ALIGN(8) stride;
} VkAccelerationStructureGeometryAabbsDataKHR;
......@@ -10297,14 +10297,14 @@ typedef struct VkAccelerationStructureGeometryInstancesDataKHR
VkStructureType sType;
const void *pNext;
VkBool32 arrayOfPointers;
VkDeviceOrHostAddressConstKHR data;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) data;
} VkAccelerationStructureGeometryInstancesDataKHR;
typedef struct VkAccelerationStructureGeometryMotionTrianglesDataNV
{
VkStructureType sType;
const void *pNext;
VkDeviceOrHostAddressConstKHR vertexData;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) vertexData;
} VkAccelerationStructureGeometryMotionTrianglesDataNV;
typedef struct VkAccelerationStructureGeometryTrianglesDataKHR
......@@ -10312,12 +10312,12 @@ typedef struct VkAccelerationStructureGeometryTrianglesDataKHR
VkStructureType sType;
const void *pNext;
VkFormat vertexFormat;
VkDeviceOrHostAddressConstKHR vertexData;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) vertexData;
VkDeviceSize WINE_VK_ALIGN(8) vertexStride;
uint32_t maxVertex;
VkIndexType indexType;
VkDeviceOrHostAddressConstKHR indexData;
VkDeviceOrHostAddressConstKHR transformData;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) indexData;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) transformData;
} VkAccelerationStructureGeometryTrianglesDataKHR;
typedef struct VkAccelerationStructureInstanceKHR
......@@ -10358,7 +10358,7 @@ typedef struct VkAccelerationStructureTrianglesOpacityMicromapEXT
VkStructureType sType;
void *pNext;
VkIndexType indexType;
VkDeviceOrHostAddressConstKHR indexBuffer;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) indexBuffer;
VkDeviceSize WINE_VK_ALIGN(8) indexStride;
uint32_t baseTriangle;
uint32_t usageCountsCount;
......@@ -10451,7 +10451,7 @@ typedef struct VkCopyAccelerationStructureToMemoryInfoKHR
VkStructureType sType;
const void *pNext;
VkAccelerationStructureKHR WINE_VK_ALIGN(8) src;
VkDeviceOrHostAddressKHR dst;
VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) dst;
VkCopyAccelerationStructureModeKHR mode;
} VkCopyAccelerationStructureToMemoryInfoKHR;
......@@ -10483,7 +10483,7 @@ typedef struct VkCopyMemoryToAccelerationStructureInfoKHR
{
VkStructureType sType;
const void *pNext;
VkDeviceOrHostAddressConstKHR src;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) src;
VkAccelerationStructureKHR WINE_VK_ALIGN(8) dst;
VkCopyAccelerationStructureModeKHR mode;
} VkCopyMemoryToAccelerationStructureInfoKHR;
......@@ -10502,7 +10502,7 @@ typedef struct VkCopyMemoryToMicromapInfoEXT
{
VkStructureType sType;
const void *pNext;
VkDeviceOrHostAddressConstKHR src;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) src;
VkMicromapEXT WINE_VK_ALIGN(8) dst;
VkCopyMicromapModeEXT mode;
} VkCopyMemoryToMicromapInfoEXT;
......@@ -10512,7 +10512,7 @@ typedef struct VkCopyMicromapToMemoryInfoEXT
VkStructureType sType;
const void *pNext;
VkMicromapEXT WINE_VK_ALIGN(8) src;
VkDeviceOrHostAddressKHR dst;
VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) dst;
VkCopyMicromapModeEXT mode;
} VkCopyMicromapToMemoryInfoEXT;
......@@ -10774,9 +10774,9 @@ typedef struct VkMicromapBuildInfoEXT
uint32_t usageCountsCount;
const VkMicromapUsageEXT *pUsageCounts;
const VkMicromapUsageEXT * const*ppUsageCounts;
VkDeviceOrHostAddressConstKHR data;
VkDeviceOrHostAddressKHR scratchData;
VkDeviceOrHostAddressConstKHR triangleArray;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) data;
VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) scratchData;
VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) triangleArray;
VkDeviceSize WINE_VK_ALIGN(8) triangleArrayStride;
} VkMicromapBuildInfoEXT;
......@@ -10852,7 +10852,7 @@ typedef struct VkPipelineExecutableStatisticKHR
char name[VK_MAX_DESCRIPTION_SIZE];
char description[VK_MAX_DESCRIPTION_SIZE];
VkPipelineExecutableStatisticFormatKHR format;
VkPipelineExecutableStatisticValueKHR value;
VkPipelineExecutableStatisticValueKHR WINE_VK_ALIGN(8) value;
} VkPipelineExecutableStatisticKHR;
typedef struct VkPipelineLayoutCreateInfo
......@@ -11059,7 +11059,7 @@ typedef union VkAccelerationStructureGeometryDataKHR
{
VkAccelerationStructureGeometryTrianglesDataKHR WINE_VK_ALIGN(8) triangles;
VkAccelerationStructureGeometryAabbsDataKHR WINE_VK_ALIGN(8) aabbs;
VkAccelerationStructureGeometryInstancesDataKHR instances;
VkAccelerationStructureGeometryInstancesDataKHR WINE_VK_ALIGN(8) instances;
} VkAccelerationStructureGeometryDataKHR;
typedef struct VkAccelerationStructureGeometryKHR
......@@ -11067,7 +11067,7 @@ typedef struct VkAccelerationStructureGeometryKHR
VkStructureType sType;
const void *pNext;
VkGeometryTypeKHR geometryType;
VkAccelerationStructureGeometryDataKHR geometry;
VkAccelerationStructureGeometryDataKHR WINE_VK_ALIGN(8) geometry;
VkGeometryFlagsKHR flags;
} VkAccelerationStructureGeometryKHR;
......@@ -11093,7 +11093,7 @@ typedef struct VkAccelerationStructureMotionInstanceNV
{
VkAccelerationStructureMotionInstanceTypeNV type;
VkAccelerationStructureMotionInstanceFlagsNV flags;
VkAccelerationStructureMotionInstanceDataNV data;
VkAccelerationStructureMotionInstanceDataNV WINE_VK_ALIGN(8) data;
} VkAccelerationStructureMotionInstanceNV;
typedef struct VkBindSparseInfo
......@@ -11209,7 +11209,7 @@ typedef struct VkAccelerationStructureBuildGeometryInfoKHR
uint32_t geometryCount;
const VkAccelerationStructureGeometryKHR *pGeometries;
const VkAccelerationStructureGeometryKHR * const*ppGeometries;
VkDeviceOrHostAddressKHR scratchData;
VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) scratchData;
} VkAccelerationStructureBuildGeometryInfoKHR;
typedef struct VkAccelerationStructureCreateInfoNV
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment